Mercurial > hg > octave-nkf
comparison liboctave/util/data-conv.cc @ 15271:648dabbb4c6b
build: Refactor liboctave into multiple subdirectories. Move libcruft into liboctave.
* array/Array-C.cc, array/Array-b.cc, array/Array-ch.cc, array/Array-d.cc,
array/Array-f.cc, array/Array-fC.cc, array/Array-i.cc, array/Array-idx-vec.cc,
array/Array-s.cc, array/Array-str.cc, array/Array-util.cc, array/Array-util.h,
array/Array-voidp.cc, array/Array.cc, array/Array.h, array/Array2.h,
array/Array3.h, array/ArrayN.h, array/CColVector.cc, array/CColVector.h,
array/CDiagMatrix.cc, array/CDiagMatrix.h, array/CMatrix.cc, array/CMatrix.h,
array/CNDArray.cc, array/CNDArray.h, array/CRowVector.cc, array/CRowVector.h,
array/CSparse.cc, array/CSparse.h, array/DiagArray2.cc, array/DiagArray2.h,
array/MArray-C.cc, array/MArray-d.cc, array/MArray-decl.h, array/MArray-defs.h,
array/MArray-f.cc, array/MArray-fC.cc, array/MArray-i.cc, array/MArray-s.cc,
array/MArray.cc, array/MArray.h, array/MArray2.h, array/MArrayN.h,
array/MDiagArray2.cc, array/MDiagArray2.h, array/MSparse-C.cc,
array/MSparse-d.cc, array/MSparse-defs.h, array/MSparse.cc, array/MSparse.h,
array/Matrix.h, array/MatrixType.cc, array/MatrixType.h, array/PermMatrix.cc,
array/PermMatrix.h, array/Range.cc, array/Range.h, array/Sparse-C.cc,
array/Sparse-b.cc, array/Sparse-d.cc, array/Sparse.cc, array/Sparse.h,
array/boolMatrix.cc, array/boolMatrix.h, array/boolNDArray.cc,
array/boolNDArray.h, array/boolSparse.cc, array/boolSparse.h,
array/chMatrix.cc, array/chMatrix.h, array/chNDArray.cc, array/chNDArray.h,
array/dColVector.cc, array/dColVector.h, array/dDiagMatrix.cc,
array/dDiagMatrix.h, array/dMatrix.cc, array/dMatrix.h, array/dNDArray.cc,
array/dNDArray.h, array/dRowVector.cc, array/dRowVector.h, array/dSparse.cc,
array/dSparse.h, array/dim-vector.cc, array/dim-vector.h, array/fCColVector.cc,
array/fCColVector.h, array/fCDiagMatrix.cc, array/fCDiagMatrix.h,
array/fCMatrix.cc, array/fCMatrix.h, array/fCNDArray.cc, array/fCNDArray.h,
array/fCRowVector.cc, array/fCRowVector.h, array/fColVector.cc,
array/fColVector.h, array/fDiagMatrix.cc, array/fDiagMatrix.h,
array/fMatrix.cc, array/fMatrix.h, array/fNDArray.cc, array/fNDArray.h,
array/fRowVector.cc, array/fRowVector.h, array/idx-vector.cc,
array/idx-vector.h, array/int16NDArray.cc, array/int16NDArray.h,
array/int32NDArray.cc, array/int32NDArray.h, array/int64NDArray.cc,
array/int64NDArray.h, array/int8NDArray.cc, array/int8NDArray.h,
array/intNDArray.cc, array/intNDArray.h, array/module.mk,
array/uint16NDArray.cc, array/uint16NDArray.h, array/uint32NDArray.cc,
array/uint32NDArray.h, array/uint64NDArray.cc, array/uint64NDArray.h,
array/uint8NDArray.cc, array/uint8NDArray.h:
Moved from liboctave dir to array subdirectory.
* cruft/Makefile.am, cruft/amos/README, cruft/amos/cacai.f, cruft/amos/cacon.f,
cruft/amos/cairy.f, cruft/amos/casyi.f, cruft/amos/cbesh.f, cruft/amos/cbesi.f,
cruft/amos/cbesj.f, cruft/amos/cbesk.f, cruft/amos/cbesy.f, cruft/amos/cbinu.f,
cruft/amos/cbiry.f, cruft/amos/cbknu.f, cruft/amos/cbuni.f, cruft/amos/cbunk.f,
cruft/amos/ckscl.f, cruft/amos/cmlri.f, cruft/amos/crati.f, cruft/amos/cs1s2.f,
cruft/amos/cseri.f, cruft/amos/cshch.f, cruft/amos/cuchk.f, cruft/amos/cunhj.f,
cruft/amos/cuni1.f, cruft/amos/cuni2.f, cruft/amos/cunik.f, cruft/amos/cunk1.f,
cruft/amos/cunk2.f, cruft/amos/cuoik.f, cruft/amos/cwrsk.f,
cruft/amos/dgamln.f, cruft/amos/gamln.f, cruft/amos/module.mk,
cruft/amos/xzabs.f, cruft/amos/xzexp.f, cruft/amos/xzlog.f,
cruft/amos/xzsqrt.f, cruft/amos/zacai.f, cruft/amos/zacon.f,
cruft/amos/zairy.f, cruft/amos/zasyi.f, cruft/amos/zbesh.f, cruft/amos/zbesi.f,
cruft/amos/zbesj.f, cruft/amos/zbesk.f, cruft/amos/zbesy.f, cruft/amos/zbinu.f,
cruft/amos/zbiry.f, cruft/amos/zbknu.f, cruft/amos/zbuni.f, cruft/amos/zbunk.f,
cruft/amos/zdiv.f, cruft/amos/zkscl.f, cruft/amos/zmlri.f, cruft/amos/zmlt.f,
cruft/amos/zrati.f, cruft/amos/zs1s2.f, cruft/amos/zseri.f, cruft/amos/zshch.f,
cruft/amos/zuchk.f, cruft/amos/zunhj.f, cruft/amos/zuni1.f, cruft/amos/zuni2.f,
cruft/amos/zunik.f, cruft/amos/zunk1.f, cruft/amos/zunk2.f, cruft/amos/zuoik.f,
cruft/amos/zwrsk.f, cruft/blas-xtra/cconv2.f, cruft/blas-xtra/cdotc3.f,
cruft/blas-xtra/cmatm3.f, cruft/blas-xtra/csconv2.f, cruft/blas-xtra/dconv2.f,
cruft/blas-xtra/ddot3.f, cruft/blas-xtra/dmatm3.f, cruft/blas-xtra/module.mk,
cruft/blas-xtra/sconv2.f, cruft/blas-xtra/sdot3.f, cruft/blas-xtra/smatm3.f,
cruft/blas-xtra/xcdotc.f, cruft/blas-xtra/xcdotu.f, cruft/blas-xtra/xddot.f,
cruft/blas-xtra/xdnrm2.f, cruft/blas-xtra/xdznrm2.f, cruft/blas-xtra/xerbla.f,
cruft/blas-xtra/xscnrm2.f, cruft/blas-xtra/xsdot.f, cruft/blas-xtra/xsnrm2.f,
cruft/blas-xtra/xzdotc.f, cruft/blas-xtra/xzdotu.f, cruft/blas-xtra/zconv2.f,
cruft/blas-xtra/zdconv2.f, cruft/blas-xtra/zdotc3.f, cruft/blas-xtra/zmatm3.f,
cruft/daspk/datv.f, cruft/daspk/dcnst0.f, cruft/daspk/dcnstr.f,
cruft/daspk/ddasic.f, cruft/daspk/ddasid.f, cruft/daspk/ddasik.f,
cruft/daspk/ddaspk.f, cruft/daspk/ddstp.f, cruft/daspk/ddwnrm.f,
cruft/daspk/dfnrmd.f, cruft/daspk/dfnrmk.f, cruft/daspk/dhels.f,
cruft/daspk/dheqr.f, cruft/daspk/dinvwt.f, cruft/daspk/dlinsd.f,
cruft/daspk/dlinsk.f, cruft/daspk/dmatd.f, cruft/daspk/dnedd.f,
cruft/daspk/dnedk.f, cruft/daspk/dnsd.f, cruft/daspk/dnsid.f,
cruft/daspk/dnsik.f, cruft/daspk/dnsk.f, cruft/daspk/dorth.f,
cruft/daspk/dslvd.f, cruft/daspk/dslvk.f, cruft/daspk/dspigm.f,
cruft/daspk/dyypnw.f, cruft/daspk/module.mk, cruft/dasrt/ddasrt.f,
cruft/dasrt/drchek.f, cruft/dasrt/droots.f, cruft/dasrt/module.mk,
cruft/dassl/ddaini.f, cruft/dassl/ddajac.f, cruft/dassl/ddanrm.f,
cruft/dassl/ddaslv.f, cruft/dassl/ddassl.f, cruft/dassl/ddastp.f,
cruft/dassl/ddatrp.f, cruft/dassl/ddawts.f, cruft/dassl/module.mk,
cruft/fftpack/cfftb.f, cruft/fftpack/cfftb1.f, cruft/fftpack/cfftf.f,
cruft/fftpack/cfftf1.f, cruft/fftpack/cffti.f, cruft/fftpack/cffti1.f,
cruft/fftpack/fftpack.doc, cruft/fftpack/module.mk, cruft/fftpack/passb.f,
cruft/fftpack/passb2.f, cruft/fftpack/passb3.f, cruft/fftpack/passb4.f,
cruft/fftpack/passb5.f, cruft/fftpack/passf.f, cruft/fftpack/passf2.f,
cruft/fftpack/passf3.f, cruft/fftpack/passf4.f, cruft/fftpack/passf5.f,
cruft/fftpack/zfftb.f, cruft/fftpack/zfftb1.f, cruft/fftpack/zfftf.f,
cruft/fftpack/zfftf1.f, cruft/fftpack/zffti.f, cruft/fftpack/zffti1.f,
cruft/fftpack/zpassb.f, cruft/fftpack/zpassb2.f, cruft/fftpack/zpassb3.f,
cruft/fftpack/zpassb4.f, cruft/fftpack/zpassb5.f, cruft/fftpack/zpassf.f,
cruft/fftpack/zpassf2.f, cruft/fftpack/zpassf3.f, cruft/fftpack/zpassf4.f,
cruft/fftpack/zpassf5.f, cruft/lapack-xtra/crsf2csf.f,
cruft/lapack-xtra/module.mk, cruft/lapack-xtra/xclange.f,
cruft/lapack-xtra/xdlamch.f, cruft/lapack-xtra/xdlange.f,
cruft/lapack-xtra/xilaenv.f, cruft/lapack-xtra/xslamch.f,
cruft/lapack-xtra/xslange.f, cruft/lapack-xtra/xzlange.f,
cruft/lapack-xtra/zrsf2csf.f, cruft/link-deps.mk, cruft/misc/blaswrap.c,
cruft/misc/cquit.c, cruft/misc/d1mach-tst.for, cruft/misc/d1mach.f,
cruft/misc/f77-extern.cc, cruft/misc/f77-fcn.c, cruft/misc/f77-fcn.h,
cruft/misc/i1mach.f, cruft/misc/lo-error.c, cruft/misc/lo-error.h,
cruft/misc/module.mk, cruft/misc/quit.cc, cruft/misc/quit.h,
cruft/misc/r1mach.f, cruft/mkf77def.in, cruft/odepack/cfode.f,
cruft/odepack/dlsode.f, cruft/odepack/ewset.f, cruft/odepack/intdy.f,
cruft/odepack/module.mk, cruft/odepack/prepj.f, cruft/odepack/scfode.f,
cruft/odepack/sewset.f, cruft/odepack/sintdy.f, cruft/odepack/slsode.f,
cruft/odepack/solsy.f, cruft/odepack/sprepj.f, cruft/odepack/ssolsy.f,
cruft/odepack/sstode.f, cruft/odepack/stode.f, cruft/odepack/svnorm.f,
cruft/odepack/vnorm.f, cruft/ordered-qz/README, cruft/ordered-qz/dsubsp.f,
cruft/ordered-qz/exchqz.f, cruft/ordered-qz/module.mk,
cruft/ordered-qz/sexchqz.f, cruft/ordered-qz/ssubsp.f, cruft/quadpack/dqagi.f,
cruft/quadpack/dqagie.f, cruft/quadpack/dqagp.f, cruft/quadpack/dqagpe.f,
cruft/quadpack/dqelg.f, cruft/quadpack/dqk15i.f, cruft/quadpack/dqk21.f,
cruft/quadpack/dqpsrt.f, cruft/quadpack/module.mk, cruft/quadpack/qagi.f,
cruft/quadpack/qagie.f, cruft/quadpack/qagp.f, cruft/quadpack/qagpe.f,
cruft/quadpack/qelg.f, cruft/quadpack/qk15i.f, cruft/quadpack/qk21.f,
cruft/quadpack/qpsrt.f, cruft/quadpack/xerror.f, cruft/ranlib/Basegen.doc,
cruft/ranlib/HOWTOGET, cruft/ranlib/README, cruft/ranlib/advnst.f,
cruft/ranlib/genbet.f, cruft/ranlib/genchi.f, cruft/ranlib/genexp.f,
cruft/ranlib/genf.f, cruft/ranlib/gengam.f, cruft/ranlib/genmn.f,
cruft/ranlib/genmul.f, cruft/ranlib/gennch.f, cruft/ranlib/gennf.f,
cruft/ranlib/gennor.f, cruft/ranlib/genprm.f, cruft/ranlib/genunf.f,
cruft/ranlib/getcgn.f, cruft/ranlib/getsd.f, cruft/ranlib/ignbin.f,
cruft/ranlib/ignlgi.f, cruft/ranlib/ignnbn.f, cruft/ranlib/ignpoi.f,
cruft/ranlib/ignuin.f, cruft/ranlib/initgn.f, cruft/ranlib/inrgcm.f,
cruft/ranlib/lennob.f, cruft/ranlib/mltmod.f, cruft/ranlib/module.mk,
cruft/ranlib/phrtsd.f, cruft/ranlib/qrgnin.f, cruft/ranlib/randlib.chs,
cruft/ranlib/randlib.fdoc, cruft/ranlib/ranf.f, cruft/ranlib/setall.f,
cruft/ranlib/setant.f, cruft/ranlib/setgmn.f, cruft/ranlib/setsd.f,
cruft/ranlib/sexpo.f, cruft/ranlib/sgamma.f, cruft/ranlib/snorm.f,
cruft/ranlib/tstbot.for, cruft/ranlib/tstgmn.for, cruft/ranlib/tstmid.for,
cruft/ranlib/wrap.f, cruft/slatec-err/fdump.f, cruft/slatec-err/ixsav.f,
cruft/slatec-err/j4save.f, cruft/slatec-err/module.mk,
cruft/slatec-err/xerclr.f, cruft/slatec-err/xercnt.f,
cruft/slatec-err/xerhlt.f, cruft/slatec-err/xermsg.f,
cruft/slatec-err/xerprn.f, cruft/slatec-err/xerrwd.f,
cruft/slatec-err/xersve.f, cruft/slatec-err/xgetf.f, cruft/slatec-err/xgetua.f,
cruft/slatec-err/xsetf.f, cruft/slatec-err/xsetua.f, cruft/slatec-fn/acosh.f,
cruft/slatec-fn/albeta.f, cruft/slatec-fn/algams.f, cruft/slatec-fn/alngam.f,
cruft/slatec-fn/alnrel.f, cruft/slatec-fn/asinh.f, cruft/slatec-fn/atanh.f,
cruft/slatec-fn/betai.f, cruft/slatec-fn/csevl.f, cruft/slatec-fn/d9gmit.f,
cruft/slatec-fn/d9lgic.f, cruft/slatec-fn/d9lgit.f, cruft/slatec-fn/d9lgmc.f,
cruft/slatec-fn/dacosh.f, cruft/slatec-fn/dasinh.f, cruft/slatec-fn/datanh.f,
cruft/slatec-fn/dbetai.f, cruft/slatec-fn/dcsevl.f, cruft/slatec-fn/derf.f,
cruft/slatec-fn/derfc.in.f, cruft/slatec-fn/dgami.f, cruft/slatec-fn/dgamit.f,
cruft/slatec-fn/dgamlm.f, cruft/slatec-fn/dgamma.f, cruft/slatec-fn/dgamr.f,
cruft/slatec-fn/dlbeta.f, cruft/slatec-fn/dlgams.f, cruft/slatec-fn/dlngam.f,
cruft/slatec-fn/dlnrel.f, cruft/slatec-fn/dpchim.f, cruft/slatec-fn/dpchst.f,
cruft/slatec-fn/erf.f, cruft/slatec-fn/erfc.in.f, cruft/slatec-fn/gami.f,
cruft/slatec-fn/gamit.f, cruft/slatec-fn/gamlim.f, cruft/slatec-fn/gamma.f,
cruft/slatec-fn/gamr.f, cruft/slatec-fn/initds.f, cruft/slatec-fn/inits.f,
cruft/slatec-fn/module.mk, cruft/slatec-fn/pchim.f, cruft/slatec-fn/pchst.f,
cruft/slatec-fn/r9gmit.f, cruft/slatec-fn/r9lgic.f, cruft/slatec-fn/r9lgit.f,
cruft/slatec-fn/r9lgmc.f, cruft/slatec-fn/xacosh.f, cruft/slatec-fn/xasinh.f,
cruft/slatec-fn/xatanh.f, cruft/slatec-fn/xbetai.f, cruft/slatec-fn/xdacosh.f,
cruft/slatec-fn/xdasinh.f, cruft/slatec-fn/xdatanh.f,
cruft/slatec-fn/xdbetai.f, cruft/slatec-fn/xderf.f, cruft/slatec-fn/xderfc.f,
cruft/slatec-fn/xdgami.f, cruft/slatec-fn/xdgamit.f, cruft/slatec-fn/xdgamma.f,
cruft/slatec-fn/xerf.f, cruft/slatec-fn/xerfc.f, cruft/slatec-fn/xgamma.f,
cruft/slatec-fn/xgmainc.f, cruft/slatec-fn/xsgmainc.f:
Moved from top-level libcruft to cruft directory below liboctave.
* numeric/CmplxAEPBAL.cc, numeric/CmplxAEPBAL.h, numeric/CmplxCHOL.cc,
numeric/CmplxCHOL.h, numeric/CmplxGEPBAL.cc, numeric/CmplxGEPBAL.h,
numeric/CmplxHESS.cc, numeric/CmplxHESS.h, numeric/CmplxLU.cc,
numeric/CmplxLU.h, numeric/CmplxQR.cc, numeric/CmplxQR.h, numeric/CmplxQRP.cc,
numeric/CmplxQRP.h, numeric/CmplxSCHUR.cc, numeric/CmplxSCHUR.h,
numeric/CmplxSVD.cc, numeric/CmplxSVD.h, numeric/CollocWt.cc,
numeric/CollocWt.h, numeric/DAE.h, numeric/DAEFunc.h, numeric/DAERT.h,
numeric/DAERTFunc.h, numeric/DASPK-opts.in, numeric/DASPK.cc, numeric/DASPK.h,
numeric/DASRT-opts.in, numeric/DASRT.cc, numeric/DASRT.h,
numeric/DASSL-opts.in, numeric/DASSL.cc, numeric/DASSL.h, numeric/DET.h,
numeric/EIG.cc, numeric/EIG.h, numeric/LSODE-opts.in, numeric/LSODE.cc,
numeric/LSODE.h, numeric/ODE.h, numeric/ODEFunc.h, numeric/ODES.cc,
numeric/ODES.h, numeric/ODESFunc.h, numeric/Quad-opts.in, numeric/Quad.cc,
numeric/Quad.h, numeric/SparseCmplxCHOL.cc, numeric/SparseCmplxCHOL.h,
numeric/SparseCmplxLU.cc, numeric/SparseCmplxLU.h, numeric/SparseCmplxQR.cc,
numeric/SparseCmplxQR.h, numeric/SparseQR.cc, numeric/SparseQR.h,
numeric/SparsedbleCHOL.cc, numeric/SparsedbleCHOL.h, numeric/SparsedbleLU.cc,
numeric/SparsedbleLU.h, numeric/base-aepbal.h, numeric/base-dae.h,
numeric/base-de.h, numeric/base-lu.cc, numeric/base-lu.h, numeric/base-min.h,
numeric/base-qr.cc, numeric/base-qr.h, numeric/bsxfun-decl.h,
numeric/bsxfun-defs.cc, numeric/bsxfun.h, numeric/dbleAEPBAL.cc,
numeric/dbleAEPBAL.h, numeric/dbleCHOL.cc, numeric/dbleCHOL.h,
numeric/dbleGEPBAL.cc, numeric/dbleGEPBAL.h, numeric/dbleHESS.cc,
numeric/dbleHESS.h, numeric/dbleLU.cc, numeric/dbleLU.h, numeric/dbleQR.cc,
numeric/dbleQR.h, numeric/dbleQRP.cc, numeric/dbleQRP.h, numeric/dbleSCHUR.cc,
numeric/dbleSCHUR.h, numeric/dbleSVD.cc, numeric/dbleSVD.h,
numeric/eigs-base.cc, numeric/fCmplxAEPBAL.cc, numeric/fCmplxAEPBAL.h,
numeric/fCmplxCHOL.cc, numeric/fCmplxCHOL.h, numeric/fCmplxGEPBAL.cc,
numeric/fCmplxGEPBAL.h, numeric/fCmplxHESS.cc, numeric/fCmplxHESS.h,
numeric/fCmplxLU.cc, numeric/fCmplxLU.h, numeric/fCmplxQR.cc,
numeric/fCmplxQR.h, numeric/fCmplxQRP.cc, numeric/fCmplxQRP.h,
numeric/fCmplxSCHUR.cc, numeric/fCmplxSCHUR.h, numeric/fCmplxSVD.cc,
numeric/fCmplxSVD.h, numeric/fEIG.cc, numeric/fEIG.h, numeric/floatAEPBAL.cc,
numeric/floatAEPBAL.h, numeric/floatCHOL.cc, numeric/floatCHOL.h,
numeric/floatGEPBAL.cc, numeric/floatGEPBAL.h, numeric/floatHESS.cc,
numeric/floatHESS.h, numeric/floatLU.cc, numeric/floatLU.h, numeric/floatQR.cc,
numeric/floatQR.h, numeric/floatQRP.cc, numeric/floatQRP.h,
numeric/floatSCHUR.cc, numeric/floatSCHUR.h, numeric/floatSVD.cc,
numeric/floatSVD.h, numeric/lo-mappers.cc, numeric/lo-mappers.h,
numeric/lo-specfun.cc, numeric/lo-specfun.h, numeric/module.mk,
numeric/oct-convn.cc, numeric/oct-convn.h, numeric/oct-fftw.cc,
numeric/oct-fftw.h, numeric/oct-norm.cc, numeric/oct-norm.h,
numeric/oct-rand.cc, numeric/oct-rand.h, numeric/oct-spparms.cc,
numeric/oct-spparms.h, numeric/randgamma.c, numeric/randgamma.h,
numeric/randmtzig.c, numeric/randmtzig.h, numeric/randpoisson.c,
numeric/randpoisson.h, numeric/sparse-base-chol.cc, numeric/sparse-base-chol.h,
numeric/sparse-base-lu.cc, numeric/sparse-base-lu.h, numeric/sparse-dmsolve.cc:
Moved from liboctave dir to numeric subdirectory.
* operators/Sparse-diag-op-defs.h, operators/Sparse-op-defs.h,
operators/Sparse-perm-op-defs.h, operators/config-ops.sh, operators/mk-ops.awk,
operators/module.mk, operators/mx-base.h, operators/mx-defs.h,
operators/mx-ext.h, operators/mx-inlines.cc, operators/mx-op-decl.h,
operators/mx-op-defs.h, operators/mx-ops, operators/sparse-mk-ops.awk,
operators/sparse-mx-ops, operators/vx-ops:
Moved from liboctave dir to operators subdirectory.
* system/dir-ops.cc, system/dir-ops.h, system/file-ops.cc, system/file-ops.h,
system/file-stat.cc, system/file-stat.h, system/lo-sysdep.cc,
system/lo-sysdep.h, system/mach-info.cc, system/mach-info.h, system/module.mk,
system/oct-env.cc, system/oct-env.h, system/oct-group.cc, system/oct-group.h,
system/oct-openmp.h, system/oct-passwd.cc, system/oct-passwd.h,
system/oct-syscalls.cc, system/oct-syscalls.h, system/oct-time.cc,
system/oct-time.h, system/oct-uname.cc, system/oct-uname.h, system/pathlen.h,
system/sysdir.h, system/syswait.h, system/tempnam.c, system/tempname.c:
Moved from liboctave dir to system subdirectory.
* util/base-list.h, util/byte-swap.h, util/caseless-str.h, util/cmd-edit.cc,
util/cmd-edit.h, util/cmd-hist.cc, util/cmd-hist.h, util/data-conv.cc,
util/data-conv.h, util/f2c-main.c, util/functor.h, util/glob-match.cc,
util/glob-match.h, util/kpse.cc, util/lo-array-gripes.cc,
util/lo-array-gripes.h, util/lo-cieee.c, util/lo-cutils.c, util/lo-cutils.h,
util/lo-ieee.cc, util/lo-ieee.h, util/lo-macros.h, util/lo-math.h,
util/lo-traits.h, util/lo-utils.cc, util/lo-utils.h, util/module.mk,
util/oct-alloc.cc, util/oct-alloc.h, util/oct-base64.cc, util/oct-base64.h,
util/oct-binmap.h, util/oct-cmplx.h, util/oct-glob.cc, util/oct-glob.h,
util/oct-inttypes.cc, util/oct-inttypes.h, util/oct-locbuf.cc,
util/oct-locbuf.h, util/oct-md5.cc, util/oct-md5.h, util/oct-mem.h,
util/oct-mutex.cc, util/oct-mutex.h, util/oct-refcount.h, util/oct-rl-edit.c,
util/oct-rl-edit.h, util/oct-rl-hist.c, util/oct-rl-hist.h, util/oct-shlib.cc,
util/oct-shlib.h, util/oct-sort.cc, util/oct-sort.h, util/oct-sparse.h,
util/pathsearch.cc, util/pathsearch.h, util/regexp.cc, util/regexp.h,
util/singleton-cleanup.cc, util/singleton-cleanup.h, util/sparse-sort.cc,
util/sparse-sort.h, util/sparse-util.cc, util/sparse-util.h, util/statdefs.h,
util/str-vec.cc, util/str-vec.h, util/sun-utils.h:
Moved from liboctave dir to util subdirectory.
* Makefile.am: Eliminate reference to top-level liboctave directory.
* autogen.sh: cd to new liboctave/operators directory to run config-ops.sh.
* build-aux/common.mk: Eliminate LIBCRUFT references.
* configure.ac: Eliminate libcruft top-level references. Switch test
programs to find files in liboctave/cruft subdirectory.
* OctaveFAQ.texi, install.txi, mkoctfile.1: Eliminate references to libcruft in
docs.
* libgui/src/Makefile.am, libinterp/Makefile.am, src/Makefile.am: Update
include file locations. Stop linking against libcruft.
* libinterp/corefcn/module.mk: Update location of OPT_INC files which are
now in numeric/ subdirectory.
* libinterp/dldfcn/config-module.awk: Stop linking against libcruft.
* libinterp/interpfcn/toplev.cc: Remove reference to LIBCRUFT.
* libinterp/link-deps.mk, liboctave/link-deps.mk:
Add GNULIB_LINK_DEPS to link dependencies.
* libinterp/oct-conf.in.h: Remove reference to OCTAVE_CONF_LIBCRUFT.
* liboctave/Makefile.am: Overhaul to use convenience libraries in
subdirectories.
* scripts/miscellaneous/mkoctfile.m: Eliminate reference to LIBCRUFT.
* src/mkoctfile.in.cc, src/mkoctfile.in.sh: Stop linking againt libcruft.
Eliminate references to LIBCRUFT.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 31 Aug 2012 20:00:20 -0700 |
parents | liboctave/data-conv.cc@9020dddc925a |
children | 049e8bbff782 |
comparison
equal
deleted
inserted
replaced
15270:6615a46d90ec | 15271:648dabbb4c6b |
---|---|
1 /* | |
2 | |
3 Copyright (C) 1996-2012 John W. Eaton | |
4 | |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
9 Free Software Foundation; either version 3 of the License, or (at your | |
10 option) any later version. | |
11 | |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
18 along with Octave; see the file COPYING. If not, see | |
19 <http://www.gnu.org/licenses/>. | |
20 | |
21 */ | |
22 | |
23 #ifdef HAVE_CONFIG_H | |
24 #include <config.h> | |
25 #endif | |
26 | |
27 #include <cctype> | |
28 #include <climits> | |
29 #include <cstdlib> | |
30 | |
31 #include <iostream> | |
32 #include <vector> | |
33 | |
34 #include "byte-swap.h" | |
35 #include "data-conv.h" | |
36 #include "lo-error.h" | |
37 #include "lo-ieee.h" | |
38 #include "oct-locbuf.h" | |
39 | |
40 template void swap_bytes<2> (volatile void *, int); | |
41 template void swap_bytes<4> (volatile void *, int); | |
42 template void swap_bytes<8> (volatile void *, int); | |
43 | |
44 #if defined HAVE_LONG_LONG_INT | |
45 #define FIND_SIZED_INT_TYPE(VAL, BITS, TQ, Q) \ | |
46 do \ | |
47 { \ | |
48 int sz = BITS / CHAR_BIT; \ | |
49 if (sizeof (TQ char) == sz) \ | |
50 VAL = oct_data_conv::dt_ ## Q ## char; \ | |
51 else if (sizeof (TQ short) == sz) \ | |
52 VAL = oct_data_conv::dt_ ## Q ## short; \ | |
53 else if (sizeof (TQ int) == sz) \ | |
54 VAL = oct_data_conv::dt_ ## Q ## int; \ | |
55 else if (sizeof (TQ long) == sz) \ | |
56 VAL = oct_data_conv::dt_ ## Q ## long; \ | |
57 else if (sizeof (TQ long long) == sz) \ | |
58 VAL = oct_data_conv::dt_ ## Q ## longlong; \ | |
59 else \ | |
60 VAL = oct_data_conv::dt_unknown; \ | |
61 } \ | |
62 while (0) | |
63 #else | |
64 #define FIND_SIZED_INT_TYPE(VAL, BITS, TQ, Q) \ | |
65 do \ | |
66 { \ | |
67 int sz = BITS / CHAR_BIT; \ | |
68 if (sizeof (TQ char) == sz) \ | |
69 VAL = oct_data_conv::dt_ ## Q ## char; \ | |
70 else if (sizeof (TQ short) == sz) \ | |
71 VAL = oct_data_conv::dt_ ## Q ## short; \ | |
72 else if (sizeof (TQ int) == sz) \ | |
73 VAL = oct_data_conv::dt_ ## Q ## int; \ | |
74 else if (sizeof (TQ long) == sz) \ | |
75 VAL = oct_data_conv::dt_ ## Q ## long; \ | |
76 else \ | |
77 VAL = oct_data_conv::dt_unknown; \ | |
78 } \ | |
79 while (0) | |
80 #endif | |
81 | |
82 #define FIND_SIZED_FLOAT_TYPE(VAL, BITS) \ | |
83 do \ | |
84 { \ | |
85 int sz = BITS / CHAR_BIT; \ | |
86 if (sizeof (float) == sz) \ | |
87 VAL = oct_data_conv::dt_float; \ | |
88 else if (sizeof (double) == sz) \ | |
89 VAL = oct_data_conv::dt_double; \ | |
90 else \ | |
91 VAL = oct_data_conv::dt_unknown; \ | |
92 } \ | |
93 while (0) | |
94 | |
95 // I'm not sure it is worth the trouble, but let's use a lookup table | |
96 // for the types that are supposed to be a specific number of bits | |
97 // wide. Given the macros above, this should work as long as CHAR_BIT | |
98 // is a multiple of 8 and there are types with the right sizes. | |
99 // | |
100 // The sized data type lookup table has the following format: | |
101 // | |
102 // bits | |
103 // +----+----+----+----+ | |
104 // | 8 | 16 | 32 | 64 | | |
105 // +----+----+----+----+ | |
106 // signed integer | | | | | | |
107 // +----+----+----+----+ | |
108 // unsigned integer | | | | | | |
109 // +----+----+----+----+ | |
110 // floating point | | | | | | |
111 // +----+----+----+----+ | |
112 // | |
113 // So, the 0,3 element is supposed to contain the oct_data_conv enum | |
114 // value corresponding to the correct native data type for a signed | |
115 // 32-bit integer. | |
116 | |
117 static void | |
118 init_sized_type_lookup_table (oct_data_conv::data_type table[3][4]) | |
119 { | |
120 int bits = 8; | |
121 | |
122 for (int i = 0; i < 4; i++) | |
123 { | |
124 FIND_SIZED_INT_TYPE (table[0][i], bits, , ); | |
125 | |
126 FIND_SIZED_INT_TYPE (table[1][i], bits, unsigned, u); | |
127 | |
128 FIND_SIZED_FLOAT_TYPE (table[2][i], bits); | |
129 | |
130 bits *= 2; | |
131 } | |
132 } | |
133 | |
134 static std::string | |
135 strip_spaces (const std::string& str) | |
136 { | |
137 size_t n = str.length (); | |
138 | |
139 size_t k = 0; | |
140 | |
141 std::string s (n, ' '); | |
142 | |
143 for (size_t i = 0; i < n; i++) | |
144 if (! isspace (str[i])) | |
145 s[k++] = tolower (str[i]); | |
146 | |
147 s.resize (k); | |
148 | |
149 return s; | |
150 } | |
151 | |
152 #define GET_SIZED_INT_TYPE(T, U) \ | |
153 do \ | |
154 { \ | |
155 switch (sizeof (T)) \ | |
156 { \ | |
157 case 1: \ | |
158 retval = dt_ ## U ## int8; \ | |
159 break; \ | |
160 \ | |
161 case 2: \ | |
162 retval = dt_ ## U ## int16; \ | |
163 break; \ | |
164 \ | |
165 case 4: \ | |
166 retval = dt_ ## U ## int32; \ | |
167 break; \ | |
168 \ | |
169 case 8: \ | |
170 retval = dt_ ## U ## int64; \ | |
171 break; \ | |
172 \ | |
173 default: \ | |
174 retval = dt_unknown; \ | |
175 break; \ | |
176 } \ | |
177 } \ | |
178 while (0) | |
179 | |
180 oct_data_conv::data_type | |
181 oct_data_conv::string_to_data_type (const std::string& str) | |
182 { | |
183 data_type retval = dt_unknown; | |
184 | |
185 static bool initialized = false; | |
186 | |
187 static data_type sized_type_table[3][4]; | |
188 | |
189 if (! initialized) | |
190 { | |
191 init_sized_type_lookup_table (sized_type_table); | |
192 | |
193 initialized = true; | |
194 } | |
195 | |
196 std::string s = strip_spaces (str); | |
197 | |
198 if (s == "int8" || s == "integer*1") | |
199 retval = dt_int8; | |
200 else if (s == "uint8") | |
201 retval = dt_uint8; | |
202 else if (s == "int16" || s == "integer*2") | |
203 retval = dt_int16; | |
204 else if (s == "uint16") | |
205 retval = dt_uint16; | |
206 else if (s == "int32" || s == "integer*4") | |
207 retval = dt_int32; | |
208 else if (s == "uint32") | |
209 retval = dt_uint32; | |
210 else if (s == "int64" || s == "integer*8") | |
211 retval = dt_int64; | |
212 else if (s == "uint64") | |
213 retval = dt_uint64; | |
214 else if (s == "single" || s == "float32" || s == "real*4") | |
215 retval = dt_single; | |
216 else if (s == "double" || s == "float64" || s == "real*8") | |
217 retval = dt_double; | |
218 else if (s == "char" || s == "char*1") | |
219 retval = dt_char; | |
220 else if (s == "schar" || s == "signedchar") | |
221 retval = dt_schar; | |
222 else if (s == "uchar" || s == "unsignedchar") | |
223 retval = dt_uchar; | |
224 else if (s == "short") | |
225 GET_SIZED_INT_TYPE (short, ); | |
226 else if (s == "ushort" || s == "unsignedshort") | |
227 GET_SIZED_INT_TYPE (unsigned short, u); | |
228 else if (s == "int") | |
229 GET_SIZED_INT_TYPE (int, ); | |
230 else if (s == "uint" || s == "unsignedint") | |
231 GET_SIZED_INT_TYPE (unsigned int, u); | |
232 else if (s == "long") | |
233 GET_SIZED_INT_TYPE (long, ); | |
234 else if (s == "ulong" || s == "unsignedlong") | |
235 GET_SIZED_INT_TYPE (unsigned long, u); | |
236 else if (s == "longlong") | |
237 GET_SIZED_INT_TYPE (long long, ); | |
238 else if (s == "ulonglong" || s == "unsignedlonglong") | |
239 GET_SIZED_INT_TYPE (unsigned long long, u); | |
240 else if (s == "float") | |
241 { | |
242 if (sizeof (float) == sizeof (double)) | |
243 retval = dt_double; | |
244 else | |
245 retval = dt_single; | |
246 } | |
247 else if (s == "logical") | |
248 retval = dt_logical; | |
249 else | |
250 (*current_liboctave_error_handler) ("invalid data type specified"); | |
251 | |
252 if (retval == dt_unknown) | |
253 (*current_liboctave_error_handler) | |
254 ("unable to find matching native data type for %s", s.c_str ()); | |
255 | |
256 return retval; | |
257 } | |
258 | |
259 void | |
260 oct_data_conv::string_to_data_type | |
261 (const std::string& str, int& block_size, | |
262 oct_data_conv::data_type& input_type, | |
263 oct_data_conv::data_type& output_type) | |
264 { | |
265 block_size = 1; | |
266 input_type = dt_uchar; | |
267 output_type = dt_double; | |
268 | |
269 bool input_is_output = false; | |
270 | |
271 std::string s = strip_spaces (str); | |
272 | |
273 size_t pos = 0; | |
274 | |
275 if (s[0] == '*') | |
276 input_is_output = true; | |
277 else | |
278 { | |
279 size_t len = s.length (); | |
280 | |
281 while (pos < len && isdigit (s[pos])) | |
282 pos++; | |
283 | |
284 if (pos > 0) | |
285 { | |
286 if (s[pos] == '*') | |
287 { | |
288 block_size = atoi (s.c_str ()); | |
289 s = s.substr (pos+1); | |
290 } | |
291 else | |
292 { | |
293 (*current_liboctave_error_handler) | |
294 ("invalid repeat count in `%s'", str.c_str ()); | |
295 | |
296 return; | |
297 } | |
298 } | |
299 } | |
300 | |
301 pos = s.find ('='); | |
302 | |
303 if (pos != std::string::npos) | |
304 { | |
305 if (s[pos+1] == '>') | |
306 { | |
307 std::string s1; | |
308 | |
309 if (input_is_output) | |
310 { | |
311 input_is_output = false; | |
312 | |
313 s1 = s.substr (1, pos-1); | |
314 | |
315 (*current_liboctave_warning_handler) | |
316 ("warning: ignoring leading * in fread precision"); | |
317 } | |
318 else | |
319 s1 = s.substr (0, pos); | |
320 | |
321 input_type = string_to_data_type (s1); | |
322 output_type = string_to_data_type (s.substr (pos+2)); | |
323 } | |
324 else | |
325 (*current_liboctave_error_handler) | |
326 ("fread: invalid precision specified"); | |
327 } | |
328 else | |
329 { | |
330 if (input_is_output) | |
331 s = s.substr (1); | |
332 | |
333 input_type = string_to_data_type (s); | |
334 | |
335 if (input_is_output) | |
336 output_type = input_type; | |
337 } | |
338 } | |
339 | |
340 void | |
341 oct_data_conv::string_to_data_type | |
342 (const std::string& str, int& block_size, | |
343 oct_data_conv::data_type& output_type) | |
344 { | |
345 block_size = 1; | |
346 output_type = dt_double; | |
347 | |
348 std::string s = strip_spaces (str); | |
349 | |
350 size_t pos = 0; | |
351 | |
352 size_t len = s.length (); | |
353 | |
354 while (pos < len && isdigit (s[pos])) | |
355 pos++; | |
356 | |
357 if (pos > 0) | |
358 { | |
359 if (s[pos] == '*') | |
360 { | |
361 block_size = atoi (s.c_str ()); | |
362 s = s.substr (pos+1); | |
363 } | |
364 else | |
365 { | |
366 (*current_liboctave_error_handler) | |
367 ("invalid repeat count in `%s'", str.c_str ()); | |
368 | |
369 return; | |
370 } | |
371 } | |
372 | |
373 output_type = string_to_data_type (s); | |
374 } | |
375 | |
376 std::string | |
377 oct_data_conv::data_type_as_string (oct_data_conv::data_type dt) | |
378 { | |
379 std::string retval; | |
380 | |
381 switch (dt) | |
382 { | |
383 case oct_data_conv::dt_int8: | |
384 retval = "int8"; | |
385 break; | |
386 | |
387 case oct_data_conv::dt_uint8: | |
388 retval = "uint8"; | |
389 break; | |
390 | |
391 case oct_data_conv::dt_int16: | |
392 retval = "int16"; | |
393 break; | |
394 | |
395 case oct_data_conv::dt_uint16: | |
396 retval = "uint16"; | |
397 break; | |
398 | |
399 case oct_data_conv::dt_int32: | |
400 retval = "int32"; | |
401 break; | |
402 | |
403 case oct_data_conv::dt_uint32: | |
404 retval = "uint32"; | |
405 break; | |
406 | |
407 case oct_data_conv::dt_int64: | |
408 retval = "int64"; | |
409 break; | |
410 | |
411 case oct_data_conv::dt_uint64: | |
412 retval = "uint64"; | |
413 break; | |
414 | |
415 case oct_data_conv::dt_single: | |
416 retval = "single"; | |
417 break; | |
418 | |
419 case oct_data_conv::dt_double: | |
420 retval = "double"; | |
421 break; | |
422 | |
423 case oct_data_conv::dt_char: | |
424 retval = "char"; | |
425 break; | |
426 | |
427 case oct_data_conv::dt_schar: | |
428 retval = "signed char"; | |
429 break; | |
430 | |
431 case oct_data_conv::dt_uchar: | |
432 retval = "usigned char"; | |
433 break; | |
434 | |
435 case oct_data_conv::dt_short: | |
436 retval = "short"; | |
437 break; | |
438 | |
439 case oct_data_conv::dt_ushort: | |
440 retval = "unsigned short"; | |
441 break; | |
442 | |
443 case oct_data_conv::dt_int: | |
444 retval = "int"; | |
445 break; | |
446 | |
447 case oct_data_conv::dt_uint: | |
448 retval = "usigned int"; | |
449 break; | |
450 | |
451 case oct_data_conv::dt_long: | |
452 retval = "long"; | |
453 break; | |
454 | |
455 case oct_data_conv::dt_ulong: | |
456 retval = "usigned long"; | |
457 break; | |
458 | |
459 case oct_data_conv::dt_longlong: | |
460 retval = "long long"; | |
461 break; | |
462 | |
463 case oct_data_conv::dt_ulonglong: | |
464 retval = "unsigned long long"; | |
465 break; | |
466 | |
467 case oct_data_conv::dt_float: | |
468 retval = "float"; | |
469 break; | |
470 | |
471 case oct_data_conv::dt_logical: | |
472 retval = "logical"; | |
473 break; | |
474 | |
475 case oct_data_conv::dt_unknown: | |
476 default: | |
477 retval = "unknown"; | |
478 break; | |
479 } | |
480 | |
481 return retval; | |
482 } | |
483 | |
484 #define LS_DO_READ(TYPE, swap, data, size, len, stream) \ | |
485 do \ | |
486 { \ | |
487 if (len > 0) \ | |
488 { \ | |
489 OCTAVE_LOCAL_BUFFER (TYPE, ptr, len); \ | |
490 stream.read (reinterpret_cast<char *> (ptr), size * len); \ | |
491 if (swap) \ | |
492 swap_bytes< size > (ptr, len); \ | |
493 for (octave_idx_type i = 0; i < len; i++) \ | |
494 data[i] = ptr[i]; \ | |
495 } \ | |
496 } \ | |
497 while (0) | |
498 | |
499 // Have to use copy here to avoid writing over data accessed via | |
500 // Matrix::data (). | |
501 | |
502 #define LS_DO_WRITE(TYPE, data, size, len, stream) \ | |
503 do \ | |
504 { \ | |
505 if (len > 0) \ | |
506 { \ | |
507 char tmp_type = type; \ | |
508 stream.write (&tmp_type, 1); \ | |
509 OCTAVE_LOCAL_BUFFER (TYPE, ptr, len); \ | |
510 for (octave_idx_type i = 0; i < len; i++) \ | |
511 ptr[i] = static_cast <TYPE> (data[i]); \ | |
512 stream.write (reinterpret_cast<char *> (ptr), size * len); \ | |
513 } \ | |
514 } \ | |
515 while (0) | |
516 | |
517 // Loading variables from files. | |
518 | |
519 static void | |
520 gripe_unrecognized_float_fmt (void) | |
521 { | |
522 (*current_liboctave_error_handler) | |
523 ("unrecognized floating point format requested"); | |
524 } | |
525 | |
526 static void | |
527 gripe_data_conversion (const char *from, const char *to) | |
528 { | |
529 (*current_liboctave_error_handler) | |
530 ("unable to convert from %s to %s format", from, to); | |
531 } | |
532 | |
533 // But first, some data conversion routines. | |
534 | |
535 // Currently, we only handle conversions for the IEEE types. To fix | |
536 // that, make more of the following routines work. | |
537 | |
538 // FIXME -- assumes sizeof (Complex) == 8 | |
539 // FIXME -- assumes sizeof (double) == 8 | |
540 // FIXME -- assumes sizeof (float) == 4 | |
541 | |
542 static void | |
543 IEEE_big_double_to_IEEE_little_double (void *d, octave_idx_type len) | |
544 { | |
545 swap_bytes<8> (d, len); | |
546 } | |
547 | |
548 static void | |
549 VAX_D_double_to_IEEE_little_double (void * /* d */, octave_idx_type /* len */) | |
550 { | |
551 gripe_data_conversion ("VAX D float", "IEEE little endian format"); | |
552 } | |
553 | |
554 static void | |
555 VAX_G_double_to_IEEE_little_double (void * /* d */, octave_idx_type /* len */) | |
556 { | |
557 gripe_data_conversion ("VAX G float", "IEEE little endian format"); | |
558 } | |
559 | |
560 static void | |
561 Cray_to_IEEE_little_double (void * /* d */, octave_idx_type /* len */) | |
562 { | |
563 gripe_data_conversion ("Cray", "IEEE little endian format"); | |
564 } | |
565 | |
566 static void | |
567 IEEE_big_float_to_IEEE_little_float (void *d, octave_idx_type len) | |
568 { | |
569 swap_bytes<4> (d, len); | |
570 } | |
571 | |
572 static void | |
573 VAX_D_float_to_IEEE_little_float (void * /* d */, octave_idx_type /* len */) | |
574 { | |
575 gripe_data_conversion ("VAX D float", "IEEE little endian format"); | |
576 } | |
577 | |
578 static void | |
579 VAX_G_float_to_IEEE_little_float (void * /* d */, octave_idx_type /* len */) | |
580 { | |
581 gripe_data_conversion ("VAX G float", "IEEE little endian format"); | |
582 } | |
583 | |
584 static void | |
585 Cray_to_IEEE_little_float (void * /* d */, octave_idx_type /* len */) | |
586 { | |
587 gripe_data_conversion ("Cray", "IEEE little endian format"); | |
588 } | |
589 | |
590 static void | |
591 IEEE_little_double_to_IEEE_big_double (void *d, octave_idx_type len) | |
592 { | |
593 swap_bytes<8> (d, len); | |
594 } | |
595 | |
596 static void | |
597 VAX_D_double_to_IEEE_big_double (void * /* d */, octave_idx_type /* len */) | |
598 { | |
599 gripe_data_conversion ("VAX D float", "IEEE big endian format"); | |
600 } | |
601 | |
602 static void | |
603 VAX_G_double_to_IEEE_big_double (void * /* d */, octave_idx_type /* len */) | |
604 { | |
605 gripe_data_conversion ("VAX G float", "IEEE big endian format"); | |
606 } | |
607 | |
608 static void | |
609 Cray_to_IEEE_big_double (void * /* d */, octave_idx_type /* len */) | |
610 { | |
611 gripe_data_conversion ("Cray", "IEEE big endian format"); | |
612 } | |
613 | |
614 static void | |
615 IEEE_little_float_to_IEEE_big_float (void *d, octave_idx_type len) | |
616 { | |
617 swap_bytes<4> (d, len); | |
618 } | |
619 | |
620 static void | |
621 VAX_D_float_to_IEEE_big_float (void * /* d */, octave_idx_type /* len */) | |
622 { | |
623 gripe_data_conversion ("VAX D float", "IEEE big endian format"); | |
624 } | |
625 | |
626 static void | |
627 VAX_G_float_to_IEEE_big_float (void * /* d */, octave_idx_type /* len */) | |
628 { | |
629 gripe_data_conversion ("VAX G float", "IEEE big endian format"); | |
630 } | |
631 | |
632 static void | |
633 Cray_to_IEEE_big_float (void * /* d */, octave_idx_type /* len */) | |
634 { | |
635 gripe_data_conversion ("Cray", "IEEE big endian format"); | |
636 } | |
637 | |
638 static void | |
639 IEEE_little_double_to_VAX_D_double (void * /* d */, octave_idx_type /* len */) | |
640 { | |
641 gripe_data_conversion ("IEEE little endian", "VAX D"); | |
642 } | |
643 | |
644 static void | |
645 IEEE_big_double_to_VAX_D_double (void * /* d */, octave_idx_type /* len */) | |
646 { | |
647 gripe_data_conversion ("IEEE big endian", "VAX D"); | |
648 } | |
649 | |
650 static void | |
651 VAX_G_double_to_VAX_D_double (void * /* d */, octave_idx_type /* len */) | |
652 { | |
653 gripe_data_conversion ("VAX G float", "VAX D"); | |
654 } | |
655 | |
656 static void | |
657 Cray_to_VAX_D_double (void * /* d */, octave_idx_type /* len */) | |
658 { | |
659 gripe_data_conversion ("Cray", "VAX D"); | |
660 } | |
661 | |
662 static void | |
663 IEEE_little_float_to_VAX_D_float (void * /* d */, octave_idx_type /* len */) | |
664 { | |
665 gripe_data_conversion ("IEEE little endian", "VAX D"); | |
666 } | |
667 | |
668 static void | |
669 IEEE_big_float_to_VAX_D_float (void * /* d */, octave_idx_type /* len */) | |
670 { | |
671 gripe_data_conversion ("IEEE big endian", "VAX D"); | |
672 } | |
673 | |
674 static void | |
675 VAX_G_float_to_VAX_D_float (void * /* d */, octave_idx_type /* len */) | |
676 { | |
677 gripe_data_conversion ("VAX G float", "VAX D"); | |
678 } | |
679 | |
680 static void | |
681 Cray_to_VAX_D_float (void * /* d */, octave_idx_type /* len */) | |
682 { | |
683 gripe_data_conversion ("Cray", "VAX D"); | |
684 } | |
685 | |
686 static void | |
687 IEEE_little_double_to_VAX_G_double (void * /* d */, octave_idx_type /* len */) | |
688 { | |
689 gripe_data_conversion ("IEEE little endian", "VAX G"); | |
690 } | |
691 | |
692 static void | |
693 IEEE_big_double_to_VAX_G_double (void * /* d */, octave_idx_type /* len */) | |
694 { | |
695 gripe_data_conversion ("IEEE big endian", "VAX G"); | |
696 } | |
697 | |
698 static void | |
699 VAX_D_double_to_VAX_G_double (void * /* d */, octave_idx_type /* len */) | |
700 { | |
701 gripe_data_conversion ("VAX D float", "VAX G"); | |
702 } | |
703 | |
704 static void | |
705 Cray_to_VAX_G_double (void * /* d */, octave_idx_type /* len */) | |
706 { | |
707 gripe_data_conversion ("VAX G float", "VAX G"); | |
708 } | |
709 | |
710 static void | |
711 IEEE_little_float_to_VAX_G_float (void * /* d */, octave_idx_type /* len */) | |
712 { | |
713 gripe_data_conversion ("IEEE little endian", "VAX G"); | |
714 } | |
715 | |
716 static void | |
717 IEEE_big_float_to_VAX_G_float (void * /* d */, octave_idx_type /* len */) | |
718 { | |
719 gripe_data_conversion ("IEEE big endian", "VAX G"); | |
720 } | |
721 | |
722 static void | |
723 VAX_D_float_to_VAX_G_float (void * /* d */, octave_idx_type /* len */) | |
724 { | |
725 gripe_data_conversion ("VAX D float", "VAX G"); | |
726 } | |
727 | |
728 static void | |
729 Cray_to_VAX_G_float (void * /* d */, octave_idx_type /* len */) | |
730 { | |
731 gripe_data_conversion ("VAX G float", "VAX G"); | |
732 } | |
733 | |
734 void | |
735 do_double_format_conversion (void *data, octave_idx_type len, | |
736 oct_mach_info::float_format from_fmt, | |
737 oct_mach_info::float_format to_fmt) | |
738 { | |
739 switch (to_fmt) | |
740 { | |
741 case oct_mach_info::flt_fmt_ieee_little_endian: | |
742 switch (from_fmt) | |
743 { | |
744 case oct_mach_info::flt_fmt_ieee_little_endian: | |
745 break; | |
746 | |
747 case oct_mach_info::flt_fmt_ieee_big_endian: | |
748 IEEE_big_double_to_IEEE_little_double (data, len); | |
749 break; | |
750 | |
751 case oct_mach_info::flt_fmt_vax_d: | |
752 VAX_D_double_to_IEEE_little_double (data, len); | |
753 break; | |
754 | |
755 case oct_mach_info::flt_fmt_vax_g: | |
756 VAX_G_double_to_IEEE_little_double (data, len); | |
757 break; | |
758 | |
759 case oct_mach_info::flt_fmt_cray: | |
760 Cray_to_IEEE_little_double (data, len); | |
761 break; | |
762 | |
763 default: | |
764 gripe_unrecognized_float_fmt (); | |
765 break; | |
766 } | |
767 break; | |
768 | |
769 case oct_mach_info::flt_fmt_ieee_big_endian: | |
770 switch (from_fmt) | |
771 { | |
772 case oct_mach_info::flt_fmt_ieee_little_endian: | |
773 IEEE_little_double_to_IEEE_big_double (data, len); | |
774 break; | |
775 | |
776 case oct_mach_info::flt_fmt_ieee_big_endian: | |
777 break; | |
778 | |
779 case oct_mach_info::flt_fmt_vax_d: | |
780 VAX_D_double_to_IEEE_big_double (data, len); | |
781 break; | |
782 | |
783 case oct_mach_info::flt_fmt_vax_g: | |
784 VAX_G_double_to_IEEE_big_double (data, len); | |
785 break; | |
786 | |
787 case oct_mach_info::flt_fmt_cray: | |
788 Cray_to_IEEE_big_double (data, len); | |
789 break; | |
790 | |
791 default: | |
792 gripe_unrecognized_float_fmt (); | |
793 break; | |
794 } | |
795 break; | |
796 | |
797 case oct_mach_info::flt_fmt_vax_d: | |
798 switch (from_fmt) | |
799 { | |
800 case oct_mach_info::flt_fmt_ieee_little_endian: | |
801 IEEE_little_double_to_VAX_D_double (data, len); | |
802 break; | |
803 | |
804 case oct_mach_info::flt_fmt_ieee_big_endian: | |
805 IEEE_big_double_to_VAX_D_double (data, len); | |
806 break; | |
807 | |
808 case oct_mach_info::flt_fmt_vax_d: | |
809 break; | |
810 | |
811 case oct_mach_info::flt_fmt_vax_g: | |
812 VAX_G_double_to_VAX_D_double (data, len); | |
813 break; | |
814 | |
815 case oct_mach_info::flt_fmt_cray: | |
816 Cray_to_VAX_D_double (data, len); | |
817 break; | |
818 | |
819 default: | |
820 gripe_unrecognized_float_fmt (); | |
821 break; | |
822 } | |
823 break; | |
824 | |
825 case oct_mach_info::flt_fmt_vax_g: | |
826 switch (from_fmt) | |
827 { | |
828 case oct_mach_info::flt_fmt_ieee_little_endian: | |
829 IEEE_little_double_to_VAX_G_double (data, len); | |
830 break; | |
831 | |
832 case oct_mach_info::flt_fmt_ieee_big_endian: | |
833 IEEE_big_double_to_VAX_G_double (data, len); | |
834 break; | |
835 | |
836 case oct_mach_info::flt_fmt_vax_d: | |
837 VAX_D_double_to_VAX_G_double (data, len); | |
838 break; | |
839 | |
840 case oct_mach_info::flt_fmt_vax_g: | |
841 break; | |
842 | |
843 case oct_mach_info::flt_fmt_cray: | |
844 Cray_to_VAX_G_double (data, len); | |
845 break; | |
846 | |
847 default: | |
848 gripe_unrecognized_float_fmt (); | |
849 break; | |
850 } | |
851 break; | |
852 | |
853 default: | |
854 (*current_liboctave_error_handler) | |
855 ("impossible state reached in file `%s' at line %d", | |
856 __FILE__, __LINE__); | |
857 break; | |
858 } | |
859 } | |
860 | |
861 void | |
862 do_float_format_conversion (void *data, octave_idx_type len, | |
863 oct_mach_info::float_format from_fmt, | |
864 oct_mach_info::float_format to_fmt) | |
865 { | |
866 switch (to_fmt) | |
867 { | |
868 case oct_mach_info::flt_fmt_ieee_little_endian: | |
869 switch (from_fmt) | |
870 { | |
871 case oct_mach_info::flt_fmt_ieee_little_endian: | |
872 break; | |
873 | |
874 case oct_mach_info::flt_fmt_ieee_big_endian: | |
875 IEEE_big_float_to_IEEE_little_float (data, len); | |
876 break; | |
877 | |
878 case oct_mach_info::flt_fmt_vax_d: | |
879 VAX_D_float_to_IEEE_little_float (data, len); | |
880 break; | |
881 | |
882 case oct_mach_info::flt_fmt_vax_g: | |
883 VAX_G_float_to_IEEE_little_float (data, len); | |
884 break; | |
885 | |
886 case oct_mach_info::flt_fmt_cray: | |
887 Cray_to_IEEE_little_float (data, len); | |
888 break; | |
889 | |
890 default: | |
891 gripe_unrecognized_float_fmt (); | |
892 break; | |
893 } | |
894 break; | |
895 | |
896 case oct_mach_info::flt_fmt_ieee_big_endian: | |
897 switch (from_fmt) | |
898 { | |
899 case oct_mach_info::flt_fmt_ieee_little_endian: | |
900 IEEE_little_float_to_IEEE_big_float (data, len); | |
901 break; | |
902 | |
903 case oct_mach_info::flt_fmt_ieee_big_endian: | |
904 break; | |
905 | |
906 case oct_mach_info::flt_fmt_vax_d: | |
907 VAX_D_float_to_IEEE_big_float (data, len); | |
908 break; | |
909 | |
910 case oct_mach_info::flt_fmt_vax_g: | |
911 VAX_G_float_to_IEEE_big_float (data, len); | |
912 break; | |
913 | |
914 case oct_mach_info::flt_fmt_cray: | |
915 Cray_to_IEEE_big_float (data, len); | |
916 break; | |
917 | |
918 default: | |
919 gripe_unrecognized_float_fmt (); | |
920 break; | |
921 } | |
922 break; | |
923 | |
924 case oct_mach_info::flt_fmt_vax_d: | |
925 switch (from_fmt) | |
926 { | |
927 case oct_mach_info::flt_fmt_ieee_little_endian: | |
928 IEEE_little_float_to_VAX_D_float (data, len); | |
929 break; | |
930 | |
931 case oct_mach_info::flt_fmt_ieee_big_endian: | |
932 IEEE_big_float_to_VAX_D_float (data, len); | |
933 break; | |
934 | |
935 case oct_mach_info::flt_fmt_vax_d: | |
936 break; | |
937 | |
938 case oct_mach_info::flt_fmt_vax_g: | |
939 VAX_G_float_to_VAX_D_float (data, len); | |
940 break; | |
941 | |
942 case oct_mach_info::flt_fmt_cray: | |
943 Cray_to_VAX_D_float (data, len); | |
944 break; | |
945 | |
946 default: | |
947 gripe_unrecognized_float_fmt (); | |
948 break; | |
949 } | |
950 break; | |
951 | |
952 case oct_mach_info::flt_fmt_vax_g: | |
953 switch (from_fmt) | |
954 { | |
955 case oct_mach_info::flt_fmt_ieee_little_endian: | |
956 IEEE_little_float_to_VAX_G_float (data, len); | |
957 break; | |
958 | |
959 case oct_mach_info::flt_fmt_ieee_big_endian: | |
960 IEEE_big_float_to_VAX_G_float (data, len); | |
961 break; | |
962 | |
963 case oct_mach_info::flt_fmt_vax_d: | |
964 VAX_D_float_to_VAX_G_float (data, len); | |
965 break; | |
966 | |
967 case oct_mach_info::flt_fmt_vax_g: | |
968 break; | |
969 | |
970 case oct_mach_info::flt_fmt_cray: | |
971 Cray_to_VAX_G_float (data, len); | |
972 break; | |
973 | |
974 default: | |
975 gripe_unrecognized_float_fmt (); | |
976 break; | |
977 } | |
978 break; | |
979 | |
980 default: | |
981 (*current_liboctave_error_handler) | |
982 ("impossible state reached in file `%s' at line %d", | |
983 __FILE__, __LINE__); | |
984 break; | |
985 } | |
986 } | |
987 | |
988 void | |
989 do_float_format_conversion (void *data, size_t sz, octave_idx_type len, | |
990 oct_mach_info::float_format from_fmt, | |
991 oct_mach_info::float_format to_fmt) | |
992 { | |
993 switch (sz) | |
994 { | |
995 case sizeof (float): | |
996 do_float_format_conversion (data, len, from_fmt, to_fmt); | |
997 break; | |
998 | |
999 case sizeof (double): | |
1000 do_double_format_conversion (data, len, from_fmt, to_fmt); | |
1001 break; | |
1002 | |
1003 default: | |
1004 (*current_liboctave_error_handler) | |
1005 ("impossible state reached in file `%s' at line %d", | |
1006 __FILE__, __LINE__); | |
1007 break; | |
1008 } | |
1009 } | |
1010 | |
1011 | |
1012 void | |
1013 read_doubles (std::istream& is, double *data, save_type type, | |
1014 octave_idx_type len, bool swap, | |
1015 oct_mach_info::float_format fmt) | |
1016 { | |
1017 switch (type) | |
1018 { | |
1019 case LS_U_CHAR: | |
1020 LS_DO_READ (uint8_t, swap, data, 1, len, is); | |
1021 break; | |
1022 | |
1023 case LS_U_SHORT: | |
1024 LS_DO_READ (uint16_t, swap, data, 2, len, is); | |
1025 break; | |
1026 | |
1027 case LS_U_INT: | |
1028 LS_DO_READ (uint32_t, swap, data, 4, len, is); | |
1029 break; | |
1030 | |
1031 case LS_CHAR: | |
1032 LS_DO_READ (int8_t, swap, data, 1, len, is); | |
1033 break; | |
1034 | |
1035 case LS_SHORT: | |
1036 LS_DO_READ (int16_t, swap, data, 2, len, is); | |
1037 break; | |
1038 | |
1039 case LS_INT: | |
1040 LS_DO_READ (int32_t, swap, data, 4, len, is); | |
1041 break; | |
1042 | |
1043 case LS_FLOAT: | |
1044 { | |
1045 OCTAVE_LOCAL_BUFFER (float, ptr, len); | |
1046 is.read (reinterpret_cast<char *> (ptr), 4 * len); | |
1047 do_float_format_conversion (ptr, len, fmt); | |
1048 for (octave_idx_type i = 0; i < len; i++) | |
1049 data[i] = ptr[i]; | |
1050 } | |
1051 break; | |
1052 | |
1053 case LS_DOUBLE: // No conversion necessary. | |
1054 { | |
1055 is.read (reinterpret_cast<char *> (data), 8 * len); | |
1056 do_double_format_conversion (data, len, fmt); | |
1057 | |
1058 for (int i = 0; i < len; i++) | |
1059 data[i] = __lo_ieee_replace_old_NA (data[i]); | |
1060 } | |
1061 break; | |
1062 | |
1063 default: | |
1064 is.clear (std::ios::failbit|is.rdstate ()); | |
1065 break; | |
1066 } | |
1067 } | |
1068 | |
1069 void | |
1070 read_floats (std::istream& is, float *data, save_type type, | |
1071 octave_idx_type len, bool swap, | |
1072 oct_mach_info::float_format fmt) | |
1073 { | |
1074 switch (type) | |
1075 { | |
1076 case LS_U_CHAR: | |
1077 LS_DO_READ (uint8_t, swap, data, 1, len, is); | |
1078 break; | |
1079 | |
1080 case LS_U_SHORT: | |
1081 LS_DO_READ (uint16_t, swap, data, 2, len, is); | |
1082 break; | |
1083 | |
1084 case LS_U_INT: | |
1085 LS_DO_READ (uint32_t, swap, data, 4, len, is); | |
1086 break; | |
1087 | |
1088 case LS_CHAR: | |
1089 LS_DO_READ (int8_t, swap, data, 1, len, is); | |
1090 break; | |
1091 | |
1092 case LS_SHORT: | |
1093 LS_DO_READ (int16_t, swap, data, 2, len, is); | |
1094 break; | |
1095 | |
1096 case LS_INT: | |
1097 LS_DO_READ (int32_t, swap, data, 4, len, is); | |
1098 break; | |
1099 | |
1100 case LS_FLOAT: // No conversion necessary. | |
1101 is.read (reinterpret_cast<char *> (data), 4 * len); | |
1102 do_float_format_conversion (data, len, fmt); | |
1103 break; | |
1104 | |
1105 case LS_DOUBLE: | |
1106 { | |
1107 OCTAVE_LOCAL_BUFFER (double, ptr, len); | |
1108 is.read (reinterpret_cast<char *> (ptr), 8 * len); | |
1109 do_double_format_conversion (ptr, len, fmt); | |
1110 for (octave_idx_type i = 0; i < len; i++) | |
1111 data[i] = ptr[i]; | |
1112 } | |
1113 break; | |
1114 | |
1115 default: | |
1116 is.clear (std::ios::failbit|is.rdstate ()); | |
1117 break; | |
1118 } | |
1119 } | |
1120 | |
1121 void | |
1122 write_doubles (std::ostream& os, const double *data, save_type type, | |
1123 octave_idx_type len) | |
1124 { | |
1125 switch (type) | |
1126 { | |
1127 case LS_U_CHAR: | |
1128 LS_DO_WRITE (uint8_t, data, 1, len, os); | |
1129 break; | |
1130 | |
1131 case LS_U_SHORT: | |
1132 LS_DO_WRITE (uint16_t, data, 2, len, os); | |
1133 break; | |
1134 | |
1135 case LS_U_INT: | |
1136 LS_DO_WRITE (uint32_t, data, 4, len, os); | |
1137 break; | |
1138 | |
1139 case LS_CHAR: | |
1140 LS_DO_WRITE (int8_t, data, 1, len, os); | |
1141 break; | |
1142 | |
1143 case LS_SHORT: | |
1144 LS_DO_WRITE (int16_t, data, 2, len, os); | |
1145 break; | |
1146 | |
1147 case LS_INT: | |
1148 LS_DO_WRITE (int32_t, data, 4, len, os); | |
1149 break; | |
1150 | |
1151 case LS_FLOAT: | |
1152 LS_DO_WRITE (float, data, 4, len, os); | |
1153 break; | |
1154 | |
1155 case LS_DOUBLE: // No conversion necessary. | |
1156 { | |
1157 char tmp_type = static_cast<char> (type); | |
1158 os.write (&tmp_type, 1); | |
1159 os.write (reinterpret_cast <const char *> (data), 8 * len); | |
1160 } | |
1161 break; | |
1162 | |
1163 default: | |
1164 (*current_liboctave_error_handler) | |
1165 ("unrecognized data format requested"); | |
1166 break; | |
1167 } | |
1168 } | |
1169 | |
1170 void | |
1171 write_floats (std::ostream& os, const float *data, save_type type, | |
1172 octave_idx_type len) | |
1173 { | |
1174 switch (type) | |
1175 { | |
1176 case LS_U_CHAR: | |
1177 LS_DO_WRITE (uint8_t, data, 1, len, os); | |
1178 break; | |
1179 | |
1180 case LS_U_SHORT: | |
1181 LS_DO_WRITE (uint16_t, data, 2, len, os); | |
1182 break; | |
1183 | |
1184 case LS_U_INT: | |
1185 LS_DO_WRITE (uint32_t, data, 4, len, os); | |
1186 break; | |
1187 | |
1188 case LS_CHAR: | |
1189 LS_DO_WRITE (int8_t, data, 1, len, os); | |
1190 break; | |
1191 | |
1192 case LS_SHORT: | |
1193 LS_DO_WRITE (int16_t, data, 2, len, os); | |
1194 break; | |
1195 | |
1196 case LS_INT: | |
1197 LS_DO_WRITE (int32_t, data, 4, len, os); | |
1198 break; | |
1199 | |
1200 case LS_FLOAT: // No conversion necessary. | |
1201 { | |
1202 char tmp_type = static_cast<char> (type); | |
1203 os.write (&tmp_type, 1); | |
1204 os.write (reinterpret_cast <const char *> (data), 4 * len); | |
1205 } | |
1206 break; | |
1207 | |
1208 case LS_DOUBLE: | |
1209 LS_DO_WRITE (double, data, 8, len, os); | |
1210 break; | |
1211 | |
1212 default: | |
1213 (*current_liboctave_error_handler) | |
1214 ("unrecognized data format requested"); | |
1215 break; | |
1216 } | |
1217 } |