From f4c4438e0e09872828a7cf061a602a52eeaf4de9 Mon Sep 17 00:00:00 2001 From: Matt Grice Date: Sun, 17 Jun 2018 22:19:22 +1000 Subject: [PATCH] First commit --- ABOUT-NLS | 1282 ++++ AUTHORS | 3 + COPYING | 339 + ChangeLog | 15 + INSTALL | 182 + Makefile.am | 5 + Makefile.in | 748 ++ NEWS | 1 + README | 2 + README.md | 19 + aclocal.m4 | 1346 ++++ afsk/Makefile.am | 19 + afsk/Makefile.in | 508 ++ afsk/costab.c | 73 + afsk/costab.h | 40 + afsk/gentbl.c | 70 + afsk/modem.c | 446 ++ cfgwindows | 21 + cfgwindowsnodebug | 20 + config.guess | 973 +++ config.h.in | 304 + config.rpath | 672 ++ config.sub | 1579 ++++ configapp/AUTHORS | 0 configapp/COPYING | 340 + configapp/ChangeLog | 0 configapp/INSTALL | 182 + configapp/Makefile.am | 26 + configapp/Makefile.in | 609 ++ configapp/NEWS | 0 configapp/README | 0 configapp/configapp.glade | 1630 ++++ configapp/option1.png | Bin 0 -> 413 bytes configapp/option1.xpm | 58 + configapp/option2.png | Bin 0 -> 433 bytes configapp/option2.xpm | 100 + configapp/src/Makefile.am | 41 + configapp/src/Makefile.in | 640 ++ configapp/src/app.c | 1049 +++ configapp/src/callbacks.h | 155 + configapp/src/configapp.h | 71 + configapp/src/configapp.rc | 40 + configapp/src/diag.c | 885 +++ configapp/src/interface.c | 1089 +++ configapp/src/interface.h | 12 + configapp/src/main.c | 664 ++ configapp/src/scope.c | 346 + configapp/src/scope.h | 75 + configapp/src/snm-compat-gtk2.h | 63 + configapp/src/soundmodemconfig.8 | 28 + configapp/src/spectrum.c | 476 ++ configapp/src/spectrum.h | 81 + configapp/src/support.c | 144 + configapp/src/support.h | 69 + configure | 11897 +++++++++++++++++++++++++++++ configure.in | 299 + depcomp | 423 + directx/Makefile.am | 29 + directx/Makefile.in | 511 ++ directx/deunion.pl | 47 + directx/dinput.c | 338 + directx/fixdirectx.sh | 17 + directx/include/directx.h | 79 + directx/libddraw.def | 3 + directx/libdinput.def | 2 + directx/libdplayx.def | 2 + directx/libdsound.def | 9 + doc/Makefile.am | 22 + doc/Makefile.in | 403 + doc/intro.sgml | 16 + doc/main.sgml | 36 + flexdrv/Makefile.am | 35 + flexdrv/Makefile.in | 513 ++ flexdrv/driver.c | 74 + flexdrv/driver.obj | Bin 0 -> 3239 bytes flexdrv/drv32.h | 15 + flexdrv/flexdriv.def | 11 + flexdrv/flexdrv.h | 491 ++ flexdrv/resource.h | 4 + flexdrv/soundmodem.c | 1295 ++++ flexdrv/soundmodem.rc | 58 + fsk/Makefile.am | 25 + fsk/Makefile.in | 542 ++ fsk/fskic.c | 56 + fsk/fskic.h | 48 + fsk/gendf9icfilt.cc | 316 + fsk/genpsptbl.c | 149 + fsk/modem.c | 634 ++ fsk/modemeq.c | 488 ++ fsk/modempsp.c | 476 ++ fsk/psp.h | 3249 ++++++++ install-sh | 251 + libmisc/Makefile.am | 8 + libmisc/Makefile.in | 503 ++ libmisc/getopt.c | 731 ++ libmisc/getopt.h | 129 + libmisc/getopt1.c | 176 + libmisc/hamming.c | 44 + libmisc/openpty.c | 83 + libmisc/raisedcosine.h | 53 + libmisc/random.c | 40 + libmisc/rcfreq.c | 52 + libmisc/rctime.c | 58 + libmisc/rrcfreq.c | 52 + libmisc/rrctime.c | 62 + libmisc/sinc.c | 48 + libmisc/vsnprintf.c | 194 + m4/ChangeLog | 11 + m4/gettext.m4 | 383 + m4/iconv.m4 | 214 + m4/lib-ld.m4 | 110 + m4/lib-link.m4 | 774 ++ m4/lib-prefix.m4 | 224 + m4/nls.m4 | 32 + m4/po.m4 | 449 ++ m4/progtest.m4 | 92 + matlib/Makefile.am | 38 + matlib/Makefile.in | 561 ++ matlib/dcchol.c | 125 + matlib/drchol.c | 113 + matlib/fcadd.c | 31 + matlib/fcchol.c | 125 + matlib/fcconj.c | 31 + matlib/fcdet.c | 76 + matlib/fcgseidel.c | 80 + matlib/fchermtransp.c | 61 + matlib/fcinv.c | 132 + matlib/fcmul.c | 62 + matlib/fcsub.c | 31 + matlib/fctransp.c | 61 + matlib/fft.hh | 87 + matlib/fradd.c | 31 + matlib/frchol.c | 113 + matlib/frdet.c | 72 + matlib/frgseidel.c | 83 + matlib/frinv.c | 127 + matlib/frmul.c | 61 + matlib/frsub.c | 30 + matlib/frtransp.c | 61 + matlib/mat.h | 199 + matlib/mat.hh | 502 ++ matlib/randn.c | 41 + matlib/tests.c | 251 + missing | 357 + mkinstalldirs | 40 + newqpsk/ChangeLog | 58 + newqpsk/Makefile.am | 26 + newqpsk/Makefile.in | 526 ++ newqpsk/README.newqpsk | 133 + newqpsk/bch.c | 126 + newqpsk/bch.h | 23 + newqpsk/complex.h | 80 + newqpsk/demodulator.c | 176 + newqpsk/fec.c | 146 + newqpsk/fec.h | 55 + newqpsk/fectable.h | 100 + newqpsk/filter-i386.h | 264 + newqpsk/filter.c | 119 + newqpsk/filter.h | 41 + newqpsk/genfilt.c | 47 + newqpsk/misc.h | 107 + newqpsk/modemconfig.h | 52 + newqpsk/modulator.c | 163 + newqpsk/newqpskrx.c | 565 ++ newqpsk/newqpskrx.h | 79 + newqpsk/newqpsktx.c | 382 + newqpsk/newqpsktx.h | 39 + newqpsk/tbl.c | 170 + newqpsk/tbl.h | 22 + p3dmodem/Makefile.am | 28 + p3dmodem/Makefile.in | 522 ++ p3dmodem/genp3dtbl.c | 107 + p3dmodem/p3d.h | 64 + p3dmodem/p3dmodem.c | 695 ++ p3dmodem/p3dtbl.h | 99 + p3dmodem/testcrc.c | 91 + pammodem/Makefile.am | 34 + pammodem/Makefile.in | 526 ++ pammodem/genpamtbl.c | 367 + pammodem/meas.c | 462 ++ pammodem/meas.h | 72 + pammodem/pam.h | 63 + pammodem/pammodem.c | 468 ++ pammodem/pamtbl.h | 253 + po/ChangeLog | 18 + po/Makefile.in.in | 444 ++ po/Makevars | 41 + po/POTFILES.in | 7 + po/Rules-quot | 47 + po/boldquot.sed | 10 + po/en@boldquot.header | 25 + po/en@quot.header | 22 + po/fr.gmo | Bin 0 -> 2869 bytes po/fr.po | 226 + po/insert-header.sin | 23 + po/quot.sed | 6 + po/remove-potcdate.sin | 19 + po/soundmodem.pot | 223 + po/stamp-po | 1 + po/sv.gmo | Bin 0 -> 2763 bytes po/sv.po | 228 + pskmodem/Makefile.am | 35 + pskmodem/Makefile.in | 527 ++ pskmodem/genpsktbl.c | 615 ++ pskmodem/meas.h | 72 + pskmodem/measpsk.c | 587 ++ pskmodem/psk.h | 104 + pskmodem/pskmlse.c | 621 ++ pskmodem/pskmodem.c | 539 ++ pskmodem/psktbl.h | 307 + soundcard/Makefile.am | 45 + soundcard/Makefile.in | 753 ++ soundcard/alsaio.c | 625 ++ soundcard/audiofilein.c | 305 + soundcard/audioio.c | 702 ++ soundcard/audioio.h | 71 + soundcard/chansim.c | 358 + soundcard/kisspkt.c | 955 +++ soundcard/kisspkt.h | 90 + soundcard/log.c | 112 + soundcard/main.c | 512 ++ soundcard/modem.h | 188 + soundcard/pktberr.c | 218 + soundcard/pktsimple.c | 147 + soundcard/ppdev.h | 74 + soundcard/ptt.c | 385 + soundcard/pttio.h | 81 + soundcard/simd.c | 98 + soundcard/simd.h | 169 + soundcard/snprintpkt.c | 299 + soundcard/soundio.h | 93 + soundcard/soundmodem.8 | 61 + soundcard/test.xml | 54 + soundcard/testkiss.c | 140 + soundcard/winaudioio.c | 627 ++ soundcard/winlog.c | 112 + soundcard/winptt.c | 141 + soundcard/winptt2.c | 104 + soundmodem.initscript | 56 + soundmodem.spec | 50 + 240 files changed, 68229 insertions(+) create mode 100644 ABOUT-NLS create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 INSTALL create mode 100644 Makefile.am create mode 100644 Makefile.in create mode 100644 NEWS create mode 100644 README create mode 100644 README.md create mode 100644 aclocal.m4 create mode 100644 afsk/Makefile.am create mode 100644 afsk/Makefile.in create mode 100644 afsk/costab.c create mode 100644 afsk/costab.h create mode 100644 afsk/gentbl.c create mode 100644 afsk/modem.c create mode 100755 cfgwindows create mode 100755 cfgwindowsnodebug create mode 100755 config.guess create mode 100644 config.h.in create mode 100755 config.rpath create mode 100755 config.sub create mode 100644 configapp/AUTHORS create mode 100644 configapp/COPYING create mode 100644 configapp/ChangeLog create mode 100644 configapp/INSTALL create mode 100644 configapp/Makefile.am create mode 100644 configapp/Makefile.in create mode 100644 configapp/NEWS create mode 100644 configapp/README create mode 100644 configapp/configapp.glade create mode 100644 configapp/option1.png create mode 100644 configapp/option1.xpm create mode 100644 configapp/option2.png create mode 100644 configapp/option2.xpm create mode 100644 configapp/src/Makefile.am create mode 100644 configapp/src/Makefile.in create mode 100644 configapp/src/app.c create mode 100644 configapp/src/callbacks.h create mode 100644 configapp/src/configapp.h create mode 100644 configapp/src/configapp.rc create mode 100644 configapp/src/diag.c create mode 100644 configapp/src/interface.c create mode 100644 configapp/src/interface.h create mode 100644 configapp/src/main.c create mode 100644 configapp/src/scope.c create mode 100644 configapp/src/scope.h create mode 100644 configapp/src/snm-compat-gtk2.h create mode 100644 configapp/src/soundmodemconfig.8 create mode 100644 configapp/src/spectrum.c create mode 100644 configapp/src/spectrum.h create mode 100644 configapp/src/support.c create mode 100644 configapp/src/support.h create mode 100755 configure create mode 100644 configure.in create mode 100755 depcomp create mode 100644 directx/Makefile.am create mode 100644 directx/Makefile.in create mode 100755 directx/deunion.pl create mode 100644 directx/dinput.c create mode 100755 directx/fixdirectx.sh create mode 100644 directx/include/directx.h create mode 100644 directx/libddraw.def create mode 100644 directx/libdinput.def create mode 100644 directx/libdplayx.def create mode 100644 directx/libdsound.def create mode 100644 doc/Makefile.am create mode 100644 doc/Makefile.in create mode 100644 doc/intro.sgml create mode 100644 doc/main.sgml create mode 100644 flexdrv/Makefile.am create mode 100644 flexdrv/Makefile.in create mode 100644 flexdrv/driver.c create mode 100644 flexdrv/driver.obj create mode 100644 flexdrv/drv32.h create mode 100644 flexdrv/flexdriv.def create mode 100644 flexdrv/flexdrv.h create mode 100644 flexdrv/resource.h create mode 100644 flexdrv/soundmodem.c create mode 100644 flexdrv/soundmodem.rc create mode 100644 fsk/Makefile.am create mode 100644 fsk/Makefile.in create mode 100644 fsk/fskic.c create mode 100644 fsk/fskic.h create mode 100644 fsk/gendf9icfilt.cc create mode 100644 fsk/genpsptbl.c create mode 100644 fsk/modem.c create mode 100644 fsk/modemeq.c create mode 100644 fsk/modempsp.c create mode 100644 fsk/psp.h create mode 100755 install-sh create mode 100644 libmisc/Makefile.am create mode 100644 libmisc/Makefile.in create mode 100644 libmisc/getopt.c create mode 100644 libmisc/getopt.h create mode 100644 libmisc/getopt1.c create mode 100644 libmisc/hamming.c create mode 100644 libmisc/openpty.c create mode 100644 libmisc/raisedcosine.h create mode 100644 libmisc/random.c create mode 100644 libmisc/rcfreq.c create mode 100644 libmisc/rctime.c create mode 100644 libmisc/rrcfreq.c create mode 100644 libmisc/rrctime.c create mode 100644 libmisc/sinc.c create mode 100644 libmisc/vsnprintf.c create mode 100644 m4/ChangeLog create mode 100644 m4/gettext.m4 create mode 100644 m4/iconv.m4 create mode 100644 m4/lib-ld.m4 create mode 100644 m4/lib-link.m4 create mode 100644 m4/lib-prefix.m4 create mode 100644 m4/nls.m4 create mode 100644 m4/po.m4 create mode 100644 m4/progtest.m4 create mode 100644 matlib/Makefile.am create mode 100644 matlib/Makefile.in create mode 100644 matlib/dcchol.c create mode 100644 matlib/drchol.c create mode 100644 matlib/fcadd.c create mode 100644 matlib/fcchol.c create mode 100644 matlib/fcconj.c create mode 100644 matlib/fcdet.c create mode 100644 matlib/fcgseidel.c create mode 100644 matlib/fchermtransp.c create mode 100644 matlib/fcinv.c create mode 100644 matlib/fcmul.c create mode 100644 matlib/fcsub.c create mode 100644 matlib/fctransp.c create mode 100644 matlib/fft.hh create mode 100644 matlib/fradd.c create mode 100644 matlib/frchol.c create mode 100644 matlib/frdet.c create mode 100644 matlib/frgseidel.c create mode 100644 matlib/frinv.c create mode 100644 matlib/frmul.c create mode 100644 matlib/frsub.c create mode 100644 matlib/frtransp.c create mode 100644 matlib/mat.h create mode 100644 matlib/mat.hh create mode 100644 matlib/randn.c create mode 100644 matlib/tests.c create mode 100755 missing create mode 100755 mkinstalldirs create mode 100644 newqpsk/ChangeLog create mode 100644 newqpsk/Makefile.am create mode 100644 newqpsk/Makefile.in create mode 100644 newqpsk/README.newqpsk create mode 100644 newqpsk/bch.c create mode 100644 newqpsk/bch.h create mode 100644 newqpsk/complex.h create mode 100644 newqpsk/demodulator.c create mode 100644 newqpsk/fec.c create mode 100644 newqpsk/fec.h create mode 100644 newqpsk/fectable.h create mode 100644 newqpsk/filter-i386.h create mode 100644 newqpsk/filter.c create mode 100644 newqpsk/filter.h create mode 100644 newqpsk/genfilt.c create mode 100644 newqpsk/misc.h create mode 100644 newqpsk/modemconfig.h create mode 100644 newqpsk/modulator.c create mode 100644 newqpsk/newqpskrx.c create mode 100644 newqpsk/newqpskrx.h create mode 100644 newqpsk/newqpsktx.c create mode 100644 newqpsk/newqpsktx.h create mode 100644 newqpsk/tbl.c create mode 100644 newqpsk/tbl.h create mode 100644 p3dmodem/Makefile.am create mode 100644 p3dmodem/Makefile.in create mode 100644 p3dmodem/genp3dtbl.c create mode 100644 p3dmodem/p3d.h create mode 100644 p3dmodem/p3dmodem.c create mode 100644 p3dmodem/p3dtbl.h create mode 100644 p3dmodem/testcrc.c create mode 100644 pammodem/Makefile.am create mode 100644 pammodem/Makefile.in create mode 100644 pammodem/genpamtbl.c create mode 100644 pammodem/meas.c create mode 100644 pammodem/meas.h create mode 100644 pammodem/pam.h create mode 100644 pammodem/pammodem.c create mode 100644 pammodem/pamtbl.h create mode 100644 po/ChangeLog create mode 100644 po/Makefile.in.in create mode 100644 po/Makevars create mode 100644 po/POTFILES.in create mode 100644 po/Rules-quot create mode 100644 po/boldquot.sed create mode 100644 po/en@boldquot.header create mode 100644 po/en@quot.header create mode 100644 po/fr.gmo create mode 100644 po/fr.po create mode 100644 po/insert-header.sin create mode 100644 po/quot.sed create mode 100644 po/remove-potcdate.sin create mode 100644 po/soundmodem.pot create mode 100644 po/stamp-po create mode 100644 po/sv.gmo create mode 100644 po/sv.po create mode 100644 pskmodem/Makefile.am create mode 100644 pskmodem/Makefile.in create mode 100644 pskmodem/genpsktbl.c create mode 100644 pskmodem/meas.h create mode 100644 pskmodem/measpsk.c create mode 100644 pskmodem/psk.h create mode 100644 pskmodem/pskmlse.c create mode 100644 pskmodem/pskmodem.c create mode 100644 pskmodem/psktbl.h create mode 100644 soundcard/Makefile.am create mode 100644 soundcard/Makefile.in create mode 100644 soundcard/alsaio.c create mode 100644 soundcard/audiofilein.c create mode 100644 soundcard/audioio.c create mode 100644 soundcard/audioio.h create mode 100644 soundcard/chansim.c create mode 100644 soundcard/kisspkt.c create mode 100644 soundcard/kisspkt.h create mode 100644 soundcard/log.c create mode 100644 soundcard/main.c create mode 100644 soundcard/modem.h create mode 100644 soundcard/pktberr.c create mode 100644 soundcard/pktsimple.c create mode 100644 soundcard/ppdev.h create mode 100644 soundcard/ptt.c create mode 100644 soundcard/pttio.h create mode 100644 soundcard/simd.c create mode 100644 soundcard/simd.h create mode 100644 soundcard/snprintpkt.c create mode 100644 soundcard/soundio.h create mode 100644 soundcard/soundmodem.8 create mode 100644 soundcard/test.xml create mode 100644 soundcard/testkiss.c create mode 100644 soundcard/winaudioio.c create mode 100644 soundcard/winlog.c create mode 100644 soundcard/winptt.c create mode 100644 soundcard/winptt2.c create mode 100755 soundmodem.initscript create mode 100644 soundmodem.spec diff --git a/ABOUT-NLS b/ABOUT-NLS new file mode 100644 index 0000000..b1de1b6 --- /dev/null +++ b/ABOUT-NLS @@ -0,0 +1,1282 @@ +1 Notes on the Free Translation Project +*************************************** + +Free software is going international! The Free Translation Project is +a way to get maintainers of free software, translators, and users all +together, so that free software will gradually become able to speak many +languages. A few packages already provide translations for their +messages. + + If you found this `ABOUT-NLS' file inside a distribution, you may +assume that the distributed package does use GNU `gettext' internally, +itself available at your nearest GNU archive site. But you do _not_ +need to install GNU `gettext' prior to configuring, installing or using +this package with messages translated. + + Installers will find here some useful hints. These notes also +explain how users should proceed for getting the programs to use the +available translations. They tell how people wanting to contribute and +work on translations can contact the appropriate team. + +1.1 INSTALL Matters +=================== + +Some packages are "localizable" when properly installed; the programs +they contain can be made to speak your own native language. Most such +packages use GNU `gettext'. Other packages have their own ways to +internationalization, predating GNU `gettext'. + + By default, this package will be installed to allow translation of +messages. It will automatically detect whether the system already +provides the GNU `gettext' functions. Installers may use special +options at configuration time for changing the default behaviour. The +command: + + ./configure --disable-nls + +will _totally_ disable translation of messages. + + When you already have GNU `gettext' installed on your system and run +configure without an option for your new package, `configure' will +probably detect the previously built and installed `libintl' library +and will decide to use it. If not, you may have to to use the +`--with-libintl-prefix' option to tell `configure' where to look for it. + + Internationalized packages usually have many `po/LL.po' files, where +LL gives an ISO 639 two-letter code identifying the language. Unless +translations have been forbidden at `configure' time by using the +`--disable-nls' switch, all available translations are installed +together with the package. However, the environment variable `LINGUAS' +may be set, prior to configuration, to limit the installed set. +`LINGUAS' should then contain a space separated list of two-letter +codes, stating which languages are allowed. + +1.2 Using This Package +====================== + +As a user, if your language has been installed for this package, you +only have to set the `LANG' environment variable to the appropriate +`LL_CC' combination. If you happen to have the `LC_ALL' or some other +`LC_xxx' environment variables set, you should unset them before +setting `LANG', otherwise the setting of `LANG' will not have the +desired effect. Here `LL' is an ISO 639 two-letter language code, and +`CC' is an ISO 3166 two-letter country code. For example, let's +suppose that you speak German and live in Germany. At the shell +prompt, merely execute `setenv LANG de_DE' (in `csh'), +`export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash'). +This can be done from your `.login' or `.profile' file, once and for +all. + + You might think that the country code specification is redundant. +But in fact, some languages have dialects in different countries. For +example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The +country code serves to distinguish the dialects. + + The locale naming convention of `LL_CC', with `LL' denoting the +language and `CC' denoting the country, is the one use on systems based +on GNU libc. On other systems, some variations of this scheme are +used, such as `LL' or `LL_CC.ENCODING'. You can get the list of +locales supported by your system for your language by running the +command `locale -a | grep '^LL''. + + Not all programs have translations for all languages. By default, an +English message is shown in place of a nonexistent translation. If you +understand other languages, you can set up a priority list of languages. +This is done through a different environment variable, called +`LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG' +for the purpose of message handling, but you still need to have `LANG' +set to the primary language; this is required by other parts of the +system libraries. For example, some Swedish users who would rather +read translations in German than English for when Swedish is not +available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'. + + Special advice for Norwegian users: The language code for Norwegian +bokma*l changed from `no' to `nb' recently (in 2003). During the +transition period, while some message catalogs for this language are +installed under `nb' and some older ones under `no', it's recommended +for Norwegian users to set `LANGUAGE' to `nb:no' so that both newer and +older translations are used. + + In the `LANGUAGE' environment variable, but not in the `LANG' +environment variable, `LL_CC' combinations can be abbreviated as `LL' +to denote the language's main dialect. For example, `de' is equivalent +to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT' +(Portuguese as spoken in Portugal) in this context. + +1.3 Translating Teams +===================== + +For the Free Translation Project to be a success, we need interested +people who like their own language and write it well, and who are also +able to synergize with other translators speaking the same language. +Each translation team has its own mailing list. The up-to-date list of +teams can be found at the Free Translation Project's homepage, +`http://translationproject.org/', in the "Teams" area. + + If you'd like to volunteer to _work_ at translating messages, you +should become a member of the translating team for your own language. +The subscribing address is _not_ the same as the list itself, it has +`-request' appended. For example, speakers of Swedish can send a +message to `sv-request@li.org', having this message body: + + subscribe + + Keep in mind that team members are expected to participate +_actively_ in translations, or at solving translational difficulties, +rather than merely lurking around. If your team does not exist yet and +you want to start one, or if you are unsure about what to do or how to +get started, please write to `coordinator@translationproject.org' to +reach the coordinator for all translator teams. + + The English team is special. It works at improving and uniformizing +the terminology in use. Proven linguistic skills are praised more than +programming skills, here. + +1.4 Available Packages +====================== + +Languages are not equally supported in all packages. The following +matrix shows the current state of internationalization, as of June +2010. The matrix shows, in regard of each package, for which languages +PO files have been submitted to translation coordination, with a +translation percentage of at least 50%. + + Ready PO files af am an ar as ast az be be@latin bg bn_IN bs ca + +--------------------------------------------------+ + a2ps | [] [] | + aegis | | + ant-phone | | + anubis | | + aspell | [] [] | + bash | | + bfd | | + bibshelf | [] | + binutils | | + bison | | + bison-runtime | [] | + bluez-pin | [] [] | + bombono-dvd | | + buzztard | | + cflow | | + clisp | | + coreutils | [] [] | + cpio | | + cppi | | + cpplib | [] | + cryptsetup | | + dfarc | | + dialog | [] [] | + dico | | + diffutils | [] | + dink | | + doodle | | + e2fsprogs | [] | + enscript | [] | + exif | | + fetchmail | [] | + findutils | [] | + flex | [] | + freedink | | + gas | | + gawk | [] [] | + gcal | [] | + gcc | | + gettext-examples | [] [] [] [] | + gettext-runtime | [] [] | + gettext-tools | [] [] | + gip | [] | + gjay | | + gliv | [] | + glunarclock | [] [] | + gnubiff | | + gnucash | [] | + gnuedu | | + gnulib | | + gnunet | | + gnunet-gtk | | + gnutls | | + gold | | + gpe-aerial | | + gpe-beam | | + gpe-bluetooth | | + gpe-calendar | | + gpe-clock | [] | + gpe-conf | | + gpe-contacts | | + gpe-edit | | + gpe-filemanager | | + gpe-go | | + gpe-login | | + gpe-ownerinfo | [] | + gpe-package | | + gpe-sketchbook | | + gpe-su | [] | + gpe-taskmanager | [] | + gpe-timesheet | [] | + gpe-today | [] | + gpe-todo | | + gphoto2 | | + gprof | [] | + gpsdrive | | + gramadoir | | + grep | | + grub | [] [] | + gsasl | | + gss | | + gst-plugins-bad | [] | + gst-plugins-base | [] | + gst-plugins-good | [] | + gst-plugins-ugly | [] | + gstreamer | [] [] [] | + gtick | | + gtkam | [] | + gtkorphan | [] | + gtkspell | [] [] [] | + gutenprint | | + hello | [] | + help2man | | + hylafax | | + idutils | | + indent | [] [] | + iso_15924 | | + iso_3166 | [] [] [] [] [] [] [] | + iso_3166_2 | | + iso_4217 | | + iso_639 | [] [] [] [] | + iso_639_3 | | + jwhois | | + kbd | | + keytouch | [] | + keytouch-editor | | + keytouch-keyboa... | [] | + klavaro | [] | + latrine | | + ld | [] | + leafpad | [] [] | + libc | [] [] | + libexif | () | + libextractor | | + libgnutls | | + libgpewidget | | + libgpg-error | | + libgphoto2 | | + libgphoto2_port | | + libgsasl | | + libiconv | [] | + libidn | | + lifelines | | + liferea | [] [] | + lilypond | | + linkdr | [] | + lordsawar | | + lprng | | + lynx | [] | + m4 | | + mailfromd | | + mailutils | | + make | | + man-db | | + man-db-manpages | | + minicom | | + mkisofs | | + myserver | | + nano | [] [] | + opcodes | | + parted | | + pies | | + popt | | + psmisc | | + pspp | [] | + pwdutils | | + radius | [] | + recode | [] [] | + rosegarden | | + rpm | | + rush | | + sarg | | + screem | | + scrollkeeper | [] [] [] | + sed | [] [] | + sharutils | [] [] | + shishi | | + skencil | | + solfege | | + solfege-manual | | + soundtracker | | + sp | | + sysstat | | + tar | [] | + texinfo | | + tin | | + unicode-han-tra... | | + unicode-transla... | | + util-linux-ng | [] | + vice | | + vmm | | + vorbis-tools | | + wastesedge | | + wdiff | | + wget | [] [] | + wyslij-po | | + xchat | [] [] [] [] | + xdg-user-dirs | [] [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] | + +--------------------------------------------------+ + af am an ar as ast az be be@latin bg bn_IN bs ca + 6 0 1 2 3 19 1 10 3 28 3 1 38 + + crh cs da de el en en_GB en_ZA eo es et eu fa + +-------------------------------------------------+ + a2ps | [] [] [] [] [] [] [] | + aegis | [] [] [] | + ant-phone | [] () | + anubis | [] [] | + aspell | [] [] [] [] [] | + bash | [] [] [] | + bfd | [] | + bibshelf | [] [] [] | + binutils | [] | + bison | [] [] | + bison-runtime | [] [] [] [] | + bluez-pin | [] [] [] [] [] [] | + bombono-dvd | [] | + buzztard | [] [] [] | + cflow | [] [] | + clisp | [] [] [] [] | + coreutils | [] [] [] [] | + cpio | | + cppi | | + cpplib | [] [] [] | + cryptsetup | [] | + dfarc | [] [] [] | + dialog | [] [] [] [] [] | + dico | | + diffutils | [] [] [] [] [] [] | + dink | [] [] [] | + doodle | [] | + e2fsprogs | [] [] [] | + enscript | [] [] [] | + exif | () [] [] | + fetchmail | [] [] () [] [] [] | + findutils | [] [] [] | + flex | [] [] | + freedink | [] [] [] | + gas | [] | + gawk | [] [] [] | + gcal | [] | + gcc | [] [] | + gettext-examples | [] [] [] [] | + gettext-runtime | [] [] [] [] | + gettext-tools | [] [] [] | + gip | [] [] [] [] | + gjay | [] | + gliv | [] [] [] | + glunarclock | [] [] | + gnubiff | () | + gnucash | [] () () () () | + gnuedu | [] [] | + gnulib | [] [] | + gnunet | | + gnunet-gtk | [] | + gnutls | [] [] | + gold | [] | + gpe-aerial | [] [] [] [] | + gpe-beam | [] [] [] [] | + gpe-bluetooth | [] [] | + gpe-calendar | [] | + gpe-clock | [] [] [] [] | + gpe-conf | [] [] [] | + gpe-contacts | [] [] [] | + gpe-edit | [] [] | + gpe-filemanager | [] [] [] | + gpe-go | [] [] [] [] | + gpe-login | [] [] | + gpe-ownerinfo | [] [] [] [] | + gpe-package | [] [] [] | + gpe-sketchbook | [] [] [] [] | + gpe-su | [] [] [] [] | + gpe-taskmanager | [] [] [] [] | + gpe-timesheet | [] [] [] [] | + gpe-today | [] [] [] [] | + gpe-todo | [] [] [] | + gphoto2 | [] [] () [] [] [] | + gprof | [] [] [] | + gpsdrive | [] [] [] | + gramadoir | [] [] [] | + grep | [] | + grub | [] [] | + gsasl | [] | + gss | | + gst-plugins-bad | [] [] [] [] [] | + gst-plugins-base | [] [] [] [] [] | + gst-plugins-good | [] [] [] [] [] [] | + gst-plugins-ugly | [] [] [] [] [] [] | + gstreamer | [] [] [] [] [] | + gtick | [] () [] | + gtkam | [] [] () [] [] | + gtkorphan | [] [] [] [] | + gtkspell | [] [] [] [] [] [] [] | + gutenprint | [] [] [] | + hello | [] [] [] [] | + help2man | [] | + hylafax | [] [] | + idutils | [] [] | + indent | [] [] [] [] [] [] [] | + iso_15924 | [] () [] [] | + iso_3166 | [] [] [] [] () [] [] [] () | + iso_3166_2 | () | + iso_4217 | [] [] [] () [] [] | + iso_639 | [] [] [] [] () [] [] | + iso_639_3 | [] | + jwhois | [] | + kbd | [] [] [] [] [] | + keytouch | [] [] | + keytouch-editor | [] [] | + keytouch-keyboa... | [] | + klavaro | [] [] [] [] | + latrine | [] () | + ld | [] [] | + leafpad | [] [] [] [] [] [] | + libc | [] [] [] [] | + libexif | [] [] () | + libextractor | | + libgnutls | [] | + libgpewidget | [] [] | + libgpg-error | [] [] | + libgphoto2 | [] () | + libgphoto2_port | [] () [] | + libgsasl | | + libiconv | [] [] [] [] [] | + libidn | [] [] [] | + lifelines | [] () | + liferea | [] [] [] [] [] | + lilypond | [] [] [] | + linkdr | [] [] [] | + lordsawar | [] | + lprng | | + lynx | [] [] [] [] | + m4 | [] [] [] [] | + mailfromd | | + mailutils | [] | + make | [] [] [] | + man-db | | + man-db-manpages | | + minicom | [] [] [] [] | + mkisofs | | + myserver | | + nano | [] [] [] | + opcodes | [] [] | + parted | [] [] | + pies | | + popt | [] [] [] [] [] | + psmisc | [] [] [] | + pspp | [] | + pwdutils | [] | + radius | [] | + recode | [] [] [] [] [] [] | + rosegarden | () () () | + rpm | [] [] [] | + rush | | + sarg | | + screem | | + scrollkeeper | [] [] [] [] [] | + sed | [] [] [] [] [] [] | + sharutils | [] [] [] [] | + shishi | | + skencil | [] () [] | + solfege | [] [] [] | + solfege-manual | [] [] | + soundtracker | [] [] [] | + sp | [] | + sysstat | [] [] [] | + tar | [] [] [] [] | + texinfo | [] [] [] | + tin | [] [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux-ng | [] [] [] [] | + vice | () () | + vmm | [] | + vorbis-tools | [] [] | + wastesedge | [] | + wdiff | [] [] | + wget | [] [] [] | + wyslij-po | | + xchat | [] [] [] [] [] | + xdg-user-dirs | [] [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] [] [] [] | + +-------------------------------------------------+ + crh cs da de el en en_GB en_ZA eo es et eu fa + 5 64 105 117 18 1 8 0 28 89 18 19 0 + + fi fr ga gl gu he hi hr hu hy id is it ja ka kn + +----------------------------------------------------+ + a2ps | [] [] [] [] | + aegis | [] [] | + ant-phone | [] [] | + anubis | [] [] [] [] | + aspell | [] [] [] [] | + bash | [] [] [] [] | + bfd | [] [] [] | + bibshelf | [] [] [] [] [] | + binutils | [] [] [] | + bison | [] [] [] [] | + bison-runtime | [] [] [] [] [] [] | + bluez-pin | [] [] [] [] [] [] [] [] | + bombono-dvd | [] | + buzztard | [] | + cflow | [] [] [] | + clisp | [] | + coreutils | [] [] [] [] [] | + cpio | [] [] [] [] | + cppi | [] [] | + cpplib | [] [] [] | + cryptsetup | [] [] [] | + dfarc | [] [] [] | + dialog | [] [] [] [] [] [] [] | + dico | | + diffutils | [] [] [] [] [] [] [] [] [] | + dink | [] | + doodle | [] [] | + e2fsprogs | [] [] | + enscript | [] [] [] [] | + exif | [] [] [] [] [] [] | + fetchmail | [] [] [] [] | + findutils | [] [] [] [] [] [] | + flex | [] [] [] | + freedink | [] [] [] | + gas | [] [] | + gawk | [] [] [] [] () [] | + gcal | [] | + gcc | [] | + gettext-examples | [] [] [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] | + gettext-tools | [] [] [] [] | + gip | [] [] [] [] [] [] | + gjay | [] | + gliv | [] () | + glunarclock | [] [] [] [] | + gnubiff | () [] () | + gnucash | () () () () () [] | + gnuedu | [] [] | + gnulib | [] [] [] [] [] [] | + gnunet | | + gnunet-gtk | [] | + gnutls | [] [] | + gold | [] [] | + gpe-aerial | [] [] [] | + gpe-beam | [] [] [] [] | + gpe-bluetooth | [] [] [] [] | + gpe-calendar | [] [] | + gpe-clock | [] [] [] [] [] | + gpe-conf | [] [] [] [] | + gpe-contacts | [] [] [] [] | + gpe-edit | [] [] [] | + gpe-filemanager | [] [] [] [] | + gpe-go | [] [] [] [] [] | + gpe-login | [] [] [] | + gpe-ownerinfo | [] [] [] [] [] | + gpe-package | [] [] [] | + gpe-sketchbook | [] [] [] [] | + gpe-su | [] [] [] [] [] [] | + gpe-taskmanager | [] [] [] [] [] | + gpe-timesheet | [] [] [] [] [] | + gpe-today | [] [] [] [] [] [] [] | + gpe-todo | [] [] [] | + gphoto2 | [] [] [] [] [] [] | + gprof | [] [] [] [] | + gpsdrive | [] [] [] | + gramadoir | [] [] [] | + grep | [] [] | + grub | [] [] [] [] | + gsasl | [] [] [] [] [] | + gss | [] [] [] [] [] | + gst-plugins-bad | [] [] [] [] [] [] | + gst-plugins-base | [] [] [] [] [] [] | + gst-plugins-good | [] [] [] [] [] [] | + gst-plugins-ugly | [] [] [] [] [] [] | + gstreamer | [] [] [] [] [] | + gtick | [] [] [] [] [] | + gtkam | [] [] [] [] [] | + gtkorphan | [] [] [] | + gtkspell | [] [] [] [] [] [] [] [] [] | + gutenprint | [] [] [] [] | + hello | [] [] [] | + help2man | [] [] | + hylafax | [] | + idutils | [] [] [] [] [] [] | + indent | [] [] [] [] [] [] [] [] | + iso_15924 | [] () [] [] | + iso_3166 | [] () [] [] [] [] [] [] [] [] [] [] | + iso_3166_2 | () [] [] [] | + iso_4217 | [] () [] [] [] [] | + iso_639 | [] () [] [] [] [] [] [] [] | + iso_639_3 | () [] [] | + jwhois | [] [] [] [] [] | + kbd | [] [] | + keytouch | [] [] [] [] [] [] | + keytouch-editor | [] [] [] [] [] | + keytouch-keyboa... | [] [] [] [] [] | + klavaro | [] [] | + latrine | [] [] [] | + ld | [] [] [] [] | + leafpad | [] [] [] [] [] [] [] () | + libc | [] [] [] [] [] | + libexif | [] | + libextractor | | + libgnutls | [] [] | + libgpewidget | [] [] [] [] | + libgpg-error | [] [] | + libgphoto2 | [] [] [] | + libgphoto2_port | [] [] [] | + libgsasl | [] [] [] [] [] | + libiconv | [] [] [] [] [] [] | + libidn | [] [] [] [] | + lifelines | () | + liferea | [] [] [] [] | + lilypond | [] [] | + linkdr | [] [] [] [] [] | + lordsawar | | + lprng | [] | + lynx | [] [] [] [] [] | + m4 | [] [] [] [] [] [] | + mailfromd | | + mailutils | [] [] | + make | [] [] [] [] [] [] [] [] [] | + man-db | [] [] | + man-db-manpages | [] | + minicom | [] [] [] [] [] | + mkisofs | [] [] [] [] | + myserver | | + nano | [] [] [] [] [] [] | + opcodes | [] [] [] [] | + parted | [] [] [] [] | + pies | | + popt | [] [] [] [] [] [] [] [] [] | + psmisc | [] [] [] | + pspp | | + pwdutils | [] [] | + radius | [] [] | + recode | [] [] [] [] [] [] [] [] | + rosegarden | () () () () () | + rpm | [] [] | + rush | | + sarg | [] | + screem | [] [] | + scrollkeeper | [] [] [] [] | + sed | [] [] [] [] [] [] [] [] | + sharutils | [] [] [] [] [] [] [] | + shishi | [] | + skencil | [] | + solfege | [] [] [] [] | + solfege-manual | [] [] | + soundtracker | [] [] | + sp | [] () | + sysstat | [] [] [] [] [] | + tar | [] [] [] [] [] [] [] | + texinfo | [] [] [] [] | + tin | [] | + unicode-han-tra... | | + unicode-transla... | [] [] | + util-linux-ng | [] [] [] [] [] [] | + vice | () () () | + vmm | [] | + vorbis-tools | [] | + wastesedge | () () | + wdiff | [] | + wget | [] [] [] [] [] [] [] [] | + wyslij-po | [] [] [] | + xchat | [] [] [] [] [] [] [] [] [] | + xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] [] [] | + +----------------------------------------------------+ + fi fr ga gl gu he hi hr hu hy id is it ja ka kn + 105 121 53 20 4 8 3 5 53 2 120 5 84 67 0 4 + + ko ku ky lg lt lv mk ml mn mr ms mt nb nds ne + +-----------------------------------------------+ + a2ps | [] | + aegis | | + ant-phone | | + anubis | [] [] | + aspell | [] | + bash | | + bfd | | + bibshelf | [] [] | + binutils | | + bison | [] | + bison-runtime | [] [] [] [] [] | + bluez-pin | [] [] [] [] [] | + bombono-dvd | | + buzztard | | + cflow | | + clisp | | + coreutils | [] | + cpio | | + cppi | | + cpplib | | + cryptsetup | | + dfarc | [] | + dialog | [] [] [] [] [] | + dico | | + diffutils | [] [] | + dink | | + doodle | | + e2fsprogs | | + enscript | | + exif | [] | + fetchmail | | + findutils | | + flex | | + freedink | [] | + gas | | + gawk | | + gcal | | + gcc | | + gettext-examples | [] [] [] [] | + gettext-runtime | [] | + gettext-tools | [] | + gip | [] [] | + gjay | | + gliv | | + glunarclock | [] | + gnubiff | | + gnucash | () () () () | + gnuedu | | + gnulib | | + gnunet | | + gnunet-gtk | | + gnutls | [] | + gold | | + gpe-aerial | [] | + gpe-beam | [] | + gpe-bluetooth | [] [] | + gpe-calendar | [] | + gpe-clock | [] [] [] [] [] | + gpe-conf | [] [] | + gpe-contacts | [] [] | + gpe-edit | [] | + gpe-filemanager | [] [] | + gpe-go | [] [] [] | + gpe-login | [] | + gpe-ownerinfo | [] [] | + gpe-package | [] [] | + gpe-sketchbook | [] [] | + gpe-su | [] [] [] [] [] [] | + gpe-taskmanager | [] [] [] [] [] [] | + gpe-timesheet | [] [] | + gpe-today | [] [] [] [] | + gpe-todo | [] [] | + gphoto2 | | + gprof | [] | + gpsdrive | | + gramadoir | | + grep | | + grub | | + gsasl | | + gss | | + gst-plugins-bad | [] [] [] [] | + gst-plugins-base | [] [] | + gst-plugins-good | [] [] | + gst-plugins-ugly | [] [] [] [] [] | + gstreamer | | + gtick | | + gtkam | [] | + gtkorphan | [] [] | + gtkspell | [] [] [] [] [] [] [] | + gutenprint | | + hello | [] [] [] | + help2man | | + hylafax | | + idutils | | + indent | | + iso_15924 | [] [] | + iso_3166 | [] [] () [] [] [] [] [] | + iso_3166_2 | | + iso_4217 | [] [] | + iso_639 | [] [] | + iso_639_3 | [] | + jwhois | [] | + kbd | | + keytouch | [] | + keytouch-editor | [] | + keytouch-keyboa... | [] | + klavaro | [] | + latrine | [] | + ld | | + leafpad | [] [] [] | + libc | [] | + libexif | | + libextractor | | + libgnutls | [] | + libgpewidget | [] [] | + libgpg-error | | + libgphoto2 | | + libgphoto2_port | | + libgsasl | | + libiconv | | + libidn | | + lifelines | | + liferea | | + lilypond | | + linkdr | | + lordsawar | | + lprng | | + lynx | | + m4 | | + mailfromd | | + mailutils | | + make | [] | + man-db | | + man-db-manpages | | + minicom | [] | + mkisofs | | + myserver | | + nano | [] [] | + opcodes | | + parted | | + pies | | + popt | [] [] [] | + psmisc | | + pspp | | + pwdutils | | + radius | | + recode | | + rosegarden | | + rpm | | + rush | | + sarg | | + screem | | + scrollkeeper | [] [] | + sed | | + sharutils | | + shishi | | + skencil | | + solfege | [] | + solfege-manual | | + soundtracker | | + sp | | + sysstat | [] | + tar | [] | + texinfo | [] | + tin | | + unicode-han-tra... | | + unicode-transla... | | + util-linux-ng | | + vice | | + vmm | | + vorbis-tools | | + wastesedge | | + wdiff | | + wget | [] | + wyslij-po | | + xchat | [] [] [] | + xdg-user-dirs | [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] | + +-----------------------------------------------+ + ko ku ky lg lt lv mk ml mn mr ms mt nb nds ne + 20 5 10 1 13 48 4 2 2 4 24 10 20 3 1 + + nl nn or pa pl ps pt pt_BR ro ru rw sk sl sq sr + +---------------------------------------------------+ + a2ps | [] [] [] [] [] [] [] [] | + aegis | [] [] [] | + ant-phone | [] [] | + anubis | [] [] [] | + aspell | [] [] [] [] [] | + bash | [] [] | + bfd | [] | + bibshelf | [] [] | + binutils | [] [] | + bison | [] [] [] | + bison-runtime | [] [] [] [] [] [] [] | + bluez-pin | [] [] [] [] [] [] [] [] | + bombono-dvd | [] () | + buzztard | [] [] | + cflow | [] | + clisp | [] [] | + coreutils | [] [] [] [] [] [] | + cpio | [] [] [] | + cppi | [] | + cpplib | [] | + cryptsetup | [] | + dfarc | [] | + dialog | [] [] [] [] | + dico | [] | + diffutils | [] [] [] [] [] [] | + dink | () | + doodle | [] [] | + e2fsprogs | [] [] | + enscript | [] [] [] [] [] | + exif | [] [] [] () [] | + fetchmail | [] [] [] [] | + findutils | [] [] [] [] [] | + flex | [] [] [] [] [] | + freedink | [] [] | + gas | | + gawk | [] [] [] [] | + gcal | | + gcc | [] | + gettext-examples | [] [] [] [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] [] [] [] | + gettext-tools | [] [] [] [] [] [] | + gip | [] [] [] [] [] | + gjay | | + gliv | [] [] [] [] [] [] | + glunarclock | [] [] [] [] [] | + gnubiff | [] () | + gnucash | [] () () () | + gnuedu | [] | + gnulib | [] [] [] [] | + gnunet | | + gnunet-gtk | | + gnutls | [] [] | + gold | | + gpe-aerial | [] [] [] [] [] [] [] | + gpe-beam | [] [] [] [] [] [] [] | + gpe-bluetooth | [] [] | + gpe-calendar | [] [] [] [] | + gpe-clock | [] [] [] [] [] [] [] [] | + gpe-conf | [] [] [] [] [] [] [] | + gpe-contacts | [] [] [] [] [] | + gpe-edit | [] [] [] | + gpe-filemanager | [] [] [] | + gpe-go | [] [] [] [] [] [] [] [] | + gpe-login | [] [] | + gpe-ownerinfo | [] [] [] [] [] [] [] [] | + gpe-package | [] [] | + gpe-sketchbook | [] [] [] [] [] [] [] | + gpe-su | [] [] [] [] [] [] [] [] | + gpe-taskmanager | [] [] [] [] [] [] [] [] | + gpe-timesheet | [] [] [] [] [] [] [] [] | + gpe-today | [] [] [] [] [] [] [] [] | + gpe-todo | [] [] [] [] [] | + gphoto2 | [] [] [] [] [] [] [] [] | + gprof | [] [] [] | + gpsdrive | [] [] | + gramadoir | [] [] | + grep | [] [] [] [] | + grub | [] [] [] | + gsasl | [] [] [] [] | + gss | [] [] [] | + gst-plugins-bad | [] [] [] [] [] [] | + gst-plugins-base | [] [] [] [] [] | + gst-plugins-good | [] [] [] [] [] | + gst-plugins-ugly | [] [] [] [] [] [] | + gstreamer | [] [] [] [] [] | + gtick | [] [] [] | + gtkam | [] [] [] [] [] [] | + gtkorphan | [] | + gtkspell | [] [] [] [] [] [] [] [] [] [] | + gutenprint | [] [] | + hello | [] [] [] [] | + help2man | [] [] | + hylafax | [] | + idutils | [] [] [] [] [] | + indent | [] [] [] [] [] [] [] | + iso_15924 | [] [] [] [] | + iso_3166 | [] [] [] [] [] () [] [] [] [] [] [] [] [] | + iso_3166_2 | [] [] [] | + iso_4217 | [] [] [] [] [] [] [] [] | + iso_639 | [] [] [] [] [] [] [] [] [] | + iso_639_3 | [] [] | + jwhois | [] [] [] [] | + kbd | [] [] [] | + keytouch | [] [] [] | + keytouch-editor | [] [] [] | + keytouch-keyboa... | [] [] [] | + klavaro | [] [] | + latrine | [] [] | + ld | | + leafpad | [] [] [] [] [] [] [] [] [] | + libc | [] [] [] [] | + libexif | [] [] () [] | + libextractor | | + libgnutls | [] [] | + libgpewidget | [] [] [] | + libgpg-error | [] [] | + libgphoto2 | [] [] | + libgphoto2_port | [] [] [] [] [] | + libgsasl | [] [] [] [] [] | + libiconv | [] [] [] [] [] | + libidn | [] [] | + lifelines | [] [] | + liferea | [] [] [] [] [] () () [] | + lilypond | [] | + linkdr | [] [] [] | + lordsawar | | + lprng | [] | + lynx | [] [] [] | + m4 | [] [] [] [] [] | + mailfromd | [] | + mailutils | [] | + make | [] [] [] [] | + man-db | [] [] [] | + man-db-manpages | [] [] [] | + minicom | [] [] [] [] | + mkisofs | [] [] [] | + myserver | | + nano | [] [] [] [] | + opcodes | [] [] | + parted | [] [] [] [] | + pies | [] | + popt | [] [] [] [] | + psmisc | [] [] [] | + pspp | [] [] | + pwdutils | [] | + radius | [] [] [] | + recode | [] [] [] [] [] [] [] [] | + rosegarden | () () | + rpm | [] [] [] | + rush | [] [] | + sarg | | + screem | | + scrollkeeper | [] [] [] [] [] [] [] [] | + sed | [] [] [] [] [] [] [] [] [] | + sharutils | [] [] [] [] | + shishi | [] | + skencil | [] [] | + solfege | [] [] [] [] | + solfege-manual | [] [] [] | + soundtracker | [] | + sp | | + sysstat | [] [] [] [] | + tar | [] [] [] [] | + texinfo | [] [] [] [] | + tin | [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux-ng | [] [] [] [] [] | + vice | [] | + vmm | [] | + vorbis-tools | [] [] | + wastesedge | [] | + wdiff | [] [] | + wget | [] [] [] [] [] [] [] | + wyslij-po | [] [] [] | + xchat | [] [] [] [] [] [] [] [] [] | + xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] | + +---------------------------------------------------+ + nl nn or pa pl ps pt pt_BR ro ru rw sk sl sq sr + 135 10 4 7 105 1 29 62 47 91 3 54 46 9 37 + + sv sw ta te tg th tr uk vi wa zh_CN zh_HK zh_TW + +---------------------------------------------------+ + a2ps | [] [] [] [] [] | 27 + aegis | [] | 9 + ant-phone | [] [] [] [] | 9 + anubis | [] [] [] [] | 15 + aspell | [] [] [] | 20 + bash | [] [] [] | 12 + bfd | [] | 6 + bibshelf | [] [] [] | 16 + binutils | [] [] | 8 + bison | [] [] | 12 + bison-runtime | [] [] [] [] [] [] | 29 + bluez-pin | [] [] [] [] [] [] [] [] | 37 + bombono-dvd | [] | 4 + buzztard | [] | 7 + cflow | [] [] [] | 9 + clisp | | 10 + coreutils | [] [] [] [] | 22 + cpio | [] [] [] [] [] [] | 13 + cppi | [] [] | 5 + cpplib | [] [] [] [] [] [] | 14 + cryptsetup | [] [] | 7 + dfarc | [] | 9 + dialog | [] [] [] [] [] [] [] | 30 + dico | [] | 2 + diffutils | [] [] [] [] [] [] | 30 + dink | | 4 + doodle | [] [] | 7 + e2fsprogs | [] [] [] | 11 + enscript | [] [] [] [] | 17 + exif | [] [] [] | 16 + fetchmail | [] [] [] | 17 + findutils | [] [] [] [] [] | 20 + flex | [] [] [] [] | 15 + freedink | [] | 10 + gas | [] | 4 + gawk | [] [] [] [] | 18 + gcal | [] [] | 5 + gcc | [] [] [] | 7 + gettext-examples | [] [] [] [] [] [] [] | 34 + gettext-runtime | [] [] [] [] [] [] [] | 29 + gettext-tools | [] [] [] [] [] [] | 22 + gip | [] [] [] [] | 22 + gjay | [] | 3 + gliv | [] [] [] | 14 + glunarclock | [] [] [] [] [] | 19 + gnubiff | [] [] | 4 + gnucash | () [] () [] () | 10 + gnuedu | [] [] | 7 + gnulib | [] [] [] [] | 16 + gnunet | [] | 1 + gnunet-gtk | [] [] [] | 5 + gnutls | [] [] [] | 10 + gold | [] | 4 + gpe-aerial | [] [] [] | 18 + gpe-beam | [] [] [] | 19 + gpe-bluetooth | [] [] [] | 13 + gpe-calendar | [] [] [] [] | 12 + gpe-clock | [] [] [] [] [] | 28 + gpe-conf | [] [] [] [] | 20 + gpe-contacts | [] [] [] | 17 + gpe-edit | [] [] [] | 12 + gpe-filemanager | [] [] [] [] | 16 + gpe-go | [] [] [] [] [] | 25 + gpe-login | [] [] [] | 11 + gpe-ownerinfo | [] [] [] [] [] | 25 + gpe-package | [] [] [] | 13 + gpe-sketchbook | [] [] [] | 20 + gpe-su | [] [] [] [] [] | 30 + gpe-taskmanager | [] [] [] [] [] | 29 + gpe-timesheet | [] [] [] [] [] | 25 + gpe-today | [] [] [] [] [] [] | 30 + gpe-todo | [] [] [] [] | 17 + gphoto2 | [] [] [] [] [] | 24 + gprof | [] [] [] | 15 + gpsdrive | [] [] [] | 11 + gramadoir | [] [] [] | 11 + grep | [] [] [] | 10 + grub | [] [] [] | 14 + gsasl | [] [] [] [] | 14 + gss | [] [] [] | 11 + gst-plugins-bad | [] [] [] [] | 26 + gst-plugins-base | [] [] [] [] [] | 24 + gst-plugins-good | [] [] [] [] | 24 + gst-plugins-ugly | [] [] [] [] [] | 29 + gstreamer | [] [] [] [] | 22 + gtick | [] [] [] | 13 + gtkam | [] [] [] | 20 + gtkorphan | [] [] [] | 14 + gtkspell | [] [] [] [] [] [] [] [] [] | 45 + gutenprint | [] | 10 + hello | [] [] [] [] [] [] | 21 + help2man | [] [] | 7 + hylafax | [] | 5 + idutils | [] [] [] [] | 17 + indent | [] [] [] [] [] [] | 30 + iso_15924 | () [] () [] [] | 16 + iso_3166 | [] [] () [] [] () [] [] [] () | 53 + iso_3166_2 | () [] () [] | 9 + iso_4217 | [] () [] [] () [] [] | 26 + iso_639 | [] [] [] () [] () [] [] [] [] | 38 + iso_639_3 | [] () | 8 + jwhois | [] [] [] [] [] | 16 + kbd | [] [] [] [] [] | 15 + keytouch | [] [] [] | 16 + keytouch-editor | [] [] [] | 14 + keytouch-keyboa... | [] [] [] | 14 + klavaro | [] | 11 + latrine | [] [] [] | 10 + ld | [] [] [] [] | 11 + leafpad | [] [] [] [] [] [] | 33 + libc | [] [] [] [] [] | 21 + libexif | [] () | 7 + libextractor | [] | 1 + libgnutls | [] [] [] | 9 + libgpewidget | [] [] [] | 14 + libgpg-error | [] [] [] | 9 + libgphoto2 | [] [] | 8 + libgphoto2_port | [] [] [] [] | 14 + libgsasl | [] [] [] | 13 + libiconv | [] [] [] [] | 21 + libidn | () [] [] | 11 + lifelines | [] | 4 + liferea | [] [] [] | 21 + lilypond | [] | 7 + linkdr | [] [] [] [] [] | 17 + lordsawar | | 1 + lprng | [] | 3 + lynx | [] [] [] [] | 17 + m4 | [] [] [] [] | 19 + mailfromd | [] [] | 3 + mailutils | [] | 5 + make | [] [] [] [] | 21 + man-db | [] [] [] | 8 + man-db-manpages | | 4 + minicom | [] [] | 16 + mkisofs | [] [] | 9 + myserver | | 0 + nano | [] [] [] [] | 21 + opcodes | [] [] [] | 11 + parted | [] [] [] [] [] | 15 + pies | [] [] | 3 + popt | [] [] [] [] [] [] | 27 + psmisc | [] [] | 11 + pspp | | 4 + pwdutils | [] [] | 6 + radius | [] [] | 9 + recode | [] [] [] [] | 28 + rosegarden | () | 0 + rpm | [] [] [] | 11 + rush | [] [] | 4 + sarg | | 1 + screem | [] | 3 + scrollkeeper | [] [] [] [] [] | 27 + sed | [] [] [] [] [] | 30 + sharutils | [] [] [] [] [] | 22 + shishi | [] | 3 + skencil | [] [] | 7 + solfege | [] [] [] [] | 16 + solfege-manual | [] | 8 + soundtracker | [] [] [] | 9 + sp | [] | 3 + sysstat | [] [] | 15 + tar | [] [] [] [] [] [] | 23 + texinfo | [] [] [] [] [] | 17 + tin | | 4 + unicode-han-tra... | | 0 + unicode-transla... | | 2 + util-linux-ng | [] [] [] [] | 20 + vice | () () | 1 + vmm | [] | 4 + vorbis-tools | [] | 6 + wastesedge | | 2 + wdiff | [] [] | 7 + wget | [] [] [] [] [] | 26 + wyslij-po | [] [] | 8 + xchat | [] [] [] [] [] [] | 36 + xdg-user-dirs | [] [] [] [] [] [] [] [] [] [] | 63 + xkeyboard-config | [] [] [] | 22 + +---------------------------------------------------+ + 85 teams sv sw ta te tg th tr uk vi wa zh_CN zh_HK zh_TW + 178 domains 119 1 3 3 0 10 65 51 155 17 98 7 41 2618 + + Some counters in the preceding matrix are higher than the number of +visible blocks let us expect. This is because a few extra PO files are +used for implementing regional variants of languages, or language +dialects. + + For a PO file in the matrix above to be effective, the package to +which it applies should also have been internationalized and +distributed as such by its maintainer. There might be an observable +lag between the mere existence a PO file and its wide availability in a +distribution. + + If June 2010 seems to be old, you may fetch a more recent copy of +this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date +matrix with full percentage details can be found at +`http://translationproject.org/extra/matrix.html'. + +1.5 Using `gettext' in new packages +=================================== + +If you are writing a freely available program and want to +internationalize it you are welcome to use GNU `gettext' in your +package. Of course you have to respect the GNU Library General Public +License which covers the use of the GNU `gettext' library. This means +in particular that even non-free programs can use `libintl' as a shared +library, whereas only free software can use `libintl' as a static +library or use modified versions of `libintl'. + + Once the sources are changed appropriately and the setup can handle +the use of `gettext' the only thing missing are the translations. The +Free Translation Project is also available for packages which are not +developed inside the GNU project. Therefore the information given above +applies also for every other Free Software Project. Contact +`coordinator@translationproject.org' to make the `.pot' files available +to the translation teams. + diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..e372477 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,3 @@ +Thomas Sailer, + +NEWQPSK code: Tomi Manninen, diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..a43ea21 --- /dev/null +++ b/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, 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 + + Appendix: 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. + + + Copyright (C) 19yy + + 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., 675 Mass Ave, Cambridge, MA 02139, 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. + + , 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/ChangeLog b/ChangeLog new file mode 100644 index 0000000..d802556 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,15 @@ +2011-06-18 gettextize + + * Makefile.am (ACLOCAL_AMFLAGS): New variable. + (EXTRA_DIST): Add m4/ChangeLog. + +2008-12-14 gettextize + + * Makefile.am (SUBDIRS): Remove intl. + (ACLOCAL_AMFLAGS): New variable. + (EXTRA_DIST): Add m4/ChangeLog. + +2000-07-29 Thomas Sailer + + * Initial release + diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..b42a17a --- /dev/null +++ b/INSTALL @@ -0,0 +1,182 @@ +Basic Installation +================== + + These are generic installation instructions. + + 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: + + 1. `cd' to the directory containing the package's source code and type + `./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. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. 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'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +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. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=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. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +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. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..e63ad78 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,5 @@ +SUBDIRS = po directx libmisc matlib afsk fsk pammodem pskmodem newqpsk p3dmodem soundcard flexdrv configapp doc + +EXTRA_DIST = m4/ChangeLog ABOUT-NLS cfgwindows cfgwindowsnodebug soundmodem.spec soundmodem.initscript + +ACLOCAL_AMFLAGS = -I m4 diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..d9afe98 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,748 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = . +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(top_srcdir)/configure ABOUT-NLS AUTHORS COPYING ChangeLog \ + INSTALL NEWS config.guess config.rpath config.sub depcomp \ + install-sh missing mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir dist dist-all distcheck +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d "$(distdir)" \ + || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr "$(distdir)"; }; } +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUDIOFILE_CFLAGS = @AUDIOFILE_CFLAGS@ +AUDIOFILE_LIBS = @AUDIOFILE_LIBS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +HAVE_ALSA = @HAVE_ALSA@ +HAVE_BITTYPES = @HAVE_BITTYPES@ +HAVE_DIRECTX = @HAVE_DIRECTX@ +HAVE_IFRNEWNAME = @HAVE_IFRNEWNAME@ +HAVE_MKISS = @HAVE_MKISS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTHREAD = @LIBTHREAD@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +M_PI = @M_PI@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USEMMX = @USEMMX@ +USEVIS = @USEVIS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WIN32 = @WIN32@ +WINDRES = @WINDRES@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CFLAGS = @XML_CFLAGS@ +XML_LIBS = @XML_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = po directx libmisc matlib afsk fsk pammodem pskmodem newqpsk p3dmodem soundcard flexdrv configapp doc +EXTRA_DIST = m4/ChangeLog ABOUT-NLS cfgwindows cfgwindowsnodebug soundmodem.spec soundmodem.initscript +ACLOCAL_AMFLAGS = -I m4 +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + $(am__cd) $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d "$(distdir)" || mkdir "$(distdir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r "$(distdir)" +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ + && cd "$$am__cwd" \ + || exit 1 + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @$(am__cd) '$(distuninstallcheck_dir)' \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile config.h +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ + ctags-recursive install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am am--refresh check check-am clean clean-generic \ + ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ + dist-lzma dist-shar dist-tarZ dist-xz dist-zip distcheck \ + distclean distclean-generic distclean-hdr distclean-tags \ + distcleancheck distdir distuninstallcheck dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am tags tags-recursive uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..adbbe25 --- /dev/null +++ b/NEWS @@ -0,0 +1 @@ +No News diff --git a/README b/README new file mode 100644 index 0000000..5360228 --- /dev/null +++ b/README @@ -0,0 +1,2 @@ +Usermode Soundcard Modem driver + diff --git a/README.md b/README.md new file mode 100644 index 0000000..f12f1b8 --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# Soundmodem 0.16 +(c)2000 Thomas Sailer, Tomi Manninen. + +This software appears to have been abandoned by it's authors, and I have +uploaded it here as I continue to tidy up the code and work on it. + +I will be adding features from versions 0.18 and 0.2 as time goes on, as +v0.18 and above break compatability with quite a few radios, including +my own - the venerable FT-857D. + +This version throws compilation errors when compiling with GCC5 and +above, so fixing this will be my first task - then I plan on removing +all of the crazy externs in the code and tidying up. + +Offers of help are welcome. + +Soundmodem is a driver and userspace utilities for using a sound card as +a packet radio modem (TNC). + diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..e751017 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,1346 @@ +# generated automatically by aclocal 1.11.1 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, +[m4_warning([this file was generated for autoconf 2.68. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically `autoreconf'.])]) + +dnl Configure Paths for Alsa +dnl Some modifications by Richard Boulton +dnl Christopher Lansdown +dnl Jaroslav Kysela +dnl Last modification: $Id: alsa.m4,v 1.24 2004/09/15 18:48:07 tiwai Exp $ +dnl AM_PATH_ALSA([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for libasound, and define ALSA_CFLAGS and ALSA_LIBS as appropriate. +dnl enables arguments --with-alsa-prefix= +dnl --with-alsa-enc-prefix= +dnl --disable-alsatest +dnl +dnl For backwards compatibility, if ACTION_IF_NOT_FOUND is not specified, +dnl and the alsa libraries are not found, a fatal AC_MSG_ERROR() will result. +dnl +AC_DEFUN([AM_PATH_ALSA], +[dnl Save the original CFLAGS, LDFLAGS, and LIBS +alsa_save_CFLAGS="$CFLAGS" +alsa_save_LDFLAGS="$LDFLAGS" +alsa_save_LIBS="$LIBS" +alsa_found=yes + +dnl +dnl Get the cflags and libraries for alsa +dnl +AC_ARG_WITH(alsa-prefix, +[ --with-alsa-prefix=PFX Prefix where Alsa library is installed(optional)], +[alsa_prefix="$withval"], [alsa_prefix=""]) + +AC_ARG_WITH(alsa-inc-prefix, +[ --with-alsa-inc-prefix=PFX Prefix where include libraries are (optional)], +[alsa_inc_prefix="$withval"], [alsa_inc_prefix=""]) + +dnl FIXME: this is not yet implemented +AC_ARG_ENABLE(alsatest, +[ --disable-alsatest Do not try to compile and run a test Alsa program], +[enable_alsatest="$enableval"], +[enable_alsatest=yes]) + +dnl Add any special include directories +AC_MSG_CHECKING(for ALSA CFLAGS) +if test "$alsa_inc_prefix" != "" ; then + ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix" + CFLAGS="$CFLAGS -I$alsa_inc_prefix" +fi +AC_MSG_RESULT($ALSA_CFLAGS) + +dnl add any special lib dirs +AC_MSG_CHECKING(for ALSA LDFLAGS) +if test "$alsa_prefix" != "" ; then + ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix" + LDFLAGS="$LDFLAGS $ALSA_LIBS" +fi + +dnl add the alsa library +ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl -lpthread" +LIBS="$ALSA_LIBS $LIBS" +AC_MSG_RESULT($ALSA_LIBS) + +dnl Check for a working version of libasound that is of the right version. +min_alsa_version=ifelse([$1], ,0.1.1,$1) +AC_MSG_CHECKING(for libasound headers version >= $min_alsa_version) +no_alsa="" + alsa_min_major_version=`echo $min_alsa_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + alsa_min_minor_version=`echo $min_alsa_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + alsa_min_micro_version=`echo $min_alsa_version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + +AC_LANG_SAVE +AC_LANG_C +AC_TRY_COMPILE([ +#include +], [ +/* ensure backward compatibility */ +#if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR) +#define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR +#endif +#if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR) +#define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR +#endif +#if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR) +#define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR +#endif + +# if(SND_LIB_MAJOR > $alsa_min_major_version) + exit(0); +# else +# if(SND_LIB_MAJOR < $alsa_min_major_version) +# error not present +# endif + +# if(SND_LIB_MINOR > $alsa_min_minor_version) + exit(0); +# else +# if(SND_LIB_MINOR < $alsa_min_minor_version) +# error not present +# endif + +# if(SND_LIB_SUBMINOR < $alsa_min_micro_version) +# error not present +# endif +# endif +# endif +exit(0); +], + [AC_MSG_RESULT(found.)], + [AC_MSG_RESULT(not present.) + ifelse([$3], , [AC_MSG_ERROR(Sufficiently new version of libasound not found.)]) + alsa_found=no] +) +AC_LANG_RESTORE + +dnl Now that we know that we have the right version, let's see if we have the library and not just the headers. +if test "x$enable_alsatest" = "xyes"; then +AC_CHECK_LIB([asound], [snd_ctl_open],, + [ifelse([$3], , [AC_MSG_ERROR(No linkable libasound was found.)]) + alsa_found=no] +) +fi + +if test "x$alsa_found" = "xyes" ; then + ifelse([$2], , :, [$2]) + LIBS=`echo $LIBS | sed 's/-lasound//g'` + LIBS=`echo $LIBS | sed 's/ //'` + LIBS="-lasound $LIBS" +fi +if test "x$alsa_found" = "xno" ; then + ifelse([$3], , :, [$3]) + CFLAGS="$alsa_save_CFLAGS" + LDFLAGS="$alsa_save_LDFLAGS" + LIBS="$alsa_save_LIBS" + ALSA_CFLAGS="" + ALSA_LIBS="" +fi + +dnl That should be it. Now just export out symbols: +AC_SUBST(ALSA_CFLAGS) +AC_SUBST(ALSA_LIBS) +]) + + +# intlmacosx.m4 serial 3 (gettext-0.18) +dnl Copyright (C) 2004-2010 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Checks for special options needed on MacOS X. +dnl Defines INTL_MACOSX_LIBS. +AC_DEFUN([gt_INTL_MACOSX], +[ + dnl Check for API introduced in MacOS X 10.2. + AC_CACHE_CHECK([for CFPreferencesCopyAppValue], + [gt_cv_func_CFPreferencesCopyAppValue], + [gt_save_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + AC_TRY_LINK([#include ], + [CFPreferencesCopyAppValue(NULL, NULL)], + [gt_cv_func_CFPreferencesCopyAppValue=yes], + [gt_cv_func_CFPreferencesCopyAppValue=no]) + LIBS="$gt_save_LIBS"]) + if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then + AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1], + [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) + fi + dnl Check for API introduced in MacOS X 10.3. + AC_CACHE_CHECK([for CFLocaleCopyCurrent], [gt_cv_func_CFLocaleCopyCurrent], + [gt_save_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + AC_TRY_LINK([#include ], [CFLocaleCopyCurrent();], + [gt_cv_func_CFLocaleCopyCurrent=yes], + [gt_cv_func_CFLocaleCopyCurrent=no]) + LIBS="$gt_save_LIBS"]) + if test $gt_cv_func_CFLocaleCopyCurrent = yes; then + AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], [1], + [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.]) + fi + INTL_MACOSX_LIBS= + if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then + INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" + fi + AC_SUBST([INTL_MACOSX_LIBS]) +]) + +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 1 (pkg-config-0.24) +# +# Copyright © 2004 Scott James Remnant . +# +# 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. +# +# 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. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +# only at the first occurence in configure.ac, so if the first place +# it's called might be skipped (such as if it is within an "if", you +# have to call PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT]) + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .]) + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])# PKG_CHECK_MODULES + +# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.11' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.11.1], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.11.1])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + + +# Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# This was merged into AC_PROG_CC in Autoconf. + +AU_DEFUN([AM_PROG_CC_STDC], +[AC_PROG_CC +AC_DIAGNOSE([obsolete], [$0: + your code should no longer depend upon `am_cv_prog_cc_stdc', but upon + `ac_cv_prog_cc_stdc'. Remove this warning and the assignment when + you adjust the code. You can also remove the above call to + AC_PROG_CC if you already called it elsewhere.]) +am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc +]) +AU_DEFUN([fp_PROG_CC_STDC]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 9 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 10 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], UPC, [depcc="$UPC" am_compiler_list=], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + am__universal=false + m4_case([$1], [CC], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac], + [CXX], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac]) + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +#serial 5 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Autoconf 2.62 quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. +AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2008, 2009 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 16 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.62])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES(OBJC)], + [define([AC_PROG_OBJC], + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl +]) +_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl +dnl The `parallel-tests' driver may need to know about EXEEXT, so add the +dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro +dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl +]) + +dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from `make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 6 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_MKDIR_P +# --------------- +# Check for `mkdir -p'. +AC_DEFUN([AM_PROG_MKDIR_P], +[AC_PREREQ([2.60])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, +dnl while keeping a definition of mkdir_p for backward compatibility. +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of +dnl Makefile.ins that do not define MKDIR_P, so we do our own +dnl adjustment using top_builddir (which is defined more often than +dnl MKDIR_P). +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl +case $mkdir_p in + [[\\/$]]* | ?:[[\\/]]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; +esac + +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([m4/gettext.m4]) +m4_include([m4/iconv.m4]) +m4_include([m4/lib-ld.m4]) +m4_include([m4/lib-link.m4]) +m4_include([m4/lib-prefix.m4]) +m4_include([m4/nls.m4]) +m4_include([m4/po.m4]) +m4_include([m4/progtest.m4]) diff --git a/afsk/Makefile.am b/afsk/Makefile.am new file mode 100644 index 0000000..0a2d0f0 --- /dev/null +++ b/afsk/Makefile.am @@ -0,0 +1,19 @@ +INCLUDES = -I$(top_srcdir)/soundcard + +noinst_LIBRARIES = libafsk.a +libafsk_a_SOURCES = modem.c costab.c + +noinst_HEADERS = costab.h + +gentbl_SOURCES = gentbl.c + +if CROSSCOMP + +else + +noinst_PROGRAMS = gentbl + +$(srcdir)/costab.c: gentbl$(EXEEXT) + bdir=`pwd`; cd $(srcdir); $$bdir/gentbl + +endif diff --git a/afsk/Makefile.in b/afsk/Makefile.in new file mode 100644 index 0000000..af3d253 --- /dev/null +++ b/afsk/Makefile.in @@ -0,0 +1,508 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +@CROSSCOMP_FALSE@noinst_PROGRAMS = gentbl$(EXEEXT) +subdir = afsk +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +libafsk_a_AR = $(AR) $(ARFLAGS) +libafsk_a_LIBADD = +am_libafsk_a_OBJECTS = modem.$(OBJEXT) costab.$(OBJEXT) +libafsk_a_OBJECTS = $(am_libafsk_a_OBJECTS) +PROGRAMS = $(noinst_PROGRAMS) +am_gentbl_OBJECTS = gentbl.$(OBJEXT) +gentbl_OBJECTS = $(am_gentbl_OBJECTS) +gentbl_LDADD = $(LDADD) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libafsk_a_SOURCES) $(gentbl_SOURCES) +DIST_SOURCES = $(libafsk_a_SOURCES) $(gentbl_SOURCES) +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUDIOFILE_CFLAGS = @AUDIOFILE_CFLAGS@ +AUDIOFILE_LIBS = @AUDIOFILE_LIBS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +HAVE_ALSA = @HAVE_ALSA@ +HAVE_BITTYPES = @HAVE_BITTYPES@ +HAVE_DIRECTX = @HAVE_DIRECTX@ +HAVE_IFRNEWNAME = @HAVE_IFRNEWNAME@ +HAVE_MKISS = @HAVE_MKISS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTHREAD = @LIBTHREAD@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +M_PI = @M_PI@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USEMMX = @USEMMX@ +USEVIS = @USEVIS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WIN32 = @WIN32@ +WINDRES = @WINDRES@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CFLAGS = @XML_CFLAGS@ +XML_LIBS = @XML_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +INCLUDES = -I$(top_srcdir)/soundcard +noinst_LIBRARIES = libafsk.a +libafsk_a_SOURCES = modem.c costab.c +noinst_HEADERS = costab.h +gentbl_SOURCES = gentbl.c +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu afsk/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu afsk/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libafsk.a: $(libafsk_a_OBJECTS) $(libafsk_a_DEPENDENCIES) + -rm -f libafsk.a + $(libafsk_a_AR) libafsk.a $(libafsk_a_OBJECTS) $(libafsk_a_LIBADD) + $(RANLIB) libafsk.a + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) +gentbl$(EXEEXT): $(gentbl_OBJECTS) $(gentbl_DEPENDENCIES) + @rm -f gentbl$(EXEEXT) + $(LINK) $(gentbl_OBJECTS) $(gentbl_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/costab.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gentbl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modem.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES clean-noinstPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am + + +@CROSSCOMP_FALSE@$(srcdir)/costab.c: gentbl$(EXEEXT) +@CROSSCOMP_FALSE@ bdir=`pwd`; cd $(srcdir); $$bdir/gentbl + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/afsk/costab.c b/afsk/costab.c new file mode 100644 index 0000000..c5faec0 --- /dev/null +++ b/afsk/costab.c @@ -0,0 +1,73 @@ +#include "costab.h" + +/* + * cosine table + */ + +const int16_t afsk_costab[512] = { + 32767, 32764, 32757, 32744, 32727, 32705, 32678, 32646, + 32609, 32567, 32520, 32468, 32412, 32350, 32284, 32213, + 32137, 32056, 31970, 31880, 31785, 31684, 31580, 31470, + 31356, 31236, 31113, 30984, 30851, 30713, 30571, 30424, + 30272, 30116, 29955, 29790, 29621, 29446, 29268, 29085, + 28897, 28706, 28510, 28309, 28105, 27896, 27683, 27466, + 27244, 27019, 26789, 26556, 26318, 26077, 25831, 25582, + 25329, 25072, 24811, 24546, 24278, 24006, 23731, 23452, + 23169, 22883, 22594, 22301, 22004, 21705, 21402, 21096, + 20787, 20474, 20159, 19840, 19519, 19194, 18867, 18537, + 18204, 17868, 17530, 17189, 16845, 16499, 16150, 15799, + 15446, 15090, 14732, 14372, 14009, 13645, 13278, 12909, + 12539, 12166, 11792, 11416, 11038, 10659, 10278, 9895, + 9511, 9126, 8739, 8351, 7961, 7571, 7179, 6786, + 6392, 5997, 5601, 5205, 4807, 4409, 4011, 3611, + 3211, 2811, 2410, 2009, 1607, 1206, 804, 402, + 0, -402, -804, -1206, -1607, -2009, -2410, -2811, + -3211, -3611, -4011, -4409, -4807, -5205, -5601, -5997, + -6392, -6786, -7179, -7571, -7961, -8351, -8739, -9126, + -9511, -9895, -10278, -10659, -11038, -11416, -11792, -12166, + -12539, -12909, -13278, -13645, -14009, -14372, -14732, -15090, + -15446, -15799, -16150, -16499, -16845, -17189, -17530, -17868, + -18204, -18537, -18867, -19194, -19519, -19840, -20159, -20474, + -20787, -21096, -21402, -21705, -22004, -22301, -22594, -22883, + -23169, -23452, -23731, -24006, -24278, -24546, -24811, -25072, + -25329, -25582, -25831, -26077, -26318, -26556, -26789, -27019, + -27244, -27466, -27683, -27896, -28105, -28309, -28510, -28706, + -28897, -29085, -29268, -29446, -29621, -29790, -29955, -30116, + -30272, -30424, -30571, -30713, -30851, -30984, -31113, -31236, + -31356, -31470, -31580, -31684, -31785, -31880, -31970, -32056, + -32137, -32213, -32284, -32350, -32412, -32468, -32520, -32567, + -32609, -32646, -32678, -32705, -32727, -32744, -32757, -32764, + -32767, -32764, -32757, -32744, -32727, -32705, -32678, -32646, + -32609, -32567, -32520, -32468, -32412, -32350, -32284, -32213, + -32137, -32056, -31970, -31880, -31785, -31684, -31580, -31470, + -31356, -31236, -31113, -30984, -30851, -30713, -30571, -30424, + -30272, -30116, -29955, -29790, -29621, -29446, -29268, -29085, + -28897, -28706, -28510, -28309, -28105, -27896, -27683, -27466, + -27244, -27019, -26789, -26556, -26318, -26077, -25831, -25582, + -25329, -25072, -24811, -24546, -24278, -24006, -23731, -23452, + -23169, -22883, -22594, -22301, -22004, -21705, -21402, -21096, + -20787, -20474, -20159, -19840, -19519, -19194, -18867, -18537, + -18204, -17868, -17530, -17189, -16845, -16499, -16150, -15799, + -15446, -15090, -14732, -14372, -14009, -13645, -13278, -12909, + -12539, -12166, -11792, -11416, -11038, -10659, -10278, -9895, + -9511, -9126, -8739, -8351, -7961, -7571, -7179, -6786, + -6392, -5997, -5601, -5205, -4807, -4409, -4011, -3611, + -3211, -2811, -2410, -2009, -1607, -1206, -804, -402, + 0, 402, 804, 1206, 1607, 2009, 2410, 2811, + 3211, 3611, 4011, 4409, 4807, 5205, 5601, 5997, + 6392, 6786, 7179, 7571, 7961, 8351, 8739, 9126, + 9511, 9895, 10278, 10659, 11038, 11416, 11792, 12166, + 12539, 12909, 13278, 13645, 14009, 14372, 14732, 15090, + 15446, 15799, 16150, 16499, 16845, 17189, 17530, 17868, + 18204, 18537, 18867, 19194, 19519, 19840, 20159, 20474, + 20787, 21096, 21402, 21705, 22004, 22301, 22594, 22883, + 23169, 23452, 23731, 24006, 24278, 24546, 24811, 25072, + 25329, 25582, 25831, 26077, 26318, 26556, 26789, 27019, + 27244, 27466, 27683, 27896, 28105, 28309, 28510, 28706, + 28897, 29085, 29268, 29446, 29621, 29790, 29955, 30116, + 30272, 30424, 30571, 30713, 30851, 30984, 31113, 31236, + 31356, 31470, 31580, 31684, 31785, 31880, 31970, 32056, + 32137, 32213, 32284, 32350, 32412, 32468, 32520, 32567, + 32609, 32646, 32678, 32705, 32727, 32744, 32757, 32764 +}; + diff --git a/afsk/costab.h b/afsk/costab.h new file mode 100644 index 0000000..89d8927 --- /dev/null +++ b/afsk/costab.h @@ -0,0 +1,40 @@ +/*****************************************************************************/ + +/* + * costab.h -- User soundmodem commonly used tables. + * + * Copyright (C) 1996-2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifndef _COSTAB_H +#define _COSTAB_H + +/* --------------------------------------------------------------------- */ + +#include "modem.h" + +/* --------------------------------------------------------------------- */ + +extern const int16_t afsk_costab[512]; + +#define COS(x) afsk_costab[((x)>>7)&0x1ff] +#define SIN(x) COS((x)+0xc000) + +/* --------------------------------------------------------------------- */ +#endif /* _COSTAB_H */ diff --git a/afsk/gentbl.c b/afsk/gentbl.c new file mode 100644 index 0000000..9608ab3 --- /dev/null +++ b/afsk/gentbl.c @@ -0,0 +1,70 @@ +/*****************************************************************************/ + +/* + * gentbl.c -- Soundmodem table generator. + * + * Copyright (C) 1996-2001 + * Thomas Sailer (t.sailer@alumni.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include + +/* -------------------------------------------------------------------- */ + +static const char *progname; + +/* -------------------------------------------------------------------- */ + +static void gen_costab(unsigned size) +{ + FILE *f; + int i; + + if (!(f = fopen("costab.c", "w"))) { + fprintf(stderr, "cannot open file costab.c\n"); + exit(1); + } + fprintf(f, "#include \"costab.h\"\n\n/*\n * cosine table\n */\n\n" + "const int16_t afsk_costab[%d] = {", size); + for (i = 0; i < size; i++) { + if (!(i & 7)) + fprintf(f, "\n\t"); + fprintf(f, "%6d", (int)(32767.0*cos(i*(2.0*M_PI)/size))); + if (i != (size-1)) + fprintf(f, ", "); + } + fprintf(f, "\n};\n\n"); +} + +/* -------------------------------------------------------------------- */ + +int main(int argc, char *argv[]) +{ + progname = argv[0]; + gen_costab(512); + exit(0); +} + +/* -------------------------------------------------------------------- */ diff --git a/afsk/modem.c b/afsk/modem.c new file mode 100644 index 0000000..13f77f7 --- /dev/null +++ b/afsk/modem.c @@ -0,0 +1,446 @@ +/*****************************************************************************/ + +/* + * modem.c -- Linux Userland Soundmodem AFSK modem. + * + * Copyright (C) 1998-2000, 2003 + * Thomas Sailer + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + */ + +/*****************************************************************************/ + +#include +#include +#include +#include +#include "modem.h" +#include "costab.h" + +/* --------------------------------------------------------------------- */ + +struct modstate { + struct modemchannel *chan; + unsigned int bps, f0, f1, notdiff, maxbitlen; + unsigned int bitinc, bitph; + unsigned int dds, ddsinc[2]; + unsigned int bit; +}; + +static const struct modemparams modparams[] = { + { "bps", "Bits/s", "Bits per second", "1200", MODEMPAR_NUMERIC, { n: { 100, 9600, 100, 1200 } } }, + { "f0", "Frequency 0", "Frequency 0", "1200", MODEMPAR_NUMERIC, { n: { 0, 38400, 100, 1000 } } }, + { "f1", "Frequency 1", "Frequency 1", "2200", MODEMPAR_NUMERIC, { n: { 0, 38400, 100, 1000 } } }, + { "diffenc", "Differential Encoding", "Enable for differentially encoded waveforms (normally on!)", "1", MODEMPAR_CHECKBUTTON }, + { NULL } +}; + +static void *modconfig(struct modemchannel *chan, unsigned int *samplerate, const char *params[]) +{ + struct modstate *s; + + if (!(s = malloc(sizeof(struct modstate)))) + logprintf(MLOG_FATAL, "out of memory\n"); + s->chan = chan; + if (params[0]) { + s->bps = strtoul(params[0], NULL, 0); + if (s->bps < 100) + s->bps = 100; + if (s->bps > 9600) + s->bps= 9600; + } else + s->bps = 1200; + if (params[1]) { + s->f0 = strtoul(params[1], NULL, 0); + if (s->f0 > s->bps * 4) + s->f0 = s->bps * 4; + } else + s->f0 = 1200; + if (params[2]) { + s->f1 = strtoul(params[2], NULL, 0); + if (s->f1 > s->bps * 4) + s->f1 = s->bps * 4; + } else + s->f1 = 2200; + s->notdiff = params[3] ? !strtoul(params[3], NULL, 0) : 0; + *samplerate = 8 * s->bps; + return s; +} + +static void modinit(void *state, unsigned int samplerate) +{ + struct modstate *s = (struct modstate *)state; + + s->maxbitlen = (samplerate + s->bps - 1) / s->bps; + s->bitinc = (s->bps << 16) / samplerate; + s->ddsinc[0] = (s->f0 << 16) / samplerate; + s->ddsinc[1] = (s->f1 << 16) / samplerate; + s->bit = 0; +} + +static void modsendbits(struct modstate *s, unsigned int bits, unsigned int nrsyms) +{ + int16_t sbuf[512]; + int16_t *sptr = sbuf, *eptr = sbuf + sizeof(sbuf)/sizeof(sbuf[0]); + + while (nrsyms > 0) { + if (s->bitph >= 0x10000) { + s->bitph &= 0xffff; + s->bit = (~((s->bit | s->notdiff) ^ bits)) & 1; + bits >>= 1; + nrsyms--; + } + *sptr++ = COS(s->dds); + s->dds += s->ddsinc[s->bit]; + s->bitph += s->bitinc; + if (sptr >= eptr) { + audiowrite(s->chan, sbuf, sptr - sbuf); + sptr = sbuf; + } + } + audiowrite(s->chan, sbuf, sptr - sbuf); +} + +static void modmodulate(void *state, unsigned int txdelay) +{ + struct modstate *s = (struct modstate *)state; + int i; + unsigned char ch; + + i = txdelay * s->bps / 1000; + do { + modsendbits(s, 0x7e, 8); + i -= 8; + } while (i > 0); + while (pktget(s->chan, &ch, 1)) + modsendbits(s, ch, 8); + modsendbits(s, 0x7e, 8); + modsendbits(s, 0x7e, 8); +} + +struct modulator afskmodulator = { + NULL, + "afsk", + modparams, + modconfig, + modinit, + modmodulate, + free +}; + +/* --------------------------------------------------------------------- */ + +#define max(a, b) (((a) > (b)) ? (a) : (b)) + +/* RxFilter */ +#define WINDOWEXPAND 1.5 +#define RXFILTLEN 16 +#define RXFILTOVERBITS 3 +#define RXFILTOVER (1<<(RXFILTOVERBITS)) +#define RXFILTFIDX(x) (((x)>>(16-(RXFILTOVERBITS)))&(RXFILTOVER-1)) +#define RXFILTFSAMP(x) ((x)>>16) + +struct demodstate { + struct modemchannel *chan; + unsigned int bps, f0, f1, notdiff, firlen; + unsigned int srate; + unsigned int rxbits; + unsigned int rxphase; + unsigned int rxphinc; + int dcdcnt; + unsigned int dcdtim; + + unsigned int div, divcnt; + unsigned int pllinc, pll, pllthresh, pllcorr; + unsigned int shreg, lastbit; + int dcd_sum0, dcd_sum1, dcd_sum2; + unsigned int dcd_time; + u_int32_t raws, rawb; + unsigned char dcd; + + union { + struct { + int32_t f0r[RXFILTOVER][RXFILTLEN]; + int32_t f0i[RXFILTOVER][RXFILTLEN]; + int32_t f1r[RXFILTOVER][RXFILTLEN]; + int32_t f1i[RXFILTOVER][RXFILTLEN]; + } f32; + struct { + int16_t f0r[RXFILTOVER][RXFILTLEN]; + int16_t f0i[RXFILTOVER][RXFILTLEN]; + int16_t f1r[RXFILTOVER][RXFILTLEN]; + int16_t f1i[RXFILTOVER][RXFILTLEN]; + } f16; + } f; +}; + +/* --------------------------------------------------------------------- */ + +static const struct modemparams demodparams[] = { + { "bps", "Bits/s", "Bits per second", "1200", MODEMPAR_NUMERIC, { n: { 100, 9600, 100, 1200 } } }, + { "f0", "Frequency 0", "Frequency 0", "1200", MODEMPAR_NUMERIC, { n: { 0, 38400, 100, 1000 } } }, + { "f1", "Frequency 1", "Frequency 1", "2200", MODEMPAR_NUMERIC, { n: { 0, 38400, 100, 1000 } } }, + { "diffdec", "Differential Decoding", "Enable for differentially encoded waveforms (normally on!)", "1", MODEMPAR_CHECKBUTTON }, + { NULL } +}; + +static void *demodconfig(struct modemchannel *chan, unsigned int *samplerate, const char *params[]) +{ + struct demodstate *s; + unsigned int f; + + if (!(s = malloc(sizeof(struct demodstate)))) + logprintf(MLOG_FATAL, "out of memory\n"); + s->chan = chan; + if (params[0]) { + s->bps = strtoul(params[0], NULL, 0); + if (s->bps < 100) + s->bps = 100; + if (s->bps > 9600) + s->bps= 9600; + } else + s->bps = 1200; + if (params[1]) { + s->f0 = strtoul(params[1], NULL, 0); + if (s->f0 > s->bps * 4) + s->f0 = s->bps * 4; + } else + s->f0 = 1200; + if (params[2]) { + s->f1 = strtoul(params[2], NULL, 0); + if (s->f1 > s->bps * 4) + s->f1 = s->bps * 4; + } else + s->f1 = 2200; + s->notdiff = params[3] ? !strtoul(params[3], NULL, 0) : 0; + f = s->f0; + if (s->f1 > f) + f = s->f1; + f += s->bps/2; + f = (2*f) + (f >> 1); + *samplerate = f; + return s; +} + +static int demfilter(struct demodstate *state, const int16_t *val, unsigned int phase) +{ + unsigned int fidx = RXFILTFIDX(phase); + const int *c0r = state->f.f32.f0r[fidx]; + const int *c0i = state->f.f32.f0i[fidx]; + const int *c1r = state->f.f32.f1r[fidx]; + const int *c1i = state->f.f32.f1i[fidx]; + const int16_t *v1, *v2; + unsigned int i; + int st = 0, s; + + v1 = val + RXFILTFSAMP(phase); + for (v2 = v1, s = 0, i = 0; i < RXFILTLEN; i++, v2++, c1r++) + s += (*v2) * (*c1r); + s >>= 16; + st = s * s; + for (v2 = v1, s = 0, i = 0; i < RXFILTLEN; i++, v2++, c1i++) + s += (*v2) * (*c1i); + s >>= 16; + st += s * s; + for (v2 = v1, s = 0, i = 0; i < RXFILTLEN; i++, v2++, c0r++) + s += (*v2) * (*c0r); + s >>= 16; + st -= s * s; + for (v2 = v1, s = 0, i = 0; i < RXFILTLEN; i++, v2++, c0i++) + s += (*v2) * (*c0i); + s >>= 16; + st -= s * s; + return st; +} + +static void demod8bits(struct demodstate *s) +{ + int16_t *samples; + unsigned int phinc = s->rxphinc; + unsigned int halfphinc = phinc >> 1; + unsigned int dcdinterv = phinc >> 2; + unsigned int phasecorr = phinc >> 4; + unsigned int totsamp = ((12 * phinc) >> 16) + RXFILTLEN; + unsigned int phase, nr; + int oldv, newv, midv, thv; + + samples = alloca(totsamp * sizeof(samples[0])); + audioread(s->chan, samples, totsamp, s->rxphase >> 16); + phase = s->rxphase & 0xffff; + s->rxphase &= ~0xffff; + oldv = demfilter(s, samples, phase); + for (nr = 0; nr < 8; nr++) { + if (logcheck(260)) { + unsigned int i; + for (i = 0; i < 8; i++) + logprintf(260, "afsk: rxv[%1u]: %6d\n", i, + demfilter(s, samples, phase + ((i * phinc) >> 3)) >> 16); + } + phase += phinc; + newv = demfilter(s, samples, phase); + s->rxbits >>= 1; + if (!((newv > 0) ^ ((oldv > 0) | s->notdiff))) + s->rxbits |= 0x80; + else { + midv = demfilter(s, samples, phase - halfphinc); + if ((oldv > 0) ^ (midv > 0)) { + thv = demfilter(s, samples, phase - halfphinc - dcdinterv); + phase -= phasecorr; + } else { + thv = demfilter(s, samples, phase - halfphinc + dcdinterv); + phase += phasecorr; + } + if ((midv > 0) ^ (thv > 0)) + s->dcdcnt++; + else + s->dcdcnt -= 2; + } + logprintf(258, "afsk: rx: oldv %10d midv %10d newv %10d\n", oldv, midv, newv); + oldv = newv; + s->dcdtim++; + } + s->rxphase += phase; +} + + +static void demoddemodulate(void *state) +{ + struct demodstate *s = (struct demodstate *)state; + int dcd0 = -2, dcd1 = -2, dcd2 = -2; + unsigned char buf; + char buf2[9]; + unsigned int i; + + s->dcdcnt = -2; + s->dcdtim = 0; + s->rxphase = audiocurtime(s->chan) << 16; + for (;;) { + demod8bits(s); + buf = s->rxbits; + pktput(s->chan, &buf, 1); + if (logcheck(256)) { + for (i = 0; i < 8; i++) + buf2[i] = '0' + ((buf >> i) & 1); + buf2[8] = 0; + logprintf(256, "afskrx: %s\n", buf2); + } +#if 0 + for (i = 0; i < 8; i++) + putchar('0' + ((buf >> i) & 1)); + fflush(stdout); +#endif + if (s->dcdtim < 120) + continue; + dcd0 = dcd1; + dcd1 = dcd2; + dcd2 = s->dcdcnt; + s->dcdcnt = -2; + s->dcdtim = 0; + pktsetdcd(s->chan, (dcd0 + dcd1 + dcd2) > 0); + } +} + +static inline double sinc(double x) +{ + double arg = x * M_PI; + + if (arg == 0) + return 1; + return sin(arg) / arg; +} + +static inline double hamming(double x) +{ + return 0.54-0.46*cos((2*M_PI)*x); +} + +static void demodinit(void *state, unsigned int samplerate, unsigned int *bitrate) +{ + struct demodstate *s = (struct demodstate *)state; + float f0r[RXFILTLEN*RXFILTOVER]; + float f0i[RXFILTLEN*RXFILTOVER]; + float f1r[RXFILTLEN*RXFILTOVER]; + float f1i[RXFILTLEN*RXFILTOVER]; + double ph0, ph1, w, tscale; + float max, max0, max1, max2, max3; + unsigned int i, j; + + tscale = (float)s->bps / (float)samplerate / RXFILTOVER / WINDOWEXPAND; + ph0 = 2.0 * M_PI * (float)s->f0 / (float)samplerate / RXFILTOVER; + ph1 = 2.0 * M_PI * (float)s->f1 / (float)samplerate / RXFILTOVER; + for (i = 0; i < RXFILTLEN * RXFILTOVER; i++) { + w = i * tscale; + if (w > 1) + w = 0; + else + w = hamming(w); + f0r[i] = w * cos(ph0 * i); + f0i[i] = w * sin(ph0 * i); + f1r[i] = w * cos(ph1 * i); + f1i[i] = w * sin(ph1 * i); + } + /* determine maximum */ + max = 0; + for (i = 0; i < RXFILTOVER; i++) { + max0 = max1 = max2 = max3 = 0; + for (j = i; j < RXFILTLEN * RXFILTOVER; j += RXFILTOVER) { + max0 += fabs(f0r[j]); + max1 += fabs(f0i[j]); + max2 += fabs(f1r[j]); + max3 += fabs(f1i[j]); + } + if (max0 > max) + max = max0; + if (max1 > max) + max = max1; + if (max2 > max) + max = max2; + if (max3 > max) + max = max3; + } + w = 32767 / max; + for (i = 0; i < RXFILTLEN * RXFILTOVER; i++) { + f0r[i] *= w; + f0i[i] *= w; + f1r[i] *= w; + f1i[i] *= w; + } + for (i = 0; i < RXFILTOVER; i++) + for (j = 0; j < RXFILTLEN; j++) { + s->f.f32.f0r[RXFILTOVER-1-i][j] = f0r[j*RXFILTOVER+i]; + s->f.f32.f0i[RXFILTOVER-1-i][j] = f0i[j*RXFILTOVER+i]; + s->f.f32.f1r[RXFILTOVER-1-i][j] = f1r[j*RXFILTOVER+i]; + s->f.f32.f1i[RXFILTOVER-1-i][j] = f1i[j*RXFILTOVER+i]; + } + s->srate = samplerate; + s->rxphinc = ((samplerate << 16) + s->bps / 2) / s->bps; + *bitrate = s->bps; +} + +struct demodulator afskdemodulator = { + NULL, + "afsk", + demodparams, + demodconfig, + demodinit, + demoddemodulate, + free +}; + +/* --------------------------------------------------------------------- */ + diff --git a/cfgwindows b/cfgwindows new file mode 100755 index 0000000..2e983fc --- /dev/null +++ b/cfgwindows @@ -0,0 +1,21 @@ +#!/bin/sh + +if test -d /usr/local/cross/i686-pc-cygwin; then + CROSSPATH=/usr/local/cross/i686-pc-cygwin/ +else + CROSSPATH=/usr/local/cygwin/i686-pc-cygwin/ +fi +PATH=${CROSSPATH}/bin:${PATH} +CC=i686-pc-cygwin-gcc +AR=i686-pc-cygwin-ar +AS=i686-pc-cygwin-as +LD=i686-pc-cygwin-ld +RANLIB=i686-pc-cygwin-ranlib +DLLTOOL=i686-pc-cygwin-dlltool +WINDRES=i686-pc-cygwin-windres +# for gcc3 and later, use -mms-bitfields instead of -fnative-struct +CFLAGS="-O2 -g -I${CROSSPATH}/gtk/include -mno-cygwin -mpentium -fnative-struct" +LDFLAGS="-L${CROSSPATH}/gtk/lib -mno-cygwin" +export CC AS AR LD RANLIB DLLTOOL PATH CFLAGS LDFLAGS +dir=`dirname $0` +${dir}/configure --host=i686-pc-cygwin --build=i686-pc-linux-gnu --disable-nls $* diff --git a/cfgwindowsnodebug b/cfgwindowsnodebug new file mode 100755 index 0000000..c1bf084 --- /dev/null +++ b/cfgwindowsnodebug @@ -0,0 +1,20 @@ +#!/bin/sh + +if test -d /usr/local/cross/i686-pc-cygwin; then + CROSSPATH=/usr/local/cross/i686-pc-cygwin/ +else + CROSSPATH=/usr/local/cygwin/i686-pc-cygwin/ +fi +PATH=${CROSSPATH}/bin:${PATH} +CC=i686-pc-cygwin-gcc +AR=i686-pc-cygwin-ar +AS=i686-pc-cygwin-as +LD=i686-pc-cygwin-ld +RANLIB=i686-pc-cygwin-ranlib +DLLTOOL=i686-pc-cygwin-dlltool +WINDRES=i686-pc-cygwin-windres +CFLAGS="-O2 -I${CROSSPATH}/gtk/include -mno-cygwin -mcpu=pentium" +LDFLAGS="-L${CROSSPATH}/gtk/lib -mno-cygwin" +export CC AS AR LD RANLIB DLLTOOL PATH CFLAGS LDFLAGS +dir=`dirname $0` +${dir}/configure --host=i686-pc-cygwin --build=i686-pc-linux-gnu --disable-nls $* diff --git a/config.guess b/config.guess new file mode 100755 index 0000000..4e5345f --- /dev/null +++ b/config.guess @@ -0,0 +1,973 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. +# +# 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 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. +# +# 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. + +# Written by Per Bothner . +# The master version of this file is at the FSF in /home/gd/gnu/lib. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit system type (host/target name). +# +# Only a few systems have been added to this list; please add others +# (but try to keep the structure clean). +# + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 8/24/94.) +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 + +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # 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. + cat <$dummy.s + .globl main + .ent main +main: + .frame \$30,0,\$26,0 + .prologue 0 + .long 0x47e03d80 # implver $0 + lda \$2,259 + .long 0x47e20c21 # amask $2,$1 + srl \$1,8,\$2 + sll \$2,2,\$2 + sll \$0,3,\$0 + addl \$1,\$0,\$0 + addl \$2,\$0,\$0 + ret \$31,(\$26),1 + .end main +EOF + ${CC-cc} $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + ./$dummy + case "$?" in + 7) + UNAME_MACHINE="alpha" + ;; + 15) + UNAME_MACHINE="alphaev5" + ;; + 14) + UNAME_MACHINE="alphaev56" + ;; + 10) + UNAME_MACHINE="alphapca56" + ;; + 16) + UNAME_MACHINE="alphaev6" + ;; + esac + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]` + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-cbm-sysv4 + exit 0;; + amiga:NetBSD:*:*) + echo m68k-cbm-netbsd${UNAME_RELEASE} + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + arc64:OpenBSD:*:*) + echo mips64el-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hkmips:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + arm32:NetBSD:*:*) + echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + SR2?01:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + 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 0 ;; + NILE:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + 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 0 ;; + 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 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(head -1 /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 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + atari*:NetBSD:*:*) + echo m68k-atari-netbsd${UNAME_RELEASE} + exit 0 ;; + atari*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3*:NetBSD:*:*) + echo m68k-sun-netbsd${UNAME_RELEASE} + exit 0 ;; + sun3*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:NetBSD:*:*) + echo m68k-apple-netbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + macppc:NetBSD:*:*) + echo powerpc-apple-netbsd${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + sed 's/^ //' << EOF >$dummy.c + int main (argc, argv) int argc; char **argv; { + #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-cc} $dummy.c -o $dummy \ + && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ + -o ${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 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????: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 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i?86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + ${CC-cc} $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo rs6000-ibm-aix3.2.5 + 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 0 ;; + *:AIX:*:4) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` + if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=4.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/6?? | 9000/7?? | 9000/80[24] | 9000/8?[13679] | 9000/892 ) + sed 's/^ //' << EOF >$dummy.c + #include + #include + + 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 + (${CC-cc} $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + rm -f $dummy.c $dummy + esac + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + sed 's/^ //' << EOF >$dummy.c + #include + 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-cc} $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i?86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*X-MP:*:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY*T3E:*:*:*) + echo t3e-cray-unicosmk${UNAME_RELEASE} + exit 0 ;; + CRAY-2:*:*:*) + echo cray2-cray-unicos + exit 0 ;; + F300:UNIX_System_V:*:*) + FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + F301:UNIX_System_V:*:*) + echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` + exit 0 ;; + hp3[0-9][05]:NetBSD:*:*) + echo m68k-hp-netbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + i?86:BSD/386:*:* | i?86:BSD/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:NetBSD:*:*) + echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + *:Linux:*:*) + # uname on the ARM produces all sorts of strangeness, and we need to + # filter it out. + case "$UNAME_MACHINE" in + arm* | sa110*) UNAME_MACHINE="arm" ;; + esac + + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. + ld_help_string=`ld --help 2>&1` + ld_supported_emulations=`echo $ld_help_string \ + | sed -ne '/supported emulations:/!d + s/[ ][ ]*/ /g + s/.*supported emulations: *// + s/ .*// + p'` + case "$ld_supported_emulations" in + i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;; + i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;; + sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; + armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; + m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; + elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;; + esac + + if test "${UNAME_MACHINE}" = "alpha" ; then + sed 's/^ //' <$dummy.s + .globl main + .ent main + main: + .frame \$30,0,\$26,0 + .prologue 0 + .long 0x47e03d80 # implver $0 + lda \$2,259 + .long 0x47e20c21 # amask $2,$1 + srl \$1,8,\$2 + sll \$2,2,\$2 + sll \$0,3,\$0 + addl \$1,\$0,\$0 + addl \$2,\$0,\$0 + ret \$31,(\$26),1 + .end main +EOF + LIBC="" + ${CC-cc} $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + ./$dummy + case "$?" in + 7) + UNAME_MACHINE="alpha" + ;; + 15) + UNAME_MACHINE="alphaev5" + ;; + 14) + UNAME_MACHINE="alphaev56" + ;; + 10) + UNAME_MACHINE="alphapca56" + ;; + 16) + UNAME_MACHINE="alphaev6" + ;; + esac + + objdump --private-headers $dummy | \ + grep ld.so.1 > /dev/null + if test "$?" = 0 ; then + LIBC="libc1" + fi + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 + elif test "${UNAME_MACHINE}" = "mips" ; then + cat >$dummy.c </dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + else + # Either a pre-BFD a.out linker (linux-gnuoldld) + # or one that does not give us useful --help. + # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. + # If ld does not provide *any* "supported emulations:" + # that means it is gnuoldld. + echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" + test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 + + case "${UNAME_MACHINE}" in + i?86) + VENDOR=pc; + ;; + *) + VENDOR=unknown; + ;; + esac + # Determine whether the default compiler is a.out or elf + cat >$dummy.c < +main(argc, argv) + int argc; + char *argv[]; +{ +#ifdef __ELF__ +# ifdef __GLIBC__ +# if __GLIBC__ >= 2 + printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); +# else + printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +# endif +# else + printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +# endif +#else + printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); +#endif + return 0; +} +EOF + ${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + fi ;; +# 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. + i?86:DYNIX/ptx:4*:*) + echo i386-sequent-sysv4 + exit 0 ;; + 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 0 ;; + i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} + fi + exit 0 ;; + i?86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i?86:UnixWare:*:*) + if /bin/uname -X 2>/dev/null >/dev/null ; then + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + fi + echo ${UNAME_MACHINE}-unixware-${UNAME_RELEASE}-${UNAME_VERSION} + exit 0 ;; + pc:*:*:*) + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + 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 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*: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 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i?86:LynxOS:2.*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *: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 0 ;; + PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:*:6*) + echo mips-sony-newsos6 + exit 0 ;; + R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +#if !defined (ultrix) + printf ("vax-dec-bsd\n"); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0 +rm -f $dummy.c $dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +#echo '(Unable to guess system type)' 1>&2 + +exit 1 diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..703d6ac --- /dev/null +++ b/config.h.in @@ -0,0 +1,304 @@ +/* config.h.in. Generated from configure.in by autoheader. */ + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +#undef CRAY_STACKSEG_END + +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +#undef ENABLE_NLS + +/* Define to 1 if you have `alloca', as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#undef HAVE_ALLOCA_H + +/* Define if ALSA is available */ +#undef HAVE_ALSA + +/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the + CoreFoundation framework. */ +#undef HAVE_CFLOCALECOPYCURRENT + +/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in + the CoreFoundation framework. */ +#undef HAVE_CFPREFERENCESCOPYAPPVALUE + +/* Define to 1 if you have the `closelog' function. */ +#undef HAVE_CLOSELOG + +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +#undef HAVE_DCGETTEXT + +/* define if we have DirectX includes */ +#undef HAVE_DIRECTX + +/* Define to 1 if you have the header file. */ +#undef HAVE_GETOPT_H + +/* Define to 1 if you have the `getopt_long' function. */ +#undef HAVE_GETOPT_LONG + +/* Define if the GNU gettext() function is already present or preinstalled. */ +#undef HAVE_GETTEXT + +/* Define to 1 if you have the `gtk_dialog_get_action_area' function. */ +#undef HAVE_GTK_DIALOG_GET_ACTION_AREA + +/* Define to 1 if you have the `gtk_dialog_get_content_area' function. */ +#undef HAVE_GTK_DIALOG_GET_CONTENT_AREA + +/* Define to 1 if you have the `gtk_widget_get_allocation' function. */ +#undef HAVE_GTK_WIDGET_GET_ALLOCATION + +/* Define to 1 if you have the `gtk_widget_get_realized' function. */ +#undef HAVE_GTK_WIDGET_GET_REALIZED + +/* Define to 1 if you have the `gtk_widget_get_state' function. */ +#undef HAVE_GTK_WIDGET_GET_STATE + +/* Define to 1 if you have the `gtk_widget_get_window' function. */ +#undef HAVE_GTK_WIDGET_GET_WINDOW + +/* Define to 1 if you have the `gtk_widget_is_drawable' function. */ +#undef HAVE_GTK_WIDGET_IS_DRAWABLE + +/* Define to 1 if you have the `gtk_widget_set_allocation' function. */ +#undef HAVE_GTK_WIDGET_SET_ALLOCATION + +/* Define to 1 if you have the `gtk_widget_set_can_default' function. */ +#undef HAVE_GTK_WIDGET_SET_CAN_DEFAULT + +/* Define to 1 if you have the `gtk_widget_set_can_focus' function. */ +#undef HAVE_GTK_WIDGET_SET_CAN_FOCUS + +/* Define to 1 if you have the `gtk_widget_set_has_window' function. */ +#undef HAVE_GTK_WIDGET_SET_HAS_WINDOW + +/* Define to 1 if you have the `gtk_widget_set_realized' function. */ +#undef HAVE_GTK_WIDGET_SET_REALIZED + +/* Define to 1 if you have the `gtk_widget_set_tooltip_text' function. */ +#undef HAVE_GTK_WIDGET_SET_TOOLTIP_TEXT + +/* Define to 1 if you have the `gtk_widget_set_window' function. */ +#undef HAVE_GTK_WIDGET_SET_WINDOW + +/* Define to 1 if you have the `gtk_widget_style_attach' function. */ +#undef HAVE_GTK_WIDGET_STYLE_ATTACH + +/* Define if you have the iconv() function and it works. */ +#undef HAVE_ICONV + +/* define if struct ifreq has the ifr_newname symbol */ +#undef HAVE_IFRNEWNAME + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `asound' library (-lasound). */ +#undef HAVE_LIBASOUND + +/* Define to 1 if you have the `hamlib' library (-lhamlib). */ +#undef HAVE_LIBHAMLIB + +/* Define to 1 if you have the `m' library (-lm). */ +#undef HAVE_LIBM + +/* Define to 1 if you have the `posix4' library (-lposix4). */ +#undef HAVE_LIBPOSIX4 + +/* Define to 1 if you have the `util' library (-lutil). */ +#undef HAVE_LIBUTIL + +/* Define to 1 if you have the `uuid' library (-luuid). */ +#undef HAVE_LIBUUID + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_AX25_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_HIDRAW_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_IF_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_PPDEV_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_SOCKIOS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* define if struct ifreq has the ifr_newname symbol */ +#undef HAVE_MKISS + +/* Define to 1 if you have the `mlockall' function. */ +#undef HAVE_MLOCKALL + +/* Define to 1 if you have the header file. */ +#undef HAVE_NET_IF_ARP_H + +/* Define to 1 if you have the `openlog' function. */ +#undef HAVE_OPENLOG + +/* Define to 1 if you have the `openpty' function. */ +#undef HAVE_OPENPTY + +/* Define to 1 if you have the header file. */ +#undef HAVE_PTY_H + +/* Define to 1 if you have the `random' function. */ +#undef HAVE_RANDOM + +/* Define to 1 if you have the header file. */ +#undef HAVE_SCHED_H + +/* define if bittypes like int16_t are defined */ +#undef HAVE_SIGNED_BITTYPES + +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STROPTS_H + +/* Define to 1 if you have the `syslog' function. */ +#undef HAVE_SYSLOG + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYSLOG_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_AUDIOIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_CONF_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_IOCCOM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_IOCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOUNDCARD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* define if bittypes like u_int16_t are defined */ +#undef HAVE_UNSIGNED_BITTYPES + +/* Define to 1 if you have the `vsnprintf' function. */ +#undef HAVE_VSNPRINTF + +/* Define to 1 if you have the `vsyslog' function. */ +#undef HAVE_VSYSLOG + +/* define if M_LOG10E is not defined by math.h */ +#undef M_LOG10E + +/* define if M_PI is not defined by math.h */ +#undef M_PI + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* various directories */ +#undef PACKAGE_DATA_DIR + +/* various directories */ +#undef PACKAGE_LOCALE_DIR + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* various directories */ +#undef PACKAGE_SOURCE_DIR + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* define if MMX is to be used */ +#undef USEMMX + +/* define if VIS is to be used */ +#undef USEVIS + +/* Version number of package */ +#undef VERSION + +/* define if compiling under Windows32 */ +#undef WIN32 + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to `unsigned int' if does not define. */ +#undef size_t diff --git a/config.rpath b/config.rpath new file mode 100755 index 0000000..17298f2 --- /dev/null +++ b/config.rpath @@ -0,0 +1,672 @@ +#! /bin/sh +# Output a system dependent set of variables, describing how to set the +# run time search path of shared libraries in an executable. +# +# Copyright 1996-2010 Free Software Foundation, Inc. +# Taken from GNU libtool, 2001 +# Originally by Gordon Matzigkeit , 1996 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# The first argument passed to this file is the canonical host specification, +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld +# should be set by the caller. +# +# The set of defined variables is at the end of this script. + +# Known limitations: +# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer +# than 256 bytes, otherwise the compiler driver will dump core. The only +# known workaround is to choose shorter directory names for the build +# directory and/or the installation directory. + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a +shrext=.so + +host="$1" +host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +# Code taken from libtool.m4's _LT_CC_BASENAME. + +for cc_temp in $CC""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'` + +# Code taken from libtool.m4's _LT_COMPILER_PIC. + +wl= +if test "$GCC" = yes; then + wl='-Wl,' +else + case "$host_os" in + aix*) + wl='-Wl,' + ;; + darwin*) + case $cc_basename in + xlc*) + wl='-Wl,' + ;; + esac + ;; + mingw* | cygwin* | pw32* | os2* | cegcc*) + ;; + hpux9* | hpux10* | hpux11*) + wl='-Wl,' + ;; + irix5* | irix6* | nonstopux*) + wl='-Wl,' + ;; + newsos6) + ;; + linux* | k*bsd*-gnu) + case $cc_basename in + ecc*) + wl='-Wl,' + ;; + icc* | ifort*) + wl='-Wl,' + ;; + lf95*) + wl='-Wl,' + ;; + pgcc | pgf77 | pgf90) + wl='-Wl,' + ;; + ccc*) + wl='-Wl,' + ;; + como) + wl='-lopt=' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + wl='-Wl,' + ;; + esac + ;; + esac + ;; + osf3* | osf4* | osf5*) + wl='-Wl,' + ;; + rdos*) + ;; + solaris*) + wl='-Wl,' + ;; + sunos4*) + wl='-Qoption ld ' + ;; + sysv4 | sysv4.2uw2* | sysv4.3*) + wl='-Wl,' + ;; + sysv4*MP*) + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + wl='-Wl,' + ;; + unicos*) + wl='-Wl,' + ;; + uts4*) + ;; + esac +fi + +# Code taken from libtool.m4's _LT_LINKER_SHLIBS. + +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no + +case "$host_os" in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + # Unlike libtool, we use -rpath here, not --rpath, since the documented + # option of GNU ld is called -rpath, not --rpath. + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + case "$host_os" in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + fi + ;; + amigaos*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we cannot use + # them. + ld_shlibs=no + ;; + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + cygwin* | mingw* | pw32* | cegcc*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + interix[3-9]*) + hardcode_direct=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + gnu* | linux* | k*bsd*-gnu) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + netbsd*) + ;; + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + else + ld_shlibs=no + fi + ;; + esac + ;; + sunos4*) + hardcode_direct=yes + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + esac + if test "$ld_shlibs" = no; then + hardcode_libdir_flag_spec= + fi +else + case "$host_os" in + aix3*) + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + else + aix_use_runtimelinking=no + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + fi + hardcode_direct=yes + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + fi + # Begin _LT_AC_SYS_LIBPATH_AIX. + echo 'int main () { return 0; }' > conftest.c + ${CC} ${LDFLAGS} conftest.c -o conftest + aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + fi + if test -z "$aix_libpath"; then + aix_libpath="/usr/lib:/lib" + fi + rm -f conftest.c conftest + # End _LT_AC_SYS_LIBPATH_AIX. + if test "$aix_use_runtimelinking" = yes; then + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + else + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + fi + fi + ;; + amigaos*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + bsdi[45]*) + ;; + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + libext=lib + ;; + darwin* | rhapsody*) + hardcode_direct=no + if test "$GCC" = yes ; then + : + else + case $cc_basename in + xlc*) + ;; + *) + ld_shlibs=no + ;; + esac + fi + ;; + dgux*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + freebsd1*) + ld_shlibs=no + ;; + freebsd2.2*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + freebsd2*) + hardcode_direct=yes + hardcode_minus_L=yes + ;; + freebsd* | dragonfly*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + hpux9*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + hpux10*) + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + hpux11*) + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + ;; + *) + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + irix5* | irix6* | nonstopux*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + netbsd*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + newsos6) + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + osf3*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + osf4* | osf5*) + if test "$GCC" = yes; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + # Both cc and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + solaris*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + sunos4*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + ;; + sysv4) + case $host_vendor in + sni) + hardcode_direct=yes # is this really true??? + ;; + siemens) + hardcode_direct=no + ;; + motorola) + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + ;; + sysv4.3*) + ;; + sysv4*MP*) + if test -d /usr/nec; then + ld_shlibs=yes + fi + ;; + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + ;; + sysv5* | sco3.2v5* | sco5v6*) + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator=':' + ;; + uts4*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + *) + ld_shlibs=no + ;; + esac +fi + +# Check dynamic linker characteristics +# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER. +# Unlike libtool.m4, here we don't care about _all_ names of the library, but +# only about the one the linker finds when passed -lNAME. This is the last +# element of library_names_spec in libtool.m4, or possibly two of them if the +# linker has special search rules. +library_names_spec= # the last element of library_names_spec in libtool.m4 +libname_spec='lib$name' +case "$host_os" in + aix3*) + library_names_spec='$libname.a' + ;; + aix[4-9]*) + library_names_spec='$libname$shrext' + ;; + amigaos*) + library_names_spec='$libname.a' + ;; + beos*) + library_names_spec='$libname$shrext' + ;; + bsdi[45]*) + library_names_spec='$libname$shrext' + ;; + cygwin* | mingw* | pw32* | cegcc*) + shrext=.dll + library_names_spec='$libname.dll.a $libname.lib' + ;; + darwin* | rhapsody*) + shrext=.dylib + library_names_spec='$libname$shrext' + ;; + dgux*) + library_names_spec='$libname$shrext' + ;; + freebsd1*) + ;; + freebsd* | dragonfly*) + case "$host_os" in + freebsd[123]*) + library_names_spec='$libname$shrext$versuffix' ;; + *) + library_names_spec='$libname$shrext' ;; + esac + ;; + gnu*) + library_names_spec='$libname$shrext' + ;; + hpux9* | hpux10* | hpux11*) + case $host_cpu in + ia64*) + shrext=.so + ;; + hppa*64*) + shrext=.sl + ;; + *) + shrext=.sl + ;; + esac + library_names_spec='$libname$shrext' + ;; + interix[3-9]*) + library_names_spec='$libname$shrext' + ;; + irix5* | irix6* | nonstopux*) + library_names_spec='$libname$shrext' + case "$host_os" in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; + *) libsuff= shlibsuff= ;; + esac + ;; + esac + ;; + linux*oldld* | linux*aout* | linux*coff*) + ;; + linux* | k*bsd*-gnu) + library_names_spec='$libname$shrext' + ;; + knetbsd*-gnu) + library_names_spec='$libname$shrext' + ;; + netbsd*) + library_names_spec='$libname$shrext' + ;; + newsos6) + library_names_spec='$libname$shrext' + ;; + nto-qnx*) + library_names_spec='$libname$shrext' + ;; + openbsd*) + library_names_spec='$libname$shrext$versuffix' + ;; + os2*) + libname_spec='$name' + shrext=.dll + library_names_spec='$libname.a' + ;; + osf3* | osf4* | osf5*) + library_names_spec='$libname$shrext' + ;; + rdos*) + ;; + solaris*) + library_names_spec='$libname$shrext' + ;; + sunos4*) + library_names_spec='$libname$shrext$versuffix' + ;; + sysv4 | sysv4.3*) + library_names_spec='$libname$shrext' + ;; + sysv4*MP*) + library_names_spec='$libname$shrext' + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + library_names_spec='$libname$shrext' + ;; + uts4*) + library_names_spec='$libname$shrext' + ;; +esac + +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' +escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` +shlibext=`echo "$shrext" | sed -e 's,^\.,,'` +escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` + +LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <. Submit a context +# diff and a properly formatted ChangeLog entry. +# +# 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. + +# 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 ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +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-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ + kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + 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) + os= + basic_machine=$1 + ;; + -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 + ;; + -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/'` + ;; + -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*) + 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 \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | ms1 \ + | msp430 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m32c) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # 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-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | ms1-* \ + | msp430-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + m32c-*) + ;; + # 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 + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + 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 + ;; + cr16c) + basic_machine=cr16c-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 + ;; + 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'm not sure what "Sysv32" means. Should this be sysv3.2? + 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 + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + 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 + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + 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 + ;; + 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 + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + 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) basic_machine=powerpc-unknown + ;; + ppc-*) 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 + ;; + 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 + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + 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 + ;; + 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 + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + 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 + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-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[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b) + 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. + -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* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ + | -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* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -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*) + # 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 + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -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 + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + 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 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + 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 + ;; + -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/configapp/AUTHORS b/configapp/AUTHORS new file mode 100644 index 0000000..e69de29 diff --git a/configapp/COPYING b/configapp/COPYING new file mode 100644 index 0000000..d60c31a --- /dev/null +++ b/configapp/COPYING @@ -0,0 +1,340 @@ + 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. + + + Copyright (C) + + 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) year 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. + + , 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/configapp/ChangeLog b/configapp/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/configapp/INSTALL b/configapp/INSTALL new file mode 100644 index 0000000..b42a17a --- /dev/null +++ b/configapp/INSTALL @@ -0,0 +1,182 @@ +Basic Installation +================== + + These are generic installation instructions. + + 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: + + 1. `cd' to the directory containing the package's source code and type + `./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. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. 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'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +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. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=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. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +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. diff --git a/configapp/Makefile.am b/configapp/Makefile.am new file mode 100644 index 0000000..5fba836 --- /dev/null +++ b/configapp/Makefile.am @@ -0,0 +1,26 @@ +## Process this file with automake to produce Makefile.in + +SUBDIRS = src + +#install-data-local: +# @$(NORMAL_INSTALL) +# if test -d $(srcdir)/pixmaps; then \ +# $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/pixmaps; \ +# for pixmap in $(srcdir)/pixmaps/*; do \ +# if test -f $$pixmap; then \ +# $(INSTALL_DATA) $$pixmap $(DESTDIR)$(pkgdatadir)/pixmaps; \ +# fi \ +# done \ +# fi + +#dist-hook: +# if test -d pixmaps; then \ +# mkdir $(distdir)/pixmaps; \ +# for pixmap in pixmaps/*; do \ +# if test -f $$pixmap; then \ +# cp -p $$pixmap $(distdir)/pixmaps; \ +# fi \ +# done \ +# fi + +EXTRA_DIST = configapp.glade option1.png option1.xpm option2.png option2.xpm diff --git a/configapp/Makefile.in b/configapp/Makefile.in new file mode 100644 index 0000000..8a69855 --- /dev/null +++ b/configapp/Makefile.in @@ -0,0 +1,609 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = configapp +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + AUTHORS COPYING ChangeLog INSTALL NEWS +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUDIOFILE_CFLAGS = @AUDIOFILE_CFLAGS@ +AUDIOFILE_LIBS = @AUDIOFILE_LIBS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +HAVE_ALSA = @HAVE_ALSA@ +HAVE_BITTYPES = @HAVE_BITTYPES@ +HAVE_DIRECTX = @HAVE_DIRECTX@ +HAVE_IFRNEWNAME = @HAVE_IFRNEWNAME@ +HAVE_MKISS = @HAVE_MKISS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTHREAD = @LIBTHREAD@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +M_PI = @M_PI@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USEMMX = @USEMMX@ +USEVIS = @USEVIS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WIN32 = @WIN32@ +WINDRES = @WINDRES@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CFLAGS = @XML_CFLAGS@ +XML_LIBS = @XML_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = src + +#install-data-local: +# @$(NORMAL_INSTALL) +# if test -d $(srcdir)/pixmaps; then \ +# $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/pixmaps; \ +# for pixmap in $(srcdir)/pixmaps/*; do \ +# if test -f $$pixmap; then \ +# $(INSTALL_DATA) $$pixmap $(DESTDIR)$(pkgdatadir)/pixmaps; \ +# fi \ +# done \ +# fi + +#dist-hook: +# if test -d pixmaps; then \ +# mkdir $(distdir)/pixmaps; \ +# for pixmap in pixmaps/*; do \ +# if test -f $$pixmap; then \ +# cp -p $$pixmap $(distdir)/pixmaps; \ +# fi \ +# done \ +# fi +EXTRA_DIST = configapp.glade option1.png option1.xpm option2.png option2.xpm +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu configapp/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu configapp/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ + install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic ctags \ + ctags-recursive distclean distclean-generic distclean-tags \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ + tags-recursive uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/configapp/NEWS b/configapp/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/configapp/README b/configapp/README new file mode 100644 index 0000000..e69de29 diff --git a/configapp/configapp.glade b/configapp/configapp.glade new file mode 100644 index 0000000..3516533 --- /dev/null +++ b/configapp/configapp.glade @@ -0,0 +1,1630 @@ + + + + + configapp + configapp + + src + pixmaps + C + False + True + + + + GtkWindow + mainwindow + + destroy_event + on_mainwindow_destroy_event + Mon, 26 Jun 2000 22:53:51 GMT + + + delete_event + on_mainwindow_delete_event + Mon, 26 Jun 2000 22:58:56 GMT + + SoundModem Configurator + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + 550 + 330 + False + True + False + soundmodem + soundmodem + + + GtkVBox + vbox1 + False + 0 + + + GtkHandleBox + handlebox1 + GTK_SHADOW_OUT + GTK_POS_LEFT + GTK_POS_TOP + + 0 + False + True + + + + GtkMenuBar + menubar1 + GTK_SHADOW_OUT + + + GtkMenuItem + file + + False + + + GtkMenu + file_menu + + + GtkMenuItem + new + + False + + + GtkMenu + new_menu + + + GtkMenuItem + newconfiguration + + activate + on_newconfiguration_activate + Sun, 25 Jun 2000 15:43:04 GMT + + + False + + + + GtkMenuItem + newchannel + + activate + on_newchannel_activate + Sun, 25 Jun 2000 15:43:19 GMT + + + False + + + + + + GtkMenuItem + delete + + False + + + GtkMenu + delete_menu + + + GtkMenuItem + deleteconfiguration + + activate + on_deleteconfiguration_activate + Sun, 25 Jun 2000 15:43:37 GMT + + + False + + + + GtkMenuItem + deletechannel + + activate + on_deletechannel_activate + Sun, 25 Jun 2000 15:43:51 GMT + + + False + + + + + + GtkMenuItem + separator1 + False + + + + GtkMenuItem + quit + + activate + on_quit_activate + Sun, 25 Jun 2000 14:41:57 GMT + + + False + + + + + + GtkMenuItem + diagnostics + + False + + + GtkMenu + diagnostics_menu + + + GtkMenuItem + diagscope + + activate + on_diagscope_activate + Tue, 27 Jun 2000 01:21:03 GMT + + + False + + + + GtkMenuItem + diagspectrum + + activate + on_diagspectrum_activate + Tue, 27 Jun 2000 01:21:27 GMT + + + False + + + + GtkMenuItem + diagmodem + + activate + on_diagmodem_activate + Tue, 04 Jul 2000 12:59:57 GMT + + + False + + + + GtkMenuItem + diagp3dmodem + + activate + on_diagp3dmodem_activate + Sun, 26 Nov 2000 16:04:15 GMT + + + False + + + + GtkCheckMenuItem + diagpassall + + activate + on_diagpassall_activate + Thu, 26 Dec 2002 17:08:00 GMT + + + False + True + + + + + + GtkMenuItem + help + + True + + + GtkMenu + help_menu + + + GtkMenuItem + about + + activate + on_about_activate + Sun, 25 Jun 2000 14:42:27 GMT + + + False + + + + + + + + GtkHBox + configbox + False + 0 + + 0 + True + True + + + + GtkScrolledWindow + scrolledwindow1 + 60 + 60 + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 0 + True + True + + + + GtkViewport + viewport1 + 60 + 60 + GTK_SHADOW_IN + + + GtkTree + configtree + + selection_changed + on_configtree_selection_changed + True + Sun, 25 Jun 2000 22:35:18 GMT + + GTK_SELECTION_SINGLE + GTK_TREE_VIEW_LINE + True + + + + + + GtkVBox + vbox3 + False + 0 + + 0 + True + True + + + + GtkNotebook + confignotebook + True + True + True + GTK_POS_TOP + False + 2 + 2 + False + + 0 + True + True + + + + Placeholder + + + + Placeholder + Notebook:tab + + + + + + + GtkStatusbar + statusbar1 + + 0 + False + False + + + + + + + GtkFileSelection + fileselection1 + 10 + Select File + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + True + False + True + + + GtkButton + FileSel:ok_button + ok_button1 + True + True + + GTK_RELIEF_NORMAL + + + + GtkButton + FileSel:cancel_button + cancel_button1 + True + True + + GTK_RELIEF_NORMAL + + + + + GtkDialog + aboutwindow + About SoundModem Configurator + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + True + False + soundmodem + soundmodem + + + GtkVBox + Dialog:vbox + dialog-vbox1 + False + 0 + + + GtkHBox + Dialog:action_area + dialog-action_area1 + 10 + True + 5 + + 0 + False + True + GTK_PACK_END + + + + GtkHButtonBox + hbuttonbox1 + GTK_BUTTONBOX_DEFAULT_STYLE + 30 + 85 + 27 + 7 + 0 + + 0 + False + False + + + + GtkButton + aboutok + True + True + + GTK_RELIEF_NORMAL + + + + + + GtkFrame + frame1 + 6 + + 0.5 + GTK_SHADOW_ETCHED_OUT + + 0 + True + True + + + + GtkVBox + vbox4 + False + 0 + + + GtkLabel + label13 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + True + True + + + + + GtkLabel + label14 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + True + True + + + + + + + + + GtkDialog + newconfigwindow + New Configuration + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + True + False + soundmodem + soundmodem + + + GtkVBox + Dialog:vbox + dialog-vbox2 + False + 0 + + + GtkHBox + Dialog:action_area + dialog-action_area2 + 10 + True + 5 + + 0 + False + True + GTK_PACK_END + + + + GtkHButtonBox + hbuttonbox2 + GTK_BUTTONBOX_DEFAULT_STYLE + 30 + 85 + 27 + 7 + 0 + + 0 + True + True + + + + GtkButton + newconfigcancel + True + True + + 0 + GDK_Escape + clicked + + + GTK_RELIEF_NORMAL + + + + GtkButton + newconfigok + True + True + + 0 + GDK_Return + clicked + + + GTK_RELIEF_NORMAL + + + + + + GtkHBox + hbox2 + False + 0 + + 0 + True + True + + + + GtkLabel + label15 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 6 + 6 + + 0 + False + True + + + + + GtkEntry + newconfigentry + True + True + True + 0 + + + 6 + True + True + + + + + + + + GtkDialog + errordialog + Error + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + True + True + True + False + soundmodem + soundmodem + + + GtkVBox + Dialog:vbox + dialog-vbox3 + False + 0 + + + GtkHBox + Dialog:action_area + dialog-action_area3 + 10 + True + 5 + + 0 + False + True + GTK_PACK_END + + + + GtkHButtonBox + hbuttonbox3 + GTK_BUTTONBOX_DEFAULT_STYLE + 30 + 85 + 27 + 7 + 0 + + 0 + True + True + + + + GtkButton + errorok + True + True + + 0 + GDK_Return + clicked + + + GTK_RELIEF_NORMAL + + + + + + GtkLabel + errorlabel + + GTK_JUSTIFY_CENTER + True + 0.5 + 0.5 + 6 + 6 + + 0 + True + True + + + + + + + GtkWindow + specwindow + + delete_event + on_specwindow_delete_event + Wed, 28 Jun 2000 21:56:22 GMT + + Spectrum Display + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + False + False + soundmodem + soundmodem + + + GtkVBox + vbox1 + False + 0 + + + GtkHBox + hbox1 + 4 + False + 0 + + 0 + False + True + + + + GtkLabel + label1 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + True + + + + + GtkEntry + specfreqpointer + 60 + False + True + 0 + + + 4 + False + True + + + + + GtkLabel + label25 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + True + True + + + + + GtkToggleButton + ptt + 50 + + toggled + on_ptt_toggled + Wed, 28 Jun 2000 21:29:18 GMT + + + GTK_RELIEF_NORMAL + False + + 4 + False + True + + + + + GtkLabel + label20 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 7 + 0 + + 0 + False + True + + + + + Custom + ledptt + create_led_pixmap + 0 + 0 + Wed, 26 Jul 2000 14:54:31 GMT + + 4 + False + True + + + + + GtkLabel + label19 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 7 + 0 + + 0 + False + True + + + + + Custom + leddcd + create_led_pixmap + 0 + 0 + Wed, 26 Jul 2000 14:51:17 GMT + + 4 + False + True + + + + + + GtkFrame + frame4 + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + False + False + + + + Custom + spec + 512 + 384 + True + GDK_POINTER_MOTION_MASK + + motion_notify_event + on_spec_motion_event + Sat, 23 Oct 1999 23:23:11 GMT + + spectrum_new + 0 + 0 + Sat, 23 Oct 1999 23:21:08 GMT + + + + + + + GtkWindow + scopewindow + + delete_event + on_scopewindow_delete_event + Wed, 28 Jun 2000 21:56:49 GMT + + Scope + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + True + False + soundmodem + soundmodem + + + GtkVBox + vbox5 + False + 0 + + + GtkHBox + hbox2 + 4 + False + 0 + + 0 + False + True + + + + GtkToggleButton + dcdfreeze + True + + toggled + on_dcdfreeze_toggled + Wed, 28 Jun 2000 21:57:38 GMT + + + GTK_RELIEF_NORMAL + False + + 4 + False + False + + + + + GtkLabel + label26 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + True + True + + + + + GtkToggleButton + ptt + 50 + True + + toggled + on_ptt_toggled + Wed, 28 Jun 2000 21:28:20 GMT + + + GTK_RELIEF_NORMAL + False + + 4 + False + False + + + + + GtkLabel + label21 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 7 + 0 + + 0 + False + True + + + + + Custom + ledptt + create_led_pixmap + 0 + 0 + Wed, 26 Jul 2000 14:56:29 GMT + + 4 + False + True + + + + + GtkLabel + label22 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 7 + 0 + + 0 + False + True + + + + + Custom + leddcd + create_led_pixmap + 0 + 0 + Wed, 26 Jul 2000 14:56:17 GMT + + 4 + False + True + + + + + + GtkFrame + frame5 + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + False + False + + + + Custom + scope + 512 + 384 + True + scope_new + 0 + 0 + Wed, 28 Jun 2000 21:13:16 GMT + + + + + + + GtkWindow + receivewindow + + delete_event + on_receivewindow_delete_event + Wed, 28 Jun 2000 21:56:58 GMT + + Receive Packets/Bits + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + True + False + soundmodem + soundmodem + + + GtkVBox + vbox6 + False + 0 + + + GtkHBox + hbox3 + 4 + False + 0 + + 0 + False + True + + + + GtkButton + clearbutton + True + + clicked + on_clearbutton_clicked + Wed, 28 Jun 2000 21:27:45 GMT + + + GTK_RELIEF_NORMAL + + 4 + False + False + + + + + GtkLabel + label7 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 3 + False + False + + + + + GtkEntry + count0 + 60 + False + True + 0 + + + 4 + False + True + + + + + GtkLabel + label17 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 3 + False + False + + + + + GtkEntry + count1 + 60 + False + True + 0 + + + 0 + False + True + + + + + GtkLabel + label18 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 3 + False + False + + + + + GtkEntry + counttot + 60 + False + True + 0 + + + 0 + False + True + + + + + GtkLabel + label27 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + True + True + + + + + GtkToggleButton + ptt + 50 + True + + toggled + on_ptt_toggled + Wed, 28 Jun 2000 21:28:08 GMT + + + GTK_RELIEF_NORMAL + False + + 4 + False + False + + + + + GtkLabel + label23 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 7 + 0 + + 0 + False + True + + + + + Custom + ledptt + create_led_pixmap + 0 + 0 + Wed, 26 Jul 2000 14:58:27 GMT + + 4 + False + True + + + + + GtkLabel + label24 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 7 + 0 + + 0 + False + True + + + + + Custom + leddcd + create_led_pixmap + 0 + 0 + Wed, 26 Jul 2000 14:58:55 GMT + + 4 + False + True + + + + + + GtkVPaned + vpaned1 + 10 + 6 + + 0 + True + True + + + + GtkFrame + frame6 + + 0 + GTK_SHADOW_ETCHED_IN + + True + True + + + + GtkScrolledWindow + scrolledwindow2 + GTK_POLICY_NEVER + GTK_POLICY_ALWAYS + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + + GtkText + packettext + False + + + + + + + GtkFrame + frame7 + + 0 + GTK_SHADOW_ETCHED_IN + + True + True + + + + GtkScrolledWindow + scrolledwindow3 + GTK_POLICY_NEVER + GTK_POLICY_ALWAYS + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + + GtkText + bitstext + False + + + + + + + + + + GtkWindow + p3dwindow + + delete_event + on_p3dwindow_delete_event + Sun, 26 Nov 2000 02:01:07 GMT + + AO-40 Phase 3D Receive Window + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + True + False + soundmodem + soundmodem + + + GtkVBox + vbox6 + False + 0 + + + GtkHBox + hbox3 + 4 + False + 0 + + 0 + False + True + + + + GtkLabel + label7 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 3 + False + False + + + + + GtkEntry + rxstatus + 120 + False + True + 0 + + + 4 + False + True + + + + + GtkLabel + label17 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 3 + False + False + + + + + GtkEntry + carrierfreq + 60 + False + True + 0 + + + 0 + False + True + + + + + GtkLabel + label18 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 3 + False + False + + + + + GtkToggleButton + buttonpassall + True + + GTK_RELIEF_NORMAL + False + + 0 + False + False + GTK_PACK_END + + + + + + GtkVPaned + vpaned1 + 10 + 6 + + 0 + True + True + + + + GtkFrame + frame6 + + 0 + GTK_SHADOW_ETCHED_IN + + True + True + + + + GtkScrolledWindow + scrolledwindow2 + GTK_POLICY_NEVER + GTK_POLICY_ALWAYS + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + + GtkText + packetcooked + False + + + + + + + GtkFrame + frame7 + + 0 + GTK_SHADOW_ETCHED_IN + + True + True + + + + GtkScrolledWindow + scrolledwindow3 + GTK_POLICY_NEVER + GTK_POLICY_ALWAYS + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + + GtkText + packetraw + False + + + + + + + + + diff --git a/configapp/option1.png b/configapp/option1.png new file mode 100644 index 0000000000000000000000000000000000000000..9e00b0ff415affa6bdbcca85cdac187582d4a258 GIT binary patch literal 413 zcmV;O0b>4%P)ZOMvGHW}E^8fT-(~c<;M|ZYRW`-$4`&adCMH z)1(+n+YIHLdY*S;+0M2SS5Aa8P c #414141", +", c #6A6057", +"' c #6A5947", +") c #5D4730", +"! c #4B331B", +"~ c #35200A", +"{ c #302D29", +"] c #2F2C29", +"^ c #FFFFFF", +"/ c #9A7C5E", +"( c #835F3B", +"_ c #704A23", +": c #583410", +"< c #402B16", +"[ c #34302C", +"} c #A1784F", +"| c #9B6A39", +"1 c #8D5924", +"2 c #744312", +"3 c #5D350E", +"4 c #333231", +"5 c #A56A2F", +"6 c #9B6022", +"7 c #8A4F14", +"8 c #6F4011", +"9 c #FFC55F", +"0 c #905517", +"a c #64401B", +"b c #3C352E", +"c c #864D15", +"d c #3F352C", +"e c #483D31", +"f c #463B2F", +" .+@#$. ", +" $#%&*=-; ", +".#>,')!~{]", +"+%,^/(_:<[", +"@&'/}|1234", +"#*)(|56784", +"$=!_1690ab", +".-~:270cde", +" ;{<38adf ", +" ][44be "}; diff --git a/configapp/option2.png b/configapp/option2.png new file mode 100644 index 0000000000000000000000000000000000000000..28b738bf135f2ebf459e56b156b15492ce8c6c23 GIT binary patch literal 433 zcmV;i0Z#sjP)2wI4sg*HM8?Zn0>@C|$d z-@wk=*2YSRNIC{4%YZaPsr8+UxAofYK#A-Z({V-?KN1`(@E>ZZXDZq^u$ z2Bd9u5WPEe+lRzGL=mK^529IT^`*5>?7~e-*242@fT1v^iguNaZ9-4KYe~`L|&|T>Hs_z9TX=;~IOxL^^ z#B;eCucQ-V!X0W5$f&_duWj*F9QGfPZ<*tAasc+TyxmCT49CpczVZI74W*nhnNJ?Q b3 c #CB3A16", +", c #AA3015", +"' c #B52C13", +") c #D54C1F", +"! c #F3863A", +"~ c #FCD56F", +"{ c #FDD047", +"] c #FDAC1E", +"^ c #FA710C", +"/ c #EF3605", +"( c #D34216", +"_ c #C23A16", +": c #BE3C1B", +"< c #EA551E", +"[ c #FCD76F", +"} c #FFFFFF", +"| c #FEF680", +"1 c #FEE42E", +"2 c #FEBE11", +"3 c #FC7607", +"4 c #EF4909", +"5 c #C7421A", +"6 c #D04C21", +"7 c #F25A17", +"8 c #FDD347", +"9 c #FEF780", +"0 c #FEF75A", +"a c #FEF12B", +"b c #FEDF12", +"c c #FDA807", +"d c #F96C06", +"e c #D24C1F", +"f c #D34C1F", +"g c #F3470D", +"h c #FDB31E", +"i c #FEE62E", +"j c #FEF22B", +"k c #FEF21D", +"l c #FEE710", +"m c #FEC408", +"n c #FB8B07", +"o c #D54E1F", +"p c #C43816", +"q c #EB360B", +"r c #FC7B0C", +"s c #FEC411", +"t c #FEE112", +"u c #FEE810", +"v c #FFFE83", +"w c #FDC90A", +"x c #F9860C", +"y c #D8531C", +"z c #C63213", +"A c #DE4216", +"B c #F63E05", +"C c #FD8007", +"D c #FEAF07", +"E c #FEC708", +"F c #FECB0A", +"G c #FDAC09", +"H c #E95D1A", +"I c #E4691F", +"J c #C43615", +"K c #E44C16", +"L c #F55309", +"M c #FB7406", +"N c #FC9007", +"O c #FA880C", +"P c #EB5F1A", +"Q c #DF5F1D", +"R c #D54016", +"S c #D7491A", +"T c #DF531F", +"U c #DE551C", +"V c #E7691F", +" .+@#$. ", +" %&*=-;>, ", +"')!~{]^/(_", +":<[}|12345", +"67890abcde", +"fghijklmno", +"pqrstuvwxy", +"zABCDEFGHI", +" JKLMNOPQ ", +" RSTTUV "}; diff --git a/configapp/src/Makefile.am b/configapp/src/Makefile.am new file mode 100644 index 0000000..5ef6581 --- /dev/null +++ b/configapp/src/Makefile.am @@ -0,0 +1,41 @@ +## Process this file with automake to produce Makefile.in + +INCLUDES = @GTK_CFLAGS@ @XML_CFLAGS@ -I$(top_srcdir)/intl -I$(top_srcdir) -I$(top_srcdir)/matlib -I$(top_srcdir)/libmisc \ + -I$(top_srcdir)/soundcard -I$(top_srcdir)/directx/include -I$(top_srcdir)/directx/include/directx6 \ + -I$(top_srcdir)/configapp + +man_MANS = soundmodemconfig.8 + +if WIN32 +#MWINDOWS = -mwindows +MWINDOWS = +RCOBJ = configapp.res +else +MWINDOWS = +RCOBJ = +endif + +MODEMLIBS = ../../afsk/libafsk.a ../../fsk/libfsk.a ../../pammodem/libpam.a ../../pskmodem/libpsk.a ../../newqpsk/libnewqpsk.a ../../p3dmodem/libp3d.a + +bin_PROGRAMS = soundmodemconfig + +if WIN32 +configapp.res: configapp.rc + $(WINDRES) $< -O coff -o $@ +endif + +soundmodemconfig_SOURCES = \ + main.c app.c diag.c configapp.h \ + support.c support.h \ + interface.c interface.h \ + callbacks.h \ + spectrum.c spectrum.h \ + scope.c scope.h \ + snm-compat-gtk2.h + +soundmodemconfig_LDADD = ../../soundcard/liblog.a ../../soundcard/libaudioio.a ../../soundcard/libpttio.a \ + $(MODEMLIBS) ../../matlib/libmat.a ../../libmisc/libmisc.a ../../soundcard/libcommon.a \ + @LIBTHREAD@ @GTK_LIBS@ @XML_LIBS@ @AUDIOFILE_LIBS@ @ALSA_LIBS@ $(RCOBJ) +soundmodemconfig_LDFLAGS = $(MWINDOWS) + +EXTRA_DIST = configapp.rc soundmodemconfig.8 diff --git a/configapp/src/Makefile.in b/configapp/src/Makefile.in new file mode 100644 index 0000000..7f7f65a --- /dev/null +++ b/configapp/src/Makefile.in @@ -0,0 +1,640 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +bin_PROGRAMS = soundmodemconfig$(EXEEXT) +subdir = configapp/src +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man8dir)" +PROGRAMS = $(bin_PROGRAMS) +am_soundmodemconfig_OBJECTS = main.$(OBJEXT) app.$(OBJEXT) \ + diag.$(OBJEXT) support.$(OBJEXT) interface.$(OBJEXT) \ + spectrum.$(OBJEXT) scope.$(OBJEXT) +soundmodemconfig_OBJECTS = $(am_soundmodemconfig_OBJECTS) +@WIN32_TRUE@am__DEPENDENCIES_1 = configapp.res +soundmodemconfig_DEPENDENCIES = ../../soundcard/liblog.a \ + ../../soundcard/libaudioio.a ../../soundcard/libpttio.a \ + $(MODEMLIBS) ../../matlib/libmat.a ../../libmisc/libmisc.a \ + ../../soundcard/libcommon.a $(am__DEPENDENCIES_1) +soundmodemconfig_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(soundmodemconfig_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(soundmodemconfig_SOURCES) +DIST_SOURCES = $(soundmodemconfig_SOURCES) +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +man8dir = $(mandir)/man8 +NROFF = nroff +MANS = $(man_MANS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUDIOFILE_CFLAGS = @AUDIOFILE_CFLAGS@ +AUDIOFILE_LIBS = @AUDIOFILE_LIBS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +HAVE_ALSA = @HAVE_ALSA@ +HAVE_BITTYPES = @HAVE_BITTYPES@ +HAVE_DIRECTX = @HAVE_DIRECTX@ +HAVE_IFRNEWNAME = @HAVE_IFRNEWNAME@ +HAVE_MKISS = @HAVE_MKISS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTHREAD = @LIBTHREAD@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +M_PI = @M_PI@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USEMMX = @USEMMX@ +USEVIS = @USEVIS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WIN32 = @WIN32@ +WINDRES = @WINDRES@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CFLAGS = @XML_CFLAGS@ +XML_LIBS = @XML_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +INCLUDES = @GTK_CFLAGS@ @XML_CFLAGS@ -I$(top_srcdir)/intl -I$(top_srcdir) -I$(top_srcdir)/matlib -I$(top_srcdir)/libmisc \ + -I$(top_srcdir)/soundcard -I$(top_srcdir)/directx/include -I$(top_srcdir)/directx/include/directx6 \ + -I$(top_srcdir)/configapp + +man_MANS = soundmodemconfig.8 +@WIN32_FALSE@MWINDOWS = + +#MWINDOWS = -mwindows +@WIN32_TRUE@MWINDOWS = +@WIN32_FALSE@RCOBJ = +@WIN32_TRUE@RCOBJ = configapp.res +MODEMLIBS = ../../afsk/libafsk.a ../../fsk/libfsk.a ../../pammodem/libpam.a ../../pskmodem/libpsk.a ../../newqpsk/libnewqpsk.a ../../p3dmodem/libp3d.a +soundmodemconfig_SOURCES = \ + main.c app.c diag.c configapp.h \ + support.c support.h \ + interface.c interface.h \ + callbacks.h \ + spectrum.c spectrum.h \ + scope.c scope.h \ + snm-compat-gtk2.h + +soundmodemconfig_LDADD = ../../soundcard/liblog.a ../../soundcard/libaudioio.a ../../soundcard/libpttio.a \ + $(MODEMLIBS) ../../matlib/libmat.a ../../libmisc/libmisc.a ../../soundcard/libcommon.a \ + @LIBTHREAD@ @GTK_LIBS@ @XML_LIBS@ @AUDIOFILE_LIBS@ @ALSA_LIBS@ $(RCOBJ) + +soundmodemconfig_LDFLAGS = $(MWINDOWS) +EXTRA_DIST = configapp.rc soundmodemconfig.8 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu configapp/src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu configapp/src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +soundmodemconfig$(EXEEXT): $(soundmodemconfig_OBJECTS) $(soundmodemconfig_DEPENDENCIES) + @rm -f soundmodemconfig$(EXEEXT) + $(soundmodemconfig_LINK) $(soundmodemconfig_OBJECTS) $(soundmodemconfig_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/app.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/diag.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interface.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scope.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spectrum.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/support.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +install-man8: $(man_MANS) + @$(NORMAL_INSTALL) + test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)" + @list=''; test -n "$(man8dir)" || exit 0; \ + { for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.8[a-z]*$$/p'; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \ + done; } + +uninstall-man8: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man8dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.8[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + test -z "$$files" || { \ + echo " ( cd '$(DESTDIR)$(man8dir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(man8dir)" && rm -f $$files; } + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @list='$(MANS)'; if test -n "$$list"; then \ + list=`for p in $$list; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ + if test -n "$$list" && \ + grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ + echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ + grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ + echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ + echo " typically \`make maintainer-clean' will remove them" >&2; \ + exit 1; \ + else :; fi; \ + else :; fi + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man8dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man8 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-man + +uninstall-man: uninstall-man8 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-man8 \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-man uninstall-man8 + + +@WIN32_TRUE@configapp.res: configapp.rc +@WIN32_TRUE@ $(WINDRES) $< -O coff -o $@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/configapp/src/app.c b/configapp/src/app.c new file mode 100644 index 0000000..84f3554 --- /dev/null +++ b/configapp/src/app.c @@ -0,0 +1,1049 @@ +/*****************************************************************************/ + +/* + * app.c -- Configuration Application. + * + * Copyright (C) 2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE +#define _REENTRANT + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +#include "configapp.h" + +#include + +#include "interface.h" +#include "support.h" +#include "callbacks.h" + +#include +#include +#include + +enum { + LABEL_COL, + CFGNAME_COL, + CHNAME_COL, + NUM_COLUMNS +}; + +typedef struct _CallbackData CallbackData; +struct _CallbackData +{ + GtkTreeModel *model; + GtkTreePath *path; +}; + +/* ---------------------------------------------------------------------- */ + +#ifdef WIN32 + +/* free result with g_free */ + +static gchar *strtogtk(const char *in) +{ + WCHAR *wch, *wp; + GdkWChar *gch, *gp; + unsigned int i, len; + + if (!(len = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, in, -1, NULL, 0))) + return NULL; + wch = wp = alloca(sizeof(wch[0])*len); + gch = gp = alloca(sizeof(gch[0])*(len+1)); + if (!MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, in, -1, wch, len)) + return NULL; + for (i = 0, wp = wch, gp = gch; i < len && *wp; i++, wp++, gp++) + *gp = *wp; + *gp = 0; + return gdk_wcstombs(gch); +} + +static char *gtktostr(const gchar *in) +{ + union { + GdkWChar g[4096]; + WCHAR w[4096]; + } u; + GdkWChar *gp; + WCHAR *wp; + gint len; + unsigned int i; + int len2; + char *ret; + + if ((len = gdk_mbstowcs(u.g, in, sizeof(u.g)/sizeof(u.g[0]))) == -1) + return NULL; + for (wp = u.w, gp = u.g, i = 0; i < len; i++, gp++, wp++) + *wp = *gp; + if (!(len2 = WideCharToMultiByte(CP_ACP, 0, u.w, len, NULL, 0, NULL, NULL))) + return NULL; + ret = g_malloc(len2+1); + if (!ret) + return NULL; + WideCharToMultiByte(CP_ACP, 0, u.w, len, ret, len2, NULL, NULL); + ret[len2] = 0; + return ret; +} + +#endif /* WIN32 */ + +/* ---------------------------------------------------------------------- */ + +static GtkWidget *create_notebookhead(GList *combo_items) +{ + GtkWidget *vbox, *hbox, *label, *combo, *hsep; + GList *l; + + vbox = gtk_vbox_new(FALSE, 0); + gtk_widget_show(vbox); + hbox = gtk_hbox_new(FALSE, 0); + gtk_widget_show(hbox); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); + label = gtk_label_new(_("Mode")); + gtk_widget_show(label); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 5); + gtk_misc_set_padding(GTK_MISC(label), 7, 7); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); + combo = gtk_combo_box_new_text(); + gtk_widget_show(combo); + for (l = combo_items; l; l = l->next) { + gtk_combo_box_append_text(GTK_COMBO_BOX(combo), + (const gchar *)l->data); + } + gtk_box_pack_start(GTK_BOX(hbox), combo, FALSE, TRUE, 0); + hsep = gtk_hseparator_new(); + gtk_widget_show(hsep); + gtk_box_pack_start(GTK_BOX(vbox), hsep, FALSE, TRUE, 3); + g_object_set_data(G_OBJECT(vbox), "combo", combo); + return vbox; +} + +static GtkWidget *create_paramwidget(const struct modemparams *par, const char *cfgname, const char *chname, const char *typname) +{ + const struct modemparams *par2 = par; + unsigned int parcnt = 0, i, j; + GtkWidget *table, *w1; + GtkObject *o1; +#ifndef HAVE_GTK_WIDGET_SET_TOOLTIP_TEXT + GtkTooltips *tooltips; +#endif + char buf[128]; + const char *value, * const *cp; + double nval; + int active; +#ifdef WIN32 + gchar *valueg; + gchar *combov; +#endif + + if (!par) + return gtk_vbox_new(FALSE, 0); + while (par2->name) { + par2++; + parcnt++; + } + table = gtk_table_new(parcnt, 2, FALSE); + gtk_widget_show(table); +#ifndef HAVE_GTK_WIDGET_SET_TOOLTIP_TEXT + tooltips = gtk_tooltips_new(); +#endif + for (par2 = par, i = 0; i < parcnt; i++, par2++) { + w1 = gtk_label_new(par2->label); + gtk_widget_show(w1); + gtk_table_attach(GTK_TABLE(table), w1, 0, 1, i, i+1, + (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions) 0, 5, 5); + gtk_misc_set_alignment(GTK_MISC(w1), 0, 0.5); + gtk_label_set_justify(GTK_LABEL(w1), GTK_JUSTIFY_LEFT); + if (xml_getprop(cfgname, chname, typname, par2->name, buf, sizeof(buf)) > 0) + value = buf; + else + value = par2->dflt; + switch (par2->type) { + case MODEMPAR_STRING: + w1 = gtk_entry_new(); +#ifdef WIN32 + valueg = strtogtk(value); + gtk_entry_set_text(GTK_ENTRY(w1), valueg ?: "(null)"); + g_free(valueg); +#else + gtk_entry_set_text(GTK_ENTRY(w1), value); +#endif + break; + + case MODEMPAR_COMBO: + w1 = gtk_combo_box_entry_new_text(); + active = -1; +#ifdef WIN32 + valueg = strtogtk(value); + for (cp = par2->u.c.combostr, j = 0; *cp && j < 8; j++, cp++) { + combov = strtogtk(*cp); + gtk_combo_box_append_text(GTK_COMBO_BOX(w1), combov); + if (strcmp(combov, valueg) == 0) + active = j; + g_free(combov); + } + if (active == -1) { + gtk_combo_box_append_text(GTK_COMBO_BOX(w1), valueg); + active = j; + } + g_free (valueg); +#else + for (cp = par2->u.c.combostr, j = 0; *cp && j < 8; j++, cp++) { + gtk_combo_box_append_text(GTK_COMBO_BOX(w1), *cp); + if (strcmp(*cp, value) == 0) + active = j; + } + if (active == -1) { + gtk_combo_box_append_text(GTK_COMBO_BOX(w1), value); + active = j; + } +#endif + gtk_combo_box_set_active (GTK_COMBO_BOX(w1), active); + break; + + case MODEMPAR_NUMERIC: + nval = strtod(value, NULL); + if (nval < par2->u.n.min) + nval = par2->u.n.min; + if (nval > par2->u.n.max) + nval = par2->u.n.max; + o1 = gtk_adjustment_new(nval, par2->u.n.min, par2->u.n.max, par2->u.n.step, + par2->u.n.pagestep, 0); + w1 = gtk_spin_button_new(GTK_ADJUSTMENT(o1), par2->u.n.step, 0); + break; + + case MODEMPAR_CHECKBUTTON: + w1 = gtk_check_button_new(); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w1), (*value == '0') ? FALSE : TRUE); + break; + + default: + continue; + } + gtk_widget_show(w1); + g_object_set_data(G_OBJECT(table), par2->name, w1); + gtk_table_attach(GTK_TABLE(table), w1, 1, 2, i, i+1, + (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions) 0, 5, 5); + if (par2->tooltip) +#ifdef HAVE_GTK_WIDGET_SET_TOOLTIP_TEXT + gtk_widget_set_tooltip_text (w1, par2->tooltip); +#else + gtk_tooltips_set_tip(tooltips, w1, par2->tooltip, NULL); +#endif + } + return table; +} + +static void update_paramwidget(GtkWidget *table, const struct modemparams *par, const char *cfgname, const char *chname, const char *typname) +{ + const struct modemparams *par2 = par; + GtkWidget *w1; + char buf[256], *txt2; +#ifdef WIN32 + char *txt; +#endif + + if (!par) + return; + for (par2 = par; par2->name; par2++) { + w1 = g_object_get_data(G_OBJECT(table), par2->name); + if (!w1) + continue; + switch (par2->type) { + case MODEMPAR_STRING: +#ifdef WIN32 + txt = gtktostr(gtk_entry_get_text(GTK_ENTRY(w1))); + xml_setprop(cfgname, chname, typname, par2->name, txt ?: "(null)"); + g_free(txt); +#else + xml_setprop(cfgname, chname, typname, par2->name, gtk_entry_get_text(GTK_ENTRY(w1))); +#endif + break; + + case MODEMPAR_COMBO: + txt2 = gtk_combo_box_get_active_text (GTK_COMBO_BOX(w1)); +#ifdef WIN32 + txt = gtktostr(txt2); + xml_setprop(cfgname, chname, typname, par2->name, txt ?: "(null)"); + g_free(txt); +#else + xml_setprop(cfgname, chname, typname, par2->name, txt2); +#endif + g_free(txt2); + break; + + case MODEMPAR_NUMERIC: + sprintf(buf, "%g", gtk_spin_button_get_value(GTK_SPIN_BUTTON(w1))); + xml_setprop(cfgname, chname, typname, par2->name, buf); + break; + + case MODEMPAR_CHECKBUTTON: + xml_setprop(cfgname, chname, typname, par2->name, + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w1)) ? "1" : "0"); + break; + + default: + continue; + } + } +} + +static void on_iotypecombochg_changed(GtkEditable *editable, gpointer user_data); + +static void cfg_select(const char *cfgname, const char *chname) +{ + GtkWidget *notebook, *w1, *w2, *combo; + struct modemparams *ioparams = ioparams_soundcard; + GList *ilist; + char buf[128]; + unsigned int i; + int active; + + g_print("config_select: cfg: %s chan: %s\n", cfgname ?: "-", chname ?: "-"); + + notebook = GTK_WIDGET(g_object_get_data(G_OBJECT(mainwindow), "confignotebook")); + /* compute audio IO types */ + ilist = NULL; + if (xml_getprop(cfgname, NULL, "audio", ioparam_type[0].name, buf, sizeof(buf)) <= 0) { + buf[0] = 0; + active = -1; + } + if (!strcmp(buf, ioparam_type[0].u.c.combostr[1])) { + ioparams = ioparams_filein; + active = 1; + } else if (!strcmp(buf, ioparam_type[0].u.c.combostr[2])) { + ioparams = ioparams_sim; + active = 2; +#ifdef HAVE_ALSA + } else if (!strcmp(buf, ioparam_type[0].u.c.combostr[3])) { + ioparams = ioparams_alsasoundcard; + active = 3; +#endif /* HAVE_ALSA */ + } else { + ioparams = ioparams_soundcard; + strncpy(buf, ioparam_type[0].u.c.combostr[0], sizeof(buf)); + active = 0; + } + for (i = 0; i < 8; i++) + if (ioparam_type[0].u.c.combostr[i]) + ilist = g_list_append(ilist, (void *)ioparam_type[0].u.c.combostr[i]); + w1 = create_notebookhead(ilist); + g_object_set_data(G_OBJECT(w1), "cfgname", (void *)cfgname); + g_object_set_data(G_OBJECT(w1), "chname", (void *)chname); + g_list_free(ilist); + combo = GTK_WIDGET(g_object_get_data(G_OBJECT(w1), "combo")); + gtk_combo_box_set_active(GTK_COMBO_BOX(combo), active); + /* create rest of notebook */ + w2 = create_paramwidget(ioparams, cfgname, NULL, "audio"); + gtk_box_pack_start(GTK_BOX(w1), w2, TRUE, TRUE, 10); + g_object_set_data(G_OBJECT(w1), "audio", w2); + g_object_set_data(G_OBJECT(w1), "audioparams", ioparams); + w2 = gtk_hseparator_new(); + gtk_widget_show(w2); + gtk_box_pack_start(GTK_BOX(w1), w2, FALSE, TRUE, 0); + w2 = create_paramwidget(pttparams, cfgname, NULL, "ptt"); + gtk_box_pack_start(GTK_BOX(w1), w2, TRUE, TRUE, 10); + g_object_set_data(G_OBJECT(w1), "ptt", w2); + w2 = gtk_hseparator_new(); + gtk_widget_show(w2); + gtk_box_pack_start(GTK_BOX(w1), w2, FALSE, TRUE, 0); + + w2 = gtk_label_new(_("IO")); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), w1, w2); + /* connect change signal */ + g_signal_connect(G_OBJECT(combo), "changed", + G_CALLBACK(on_iotypecombochg_changed), NULL); + + /* second page contains channel access parameters */ + w1 = gtk_vbox_new(FALSE, 0); + gtk_widget_show(w1); + g_object_set_data(G_OBJECT(w1), "cfgname", (void *)cfgname); + g_object_set_data(G_OBJECT(w1), "chname", (void *)chname); + w2 = create_paramwidget(chaccparams_x, cfgname, NULL, "chaccess"); + gtk_box_pack_start(GTK_BOX(w1), w2, TRUE, TRUE, 10); + g_object_set_data(G_OBJECT(w1), "chacc", w2); + + w2 = gtk_label_new(_("Channel Access")); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), w1, w2); +} + +static void cfg_deselect(const char *cfgname, const char *chname) +{ + GtkWidget *notebook, *w1, *combo; + struct modemparams *ioparams; + gchar *text; + + g_print("config_deselect: cfg: %s chan: %s\n", cfgname ?: "-", chname ?: "-"); + + notebook = GTK_WIDGET(g_object_get_data(G_OBJECT(mainwindow), "confignotebook")); + w1 = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), 1); + if (w1) { + update_paramwidget(GTK_WIDGET(g_object_get_data(G_OBJECT(w1), "chacc")), chaccparams_x, cfgname, NULL, "chaccess"); + gtk_notebook_remove_page(GTK_NOTEBOOK(notebook), 1); + } + w1 = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), 0); + if (!w1) + return; + /* update type */ + combo = GTK_WIDGET(g_object_get_data(G_OBJECT(w1), "combo")); + text = gtk_combo_box_get_active_text (GTK_COMBO_BOX(combo)); + xml_setprop(cfgname, NULL, "audio", ioparam_type[0].name, text); + g_free(text); + ioparams = (struct modemparams *)g_object_get_data(G_OBJECT(w1), "audioparams"); + update_paramwidget(GTK_WIDGET(g_object_get_data(G_OBJECT(w1), "audio")), ioparams, cfgname, NULL, "audio"); + update_paramwidget(GTK_WIDGET(g_object_get_data(G_OBJECT(w1), "ptt")), pttparams, cfgname, NULL, "ptt"); + gtk_notebook_remove_page(GTK_NOTEBOOK(notebook), 0); +} + +static guint iotypecombochg = 0; + +static gint do_iotypecombochg_change(gpointer user_data) +{ + GtkWidget *notebook, *w; + const char *cfgname, *chname; + gint nbcurpage; + + iotypecombochg = 0; + /* recreate notebook widgets */ + notebook = GTK_WIDGET(g_object_get_data(G_OBJECT(mainwindow), "confignotebook")); + /* find config strings */ + w = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), 0); + cfgname = g_object_get_data(G_OBJECT(w), "cfgname"); + chname = g_object_get_data(G_OBJECT(w), "chname"); + + g_print("on_notebookcombo_changed: cfg: %s chan: %s\n", cfgname ?: "-", chname ?: "-"); + + nbcurpage = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook)); + cfg_deselect(cfgname, chname); + g_print("Recreating menus\n"); + cfg_select(cfgname, chname); + gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), nbcurpage); + g_print("Returning\n"); + return FALSE; +} + +static void on_iotypecombochg_changed(GtkEditable *editable, gpointer user_data) +{ + if (!iotypecombochg) + iotypecombochg = g_idle_add_full(G_PRIORITY_HIGH, do_iotypecombochg_change, + NULL, NULL); +} + + +struct packetio { + struct packetio *next; + const char *name; + const struct modemparams *params; +}; + +#ifndef WIN32 +#ifdef HAVE_MKISS + +static struct packetio pktkiss = { NULL, "KISS", pktkissparams_x }; +static struct packetio packetchain = { &pktkiss, "MKISS", pktmkissparams_x }; + +#else /* HAVE_MKISS */ + +static struct packetio packetchain = { NULL, "KISS", pktkissparams_x }; + +#endif /* HAVE_MKISS */ +#endif /* WIN32 */ + + +static void on_notebookcombo_changed(GtkEditable *editable, gpointer user_data); + +static void make_notebook_menus(const char *cfgname, const char *chname) +{ + GtkWidget *notebook, *w1, *w2, *combo; + GList *ilist; + struct modulator *modch = &modchain_x, *modch1 = &modchain_x; + struct demodulator *demodch = &demodchain_x, *demodch1 = &demodchain_x; +#ifndef WIN32 + struct packetio *pktch = &packetchain, *pktch1 = &packetchain; +#endif /* WIN32 */ + char mode[128]; + int i, active; + + notebook = GTK_WIDGET(g_object_get_data(G_OBJECT(mainwindow), "confignotebook")); + /* Modulator Tab */ + ilist = NULL; + if (xml_getprop(cfgname, chname, "mod", "mode", mode, sizeof(mode)) <= 0) + mode[0] = 0; + for (i = 0, active = 0; modch; i++, modch = modch->next) { + ilist = g_list_append(ilist, (void *)modch->name); + if (!strcmp(mode, modch->name)) { + modch1 = modch; + active = i; + } + } + w1 = create_notebookhead(ilist); + g_list_free(ilist); + combo = GTK_WIDGET(g_object_get_data(G_OBJECT(w1), "combo")); + gtk_combo_box_set_active(GTK_COMBO_BOX(combo), active); + w2 = create_paramwidget(modch1->params, cfgname, chname, "mod"); + g_object_set_data(G_OBJECT(w1), "cfgname", (void *)cfgname); + g_object_set_data(G_OBJECT(w1), "chname", (void *)chname); + g_object_set_data(G_OBJECT(w1), "par", (void *)modch1->params); + g_object_set_data(G_OBJECT(w1), "table", w2); + gtk_box_pack_start(GTK_BOX(w1), w2, TRUE, TRUE, 1); + w2 = gtk_label_new(_("Modulator")); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), w1, w2); + g_signal_connect(G_OBJECT(combo), "changed", + G_CALLBACK(on_notebookcombo_changed), NULL); + /* Demodulator Tab */ + ilist = NULL; + if (xml_getprop(cfgname, chname, "demod", "mode", mode, sizeof(mode)) <= 0) + mode[0] = 0; + for (i = 0, active = 0; demodch; i++, demodch = demodch->next) { + ilist = g_list_append(ilist, (void *)demodch->name); + if (!strcmp(mode, demodch->name)) { + demodch1 = demodch; + active = i; + } + } + w1 = create_notebookhead(ilist); + g_list_free(ilist); + combo = GTK_WIDGET(g_object_get_data(G_OBJECT(w1), "combo")); + gtk_combo_box_set_active(GTK_COMBO_BOX(combo), active); + w2 = create_paramwidget(demodch1->params, cfgname, chname, "demod"); + g_object_set_data(G_OBJECT(w1), "cfgname", (void *)cfgname); + g_object_set_data(G_OBJECT(w1), "chname", (void *)chname); + g_object_set_data(G_OBJECT(w1), "par", (void *)demodch1->params); + g_object_set_data(G_OBJECT(w1), "table", w2); + gtk_box_pack_start(GTK_BOX(w1), w2, TRUE, TRUE, 1); + w2 = gtk_label_new(_("Demodulator")); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), w1, w2); + g_signal_connect(G_OBJECT(combo), "changed", + G_CALLBACK(on_notebookcombo_changed), NULL); +#ifndef WIN32 + /* Packet IO Tab */ + ilist = NULL; + if (xml_getprop(cfgname, chname, "pkt", "mode", mode, sizeof(mode)) <= 0) + mode[0] = 0; + for (i = 0, active = 0; pktch; i++, pktch = pktch->next) { + ilist = g_list_append(ilist, (void *)pktch->name); + if (!strcmp(mode, pktch->name)) { + pktch1 = pktch; + active = i; + } + } + w1 = create_notebookhead(ilist); + g_list_free(ilist); + combo = GTK_WIDGET(g_object_get_data(G_OBJECT(w1), "combo")); + gtk_combo_box_set_active(GTK_COMBO_BOX(combo), active); + w2 = create_paramwidget(pktch1->params, cfgname, chname, "pkt"); + g_object_set_data(G_OBJECT(w1), "cfgname", (void *)cfgname); + g_object_set_data(G_OBJECT(w1), "chname", (void *)chname); + g_object_set_data(G_OBJECT(w1), "par", (void *)pktch1->params); + g_object_set_data(G_OBJECT(w1), "table", w2); + gtk_box_pack_start(GTK_BOX(w1), w2, TRUE, TRUE, 1); + w2 = gtk_label_new(_("Packet IO")); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), w1, w2); + g_signal_connect(G_OBJECT(combo), "changed", + G_CALLBACK(on_notebookcombo_changed), NULL); +#endif /* WIN32 */ +} + +static void destroy_notebook_menus(void) +{ + GtkWidget *w, *notebook, *combo; + const char *cfgname, *chname; + struct modemparams *par; + gchar *text; + + notebook = GTK_WIDGET(g_object_get_data(G_OBJECT(mainwindow), "confignotebook")); + /* find config strings */ + w = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), 0); + cfgname = g_object_get_data(G_OBJECT(w), "cfgname"); + chname = g_object_get_data(G_OBJECT(w), "chname"); + if (!cfgname || !chname) { + g_printerr("destroy_notebook_menus: cfgname or chname NULL!\n"); + return; + } + /* update modulator */ + combo = GTK_WIDGET(g_object_get_data(G_OBJECT(w), "combo")); + text = gtk_combo_box_get_active_text (GTK_COMBO_BOX(combo)); + xml_setprop(cfgname, chname, "mod", "mode", text); +g_print("Modulator mode: %s\n", text); + g_free(text); + par = g_object_get_data(G_OBJECT(w), "par"); + update_paramwidget(GTK_WIDGET(g_object_get_data(G_OBJECT(w), "table")), par, cfgname, chname, "mod"); + /* update demodulator */ + w = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), 1); + combo = GTK_WIDGET(g_object_get_data(G_OBJECT(w), "combo")); + text = gtk_combo_box_get_active_text (GTK_COMBO_BOX(combo)); + xml_setprop(cfgname, chname, "demod", "mode", text); +g_print("Demodulator mode: %s\n", text); + g_free(text); + par = g_object_get_data(G_OBJECT(w), "par"); + update_paramwidget(GTK_WIDGET(g_object_get_data(G_OBJECT(w), "table")), par, cfgname, chname, "demod"); + /* update KISS stuff */ +#ifndef WIN32 + w = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), 2); + combo = GTK_WIDGET(g_object_get_data(G_OBJECT(w), "combo")); + text = gtk_combo_box_get_active_text (GTK_COMBO_BOX(combo)); + xml_setprop(cfgname, chname, "pkt", "mode", text); +g_print("Packet IO mode: %s\n", text); + g_free(text); + par = g_object_get_data(G_OBJECT(w), "par"); + update_paramwidget(GTK_WIDGET(g_object_get_data(G_OBJECT(w), "table")), par, cfgname, chname, "pkt"); +#endif /* WIN32 */ + /* delete pages */ +#ifndef WIN32 + gtk_notebook_remove_page(GTK_NOTEBOOK(notebook), 2); +#endif /* WIN32 */ + gtk_notebook_remove_page(GTK_NOTEBOOK(notebook), 1); + gtk_notebook_remove_page(GTK_NOTEBOOK(notebook), 0); +} + +static guint notebookcombochg = 0; + +static gint do_notebookcombo_change(gpointer user_data) +{ + GtkWidget *notebook, *w; + const char *cfgname, *chname; + gint nbcurpage; + + notebookcombochg = 0; + /* recreate notebook widgets */ + notebook = GTK_WIDGET(g_object_get_data(G_OBJECT(mainwindow), "confignotebook")); + /* find config strings */ + w = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), 0); + cfgname = g_object_get_data(G_OBJECT(w), "cfgname"); + chname = g_object_get_data(G_OBJECT(w), "chname"); + + g_print("on_notebookcombo_changed: cfg: %s chan: %s\n", cfgname ?: "-", chname ?: "-"); + nbcurpage = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook)); + destroy_notebook_menus(); + g_print("Recreating menus\n"); + make_notebook_menus(cfgname, chname); + gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), nbcurpage); + g_print("Returning\n"); + return FALSE; +} + +static void on_notebookcombo_changed(GtkEditable *editable, gpointer user_data) +{ + /*GtkWidget *vbox = GTK_WIDGET(user_data);*/ + + if (!notebookcombochg) + notebookcombochg = g_idle_add_full(G_PRIORITY_HIGH, do_notebookcombo_change, + NULL, NULL); +} + +static int +compare_sels (char* config_a, char *channel_a, char *config_b, char *channel_b) +{ + + if (config_a && !config_b) + return 1; + if (config_b && !config_a) + return -1; + if (config_a) { + int res = strcmp(config_a, config_b); + if (res != 0) + return res; + } + /* Same config */ + if (channel_a && !channel_b) + return 1; + if (channel_b && !channel_a) + return -1; + if (channel_a) + return strcmp(channel_a, channel_b); + /* If we get here, all inputs were NULL */ + return 0; +} + +void on_configtree_selection_changed(GtkTreeSelection *selection, gpointer user_data) +{ + GtkTreeIter iter; + char *cfgname = NULL, *chname = NULL; + char *old_cfgname = NULL, *old_chname = NULL; + + printf("on_configtree_selection_changed\n"); + old_cfgname = g_object_get_data(G_OBJECT(configmodel), "cfgname"); + old_chname = g_object_get_data(G_OBJECT(configmodel), "chname"); + if (gtk_tree_selection_get_selected(selection, &configmodel, &iter)) + gtk_tree_model_get(configmodel, &iter, CFGNAME_COL, &cfgname, CHNAME_COL, &chname, -1); + if (old_cfgname) { + if (compare_sels(old_cfgname, old_chname, cfgname, chname) == 0) { + printf("no change\n"); + return; + } else { + if (old_chname) { + if (notebookcombochg) + g_source_remove(notebookcombochg); + notebookcombochg = 0; + destroy_notebook_menus(); + gtk_widget_hide(GTK_WIDGET(g_object_get_data(G_OBJECT(mainwindow), "diagnostics"))); + diag_stop(); + + } else { + cfg_deselect(old_cfgname, old_chname); + } + } + } + if (chname) { + make_notebook_menus(cfgname, chname); + gtk_widget_show(GTK_WIDGET(g_object_get_data(G_OBJECT(mainwindow), "diagnostics"))); + } else if (cfgname) { + cfg_select(cfgname, chname); + } + g_object_set_data(G_OBJECT(configmodel), "cfgname", g_strdup(cfgname)); + g_object_set_data(G_OBJECT(configmodel), "chname", g_strdup(chname)); + g_free(old_cfgname); + g_free(old_chname); + + if (cfgname && chname) { + gtk_widget_show(g_object_get_data(G_OBJECT(mainwindow), "newchannel")); + gtk_widget_show(g_object_get_data(G_OBJECT(mainwindow), "deleteconfiguration")); + gtk_widget_show(g_object_get_data(G_OBJECT(mainwindow), "deletechannel")); + } else if (cfgname) { + gtk_widget_show(g_object_get_data(G_OBJECT(mainwindow), "newchannel")); + gtk_widget_show(g_object_get_data(G_OBJECT(mainwindow), "deleteconfiguration")); + gtk_widget_hide(g_object_get_data(G_OBJECT(mainwindow), "deletechannel")); + } else { + gtk_widget_hide(g_object_get_data(G_OBJECT(mainwindow), "newchannel")); + gtk_widget_hide(g_object_get_data(G_OBJECT(mainwindow), "deleteconfiguration")); + gtk_widget_hide(g_object_get_data(G_OBJECT(mainwindow), "deletechannel")); + } + g_print("selection: cfg: %s chan: %s\n", cfgname ?: "-", chname ?: "-"); +} + + +GtkTreeModel * +create_configmodel(void) +{ + GtkTreeStore *model; + GtkWidget *view; + GtkTreeSelection *selection; + GtkCellRenderer *cell; + GtkTreeViewColumn *column; + + model = gtk_tree_store_new(NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); + view = g_object_get_data(G_OBJECT(mainwindow), "configtree"); + gtk_tree_view_set_model(GTK_TREE_VIEW(view), GTK_TREE_MODEL(model)); + selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view)); + g_signal_connect_after((gpointer) selection, "changed", + G_CALLBACK(on_configtree_selection_changed), + NULL); + + gtk_tree_selection_set_mode(GTK_TREE_SELECTION(selection), + GTK_SELECTION_BROWSE); + cell = gtk_cell_renderer_text_new(); + + column = gtk_tree_view_column_new_with_attributes("Configurations", + cell, + "text", LABEL_COL, + NULL); + gtk_tree_view_append_column(GTK_TREE_VIEW(view), + GTK_TREE_VIEW_COLUMN(column)); + gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE); + + return GTK_TREE_MODEL(model); +} + + +/* ---------------------------------------------------------------------- */ + +static void dounselect(void) +{ + GtkWidget *view; + GtkTreeSelection *selection; + + view = g_object_get_data(G_OBJECT(mainwindow), "configtree"); + selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view)); + gtk_tree_selection_unselect_all(selection); +} + +void on_quit_activate(GtkMenuItem *menuitem, gpointer user_data) +{ + dounselect(); + gtk_main_quit(); +} + +gboolean on_mainwindow_destroy_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) +{ + g_print("destroy event\n"); + dounselect(); + gtk_main_quit(); + return TRUE; +} + +gboolean on_mainwindow_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) +{ + g_print("delete event\n"); + dounselect(); + gtk_main_quit(); + return FALSE; +} + +static void on_aboutok_clicked(GtkButton *button, gpointer user_data) +{ + gtk_widget_hide(GTK_WIDGET(user_data)); + gtk_widget_destroy(GTK_WIDGET(user_data)); +} + +void on_about_activate(GtkMenuItem *menuitem, gpointer user_data) +{ + GtkWidget *dlg = create_aboutwindow(); + + g_signal_connect(G_OBJECT(g_object_get_data(G_OBJECT(dlg), "aboutok")), + "clicked", G_CALLBACK(on_aboutok_clicked), dlg); + gtk_window_set_transient_for(GTK_WINDOW(dlg), GTK_WINDOW(mainwindow)); + gtk_widget_show(dlg); +} + + +/* ---------------------------------------------------------------------- */ + +static gboolean findconfigitem(const gchar *name, GtkTreeIter *iter) +{ + char *str; + + if (!gtk_tree_model_get_iter_first(configmodel, iter)) + return FALSE; + do { + gtk_tree_model_get(configmodel, iter, 0, &str, -1); + if (strcmp(name, str) == 0) { + g_free(str); + return TRUE; + } + g_free(str); + } while (gtk_tree_model_iter_next(configmodel, iter)); + return FALSE; +} + +static gboolean findchannelitem(const gchar *name, GtkTreeIter *itercfg, GtkTreeIter *iter) +{ + char *str; + + if (!gtk_tree_model_iter_children(configmodel, iter, itercfg)) + return FALSE; + do { + gtk_tree_model_get(configmodel, iter, 0, &str, -1); + if (strcmp(name, str) == 0) { + g_free(str); + return TRUE; + } + g_free(str); + } while (gtk_tree_model_iter_next(configmodel, iter)); + return FALSE; +} + +void new_configuration(const gchar *name) +{ + GtkTreeIter iter; + + if (findconfigitem(name, &iter)) + return; + gtk_tree_store_append(GTK_TREE_STORE(configmodel), &iter, NULL); + gtk_tree_store_set(GTK_TREE_STORE(configmodel), &iter, + LABEL_COL, name, + CFGNAME_COL, name, -1); +} + +void new_channel(const gchar *cfgname, const gchar *name) +{ + GtkTreeIter iter, child_iter; + GtkTreeView *view; + GtkTreePath *path; + + if (!findconfigitem(cfgname, &iter)) { + g_printerr("Could not find configuration \"%s\"\n", cfgname); + return; + } + gtk_tree_store_append(GTK_TREE_STORE(configmodel), &child_iter, &iter); + gtk_tree_store_set(GTK_TREE_STORE(configmodel), &child_iter, + LABEL_COL, name, + CFGNAME_COL, cfgname, + CHNAME_COL, name, -1); + path = gtk_tree_model_get_path(configmodel, &iter); + view = g_object_get_data(G_OBJECT(mainwindow), "configtree"); + gtk_tree_view_expand_row(view, path, FALSE); + gtk_tree_path_free(path); +} + +static void renumber_onecfg(GtkTreeIter *cfgiter) +{ + GtkTreeIter iter; + unsigned int cnt = 0; + gchar buf[64]; + + if (!gtk_tree_model_iter_children(configmodel, &iter, cfgiter)) + return; + do { + sprintf(buf, "Channel %u", cnt++); + gtk_tree_store_set(GTK_TREE_STORE (configmodel), &iter, + LABEL_COL, buf, -1); + } while (gtk_tree_model_iter_next(configmodel, &iter)); + +} + +void renumber_channels(void) +{ + GtkTreeIter iter; + + if (!gtk_tree_model_get_iter_first(configmodel, &iter)) + return; + do { + renumber_onecfg(&iter); + } while (gtk_tree_model_iter_next(configmodel, &iter)); +} + +/* gtk_container_remove */ +/* ---------------------------------------------------------------------- */ + +static void on_errorok_clicked(GtkButton *button, gpointer user_data) +{ + gtk_widget_hide(GTK_WIDGET(user_data)); + gtk_widget_destroy(GTK_WIDGET(user_data)); +} + +void error_dialog(const gchar *text) +{ + GtkWidget *dlg = create_errordialog(); + + g_signal_connect(G_OBJECT(g_object_get_data(G_OBJECT(dlg), "errorok")), + "clicked", G_CALLBACK(on_errorok_clicked), dlg); + gtk_label_set_text(GTK_LABEL(g_object_get_data(G_OBJECT(dlg), "errorlabel")), text); + gtk_window_set_transient_for(GTK_WINDOW(dlg), GTK_WINDOW(mainwindow)); + gtk_widget_show(dlg); +} + +/* ---------------------------------------------------------------------- */ + +static void on_newconfigok_clicked(GtkButton *button, gpointer user_data) +{ + const gchar *text = gtk_entry_get_text(GTK_ENTRY(g_object_get_data(G_OBJECT(user_data), "newconfigentry"))); + int ret; + char buf[128]; + + gtk_widget_hide(GTK_WIDGET(user_data)); + if (text[0]) { + ret = xml_newconfig(text); + if (ret) { + snprintf(buf, sizeof(buf), "Duplicate name: \"%s\"\n", text); + error_dialog(buf); + } else { + new_configuration(text); + } + } + gtk_widget_destroy(GTK_WIDGET(user_data)); +} + +static void on_newconfigcancel_clicked(GtkButton *button, gpointer user_data) +{ + gtk_widget_hide(GTK_WIDGET(user_data)); + gtk_widget_destroy(GTK_WIDGET(user_data)); +} + +void on_newconfiguration_activate(GtkMenuItem *menuitem, gpointer user_data) +{ + GtkWidget *dlg = create_newconfigwindow(); + + g_signal_connect(G_OBJECT(g_object_get_data(G_OBJECT(dlg), "newconfigok")), + "clicked", G_CALLBACK(on_newconfigok_clicked), dlg); + g_signal_connect(G_OBJECT(g_object_get_data(G_OBJECT(dlg), "newconfigcancel")), + "clicked", G_CALLBACK(on_newconfigcancel_clicked), dlg); + gtk_window_set_transient_for(GTK_WINDOW(dlg), GTK_WINDOW(mainwindow)); + gtk_widget_show(dlg); +} + +/* ---------------------------------------------------------------------- */ + +void on_newchannel_activate(GtkMenuItem *menuitem, gpointer user_data) +{ + const char *cfgname = NULL, *chname = NULL; + + cfgname = g_object_get_data(G_OBJECT(configmodel), "cfgname"); + if (!cfgname) { + g_printerr("on_newchannel_activate: cfgname NULL\n"); + return; + } + chname = xml_newchannel(cfgname); + if (!chname) { + g_printerr("on_newchannel_activate: cannot create new channel\n"); + return; + } + new_channel(cfgname, chname); + renumber_channels(); +} + + +void on_deleteconfiguration_activate(GtkMenuItem *menuitem, gpointer user_data) +{ + const char *cfgname = NULL; + GtkTreeIter iter; + + cfgname = g_object_get_data(G_OBJECT(configmodel), "cfgname"); + if (!cfgname) + return; + if (findconfigitem(cfgname, &iter)) { + g_print("delete cfg %s\n", cfgname); + if (xml_deleteconfig(cfgname) == 0) { + g_object_set_data(G_OBJECT(configmodel), "cfgname", NULL); + free((char *)cfgname); + gtk_tree_store_remove(GTK_TREE_STORE(configmodel), &iter); + } + } + +} + +void on_deletechannel_activate(GtkMenuItem *menuitem, gpointer user_data) +{ + const char *cfgname = NULL, *chname = NULL; + GtkTreeIter cfg_iter, iter; + + cfgname = g_object_get_data(G_OBJECT(configmodel), "cfgname"); + chname = g_object_get_data(G_OBJECT(configmodel), "chname"); + if (!cfgname || !chname) + return; + if (findconfigitem(cfgname, &cfg_iter) && findchannelitem(chname, &cfg_iter, &iter)) { + if (xml_deletechannel(cfgname, chname) == 0) { + g_object_set_data(G_OBJECT(configmodel), "chname", NULL); + free((char *)chname); + renumber_channels(); + gtk_tree_store_remove(GTK_TREE_STORE(configmodel), &iter); + } + } +} diff --git a/configapp/src/callbacks.h b/configapp/src/callbacks.h new file mode 100644 index 0000000..9be5ffe --- /dev/null +++ b/configapp/src/callbacks.h @@ -0,0 +1,155 @@ +#include + + +gboolean +on_mainwindow_destroy_event (GtkWidget *widget, + GdkEvent *event, + gpointer user_data); + +gboolean +on_mainwindow_delete_event (GtkWidget *widget, + GdkEvent *event, + gpointer user_data); + +void +on_new_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_newconfiguration_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_newchannel_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_deleteconfiguration_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_deletechannel_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_quit_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_diagscope_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_diagspectrum_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_diagtransmit_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_diagreceive_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_about_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_configtree_cursor_changed (GtkTreeView *tree_view, + gpointer user_data); + +void +on_new_configuration_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_comboentry2_changed (GtkEditable *editable, + gpointer user_data); + +gboolean +on_wspec_delete_event (GtkWidget *widget, + GdkEvent *event, + gpointer user_data); + +gboolean +on_spec_button_press_event (GtkWidget *widget, + GdkEventButton *event, + gpointer user_data); + +gboolean +on_spec_motion_event (GtkWidget *widget, + GdkEventMotion *event, + gpointer user_data); + +void +on_ptt_toggled (GtkToggleButton *togglebutton, + gpointer user_data); + +void +on_clearbutton_clicked (GtkButton *button, + gpointer user_data); + +gboolean +on_specwindow_delete_event (GtkWidget *widget, + GdkEvent *event, + gpointer user_data); + +gboolean +on_scopewindow_delete_event (GtkWidget *widget, + GdkEvent *event, + gpointer user_data); + +void +on_dcdfreeze_toggled (GtkToggleButton *togglebutton, + gpointer user_data); + +gboolean +on_receivewindow_delete_event (GtkWidget *widget, + GdkEvent *event, + gpointer user_data); + +void +on_dcd_toggled (GtkToggleButton *togglebutton, + gpointer user_data); + +void +on_diagmodem_activate (GtkMenuItem *menuitem, + gpointer user_data); + +GtkWidget* +create_led_pixmap (gchar *widget_name, gchar *string1, gchar *string2, + gint int1, gint int2); + +GtkWidget* +create_led_pixmap (gchar *widget_name, gchar *string1, gchar *string2, + gint int1, gint int2); + +GtkWidget* +create_led_pixmap (gchar *widget_name, gchar *string1, gchar *string2, + gint int1, gint int2); + +GtkWidget* +create_led_pixmap (gchar *widget_name, gchar *string1, gchar *string2, + gint int1, gint int2); + +GtkWidget* +create_led_pixmap (gchar *widget_name, gchar *string1, gchar *string2, + gint int1, gint int2); + +GtkWidget* +create_led_pixmap (gchar *widget_name, gchar *string1, gchar *string2, + gint int1, gint int2); + +gboolean +on_p3dwindow_delete_event (GtkWidget *widget, + GdkEvent *event, + gpointer user_data); + +void +on_diagp3dmodem_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_diagpassall_activate (GtkMenuItem *menuitem, + gpointer user_data); diff --git a/configapp/src/configapp.h b/configapp/src/configapp.h new file mode 100644 index 0000000..6d1012a --- /dev/null +++ b/configapp/src/configapp.h @@ -0,0 +1,71 @@ +/*****************************************************************************/ + +/* + * configapp.h -- Configuration Application Header File. + * + * Copyright (C) 2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*****************************************************************************/ + +#ifndef _CONFIGAPP_H +#define _CONFIGAPP_H + +/* ---------------------------------------------------------------------- */ + +#define _GNU_SOURCE +#define _REENTRANT + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "modem.h" +#include "soundio.h" + +/* ---------------------------------------------------------------------- */ + +extern struct modulator modchain_x; +extern struct demodulator demodchain_x; +extern struct modemparams chaccparams_x[]; +extern struct modemparams pktkissparams_x[]; +extern struct modemparams pktmkissparams_x[]; +extern struct modemparams ioparam_type[]; + +extern GtkWidget *mainwindow, *specwindow, *scopewindow, *receivewindow, *p3dwindow; +extern GtkTreeModel *configmodel; +extern void new_configuration(const gchar *name); +extern void new_channel(const gchar *cfgname, const gchar *name); +extern void renumber_channels(void); +extern void error_dialog(const gchar *text); +extern int xml_newconfig(const char *newname); +extern const char *xml_newchannel(const char *cfgname); +extern int xml_deleteconfig(const char *newname); +extern int xml_deletechannel(const char *cfgname, const char *chname); +extern int xml_setprop(const char *cfgname, const char *chname, const char *typname, const char *propname, const char *data); +extern int xml_getprop(const char *cfgname, const char *chname, const char *typname, const char *propname, char *buf, unsigned int bufsz); +extern GtkTreeModel *create_configmodel(void); + +/* diagnostics stuff */ +extern void diag_stop(void); + + +/* ---------------------------------------------------------------------- */ +#endif /* _CONFIGAPP_H */ diff --git a/configapp/src/configapp.rc b/configapp/src/configapp.rc new file mode 100644 index 0000000..156ce08 --- /dev/null +++ b/configapp/src/configapp.rc @@ -0,0 +1,40 @@ +#include + +LANGUAGE LANG_GERMAN, SUBLANG_GERMAN + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x0L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "HB9JNX/AE4WA\0" + VALUE "FileDescription", "SoundModem Configurator\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "soundmodemconfig\0" + VALUE "LegalCopyright", "Copyright © 1999-2000\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "soundmodemconfig.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "SoundModem\0" + VALUE "ProductVersion", "1.00a\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/configapp/src/diag.c b/configapp/src/diag.c new file mode 100644 index 0000000..e3d2456 --- /dev/null +++ b/configapp/src/diag.c @@ -0,0 +1,885 @@ +/*****************************************************************************/ + +/* + * diag.c -- Configuration Application, diagnostic part. + * + * Copyright (C) 2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE +#define _REENTRANT + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "configapp.h" + +#include + +#include "interface.h" +#include "support.h" +#include "callbacks.h" + +#include "spectrum.h" +#include "scope.h" + +#include +#include +#include +#include + +/* ---------------------------------------------------------------------- */ + +#include "option1.xpm" +#include "option2.xpm" + +/* ---------------------------------------------------------------------- */ + +//#ifdef WIN32 +#define TXTERMNOCANCEL +//#endif + + +#define DIAGFLG_MODEM 1 +#define DIAGFLG_SCOPE 2 +#define DIAGFLG_SPECTRUM 4 +#define DIAGFLG_RECEIVE 8 +#define DIAGFLG_P3DRECEIVE 16 +#define DIAGFLG_WINDOWMASK (DIAGFLG_P3DRECEIVE|DIAGFLG_RECEIVE|DIAGFLG_SCOPE|DIAGFLG_SPECTRUM) + +static struct { + unsigned int flags; + struct modulator *modch; + struct demodulator *demodch; + const char *cfgname; + const char *chname; + guint timeoutid; + unsigned int samplerate; + struct { + unsigned int newstate; + unsigned int state; + unsigned int carrierfreq; + unsigned int newpacket; + u_int16_t crc; + unsigned char packet[512+2]; + } p3d; + int dcd, upddcd, dcdfreeze; + int ptt, updptt, pttthr, updpttthr; + unsigned int count0, count1, updcount; + unsigned int rxwr, rxrd; + unsigned char rxbuf[1024]; + /* HDLC receiver */ + struct { + unsigned int bitbuf, bitstream, numbits, state, passall; + unsigned char *bufptr; + int bufcnt; + unsigned char buf[RXBUFFER_SIZE]; + } hrx; + unsigned int traceupd; + void *modstate, *demodstate; + unsigned int bitrate; + pthread_cond_t txcond; + pthread_mutex_t txmutex; + pthread_t rxthread, txthread; + struct pttio pttio; + struct audioio *audioio; +#ifdef TXTERMNOCANCEL + unsigned int txterminate; +#endif +} diagstate = { + 0, &modchain_x, &demodchain_x, NULL, NULL, 0, + 0, { 0, 0, 0, 0, }, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, { 0, }, + { 0, 0, 0, 0, 0, }, + 0, + NULL, NULL, 0, + PTHREAD_COND_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, +#if 0 + /* gcc3 no longer accepts {} as initializer */ + { }, { }, +#endif +}; + +/* ---------------------------------------------------------------------- */ +/* + * the CRC routines are stolen from WAMPES + * by Dieter Deyke + */ + +const u_int16_t crc_ccitt_table[0x100] = { + 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, + 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, + 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, + 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, + 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, + 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, + 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, + 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, + 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, + 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, + 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, + 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, + 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, + 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, + 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, + 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, + 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, + 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, + 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, + 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, + 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, + 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, + 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, + 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, + 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, + 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, + 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, + 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, + 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, + 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, + 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, + 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78 +}; + +/* ---------------------------------------------------------------------- */ + +static inline u_int16_t calc_crc_ccitt(const u_int8_t *buffer, int len) +{ + u_int16_t crc = 0xffff; + + for (;len>0;len--) + crc = (crc >> 8) ^ crc_ccitt_table[(crc ^ *buffer++) & 0xff]; + crc ^= 0xffff; + return crc; +} + +static inline void append_crc_ccitt(u_int8_t *buffer, int len) +{ + u_int16_t crc = calc_crc_ccitt(buffer, len); + buffer[len] = crc; + buffer[len+1] = crc >> 8; +} + +static inline int check_crc_ccitt(const u_int8_t *buffer, int len) +{ + u_int16_t crc = calc_crc_ccitt(buffer, len); + return (crc & 0xffff) == 0x0f47; +} + +/* ---------------------------------------------------------------------- */ + +static void do_rxpacket(void) +{ + if (diagstate.hrx.bufcnt < 3) + return; +#if 1 + if (!diagstate.hrx.passall && !check_crc_ccitt(diagstate.hrx.buf, diagstate.hrx.bufcnt)) + return; +#endif + { + GtkTextView *view; + GtkTextBuffer *model; + char buf[512]; + int i, len; + len = snprintpkt(buf, sizeof(buf), diagstate.hrx.buf, diagstate.hrx.bufcnt-2); + for (i = 0; i < len; i++) { + if (!g_ascii_isprint(buf[i]) && + !g_ascii_isspace(buf[i])) + buf[i] = '*'; + } + + g_printerr("Packet: %s\n", buf); + view = GTK_TEXT_VIEW(g_object_get_data(G_OBJECT(receivewindow), "packettext")); + model = gtk_text_view_get_buffer(GTK_TEXT_VIEW(view)); + gtk_text_buffer_insert_at_cursor(model, buf, len); + gtk_text_view_scroll_mark_onscreen(view, gtk_text_buffer_get_insert(model)); + } +} + +#define DECODEITERA(j) \ +do { \ + if (!(notbitstream & (0x0fc << j))) /* flag or abort */ \ + goto flgabrt##j; \ + if ((bitstream & (0x1f8 << j)) == (0xf8 << j)) /* stuffed bit */ \ + goto stuff##j; \ + enditer##j:; \ +} while (0) + +#define DECODEITERB(j) \ +do { \ + flgabrt##j: \ + if (!(notbitstream & (0x1fc << j))) { /* abort received */ \ + state = 0; \ + goto enditer##j; \ + } \ + if ((bitstream & (0x1fe << j)) != (0x0fc << j)) /* flag received */ \ + goto enditer##j; \ + if (state) \ + do_rxpacket(); \ + diagstate.hrx.bufcnt = 0; \ + diagstate.hrx.bufptr = diagstate.hrx.buf; \ + state = 1; \ + numbits = 7-j; \ + goto enditer##j; \ + stuff##j: \ + numbits--; \ + bitbuf = (bitbuf & ((~0xff) << j)) | ((bitbuf & ~((~0xff) << j)) << 1); \ + goto enditer##j; \ +} while (0) + +static inline void hdlc_receive(const unsigned char *data, unsigned nrbytes) +{ + unsigned bits, bitbuf, notbitstream, bitstream, numbits, state; + + /* start of HDLC decoder */ + numbits = diagstate.hrx.numbits; + state = diagstate.hrx.state; + bitstream = diagstate.hrx.bitstream; + bitbuf = diagstate.hrx.bitbuf; + while (nrbytes > 0) { + bits = *data++; + nrbytes--; + bitstream >>= 8; + bitstream |= ((unsigned int)bits) << 8; + bitbuf >>= 8; + bitbuf |= ((unsigned int)bits) << 8; + numbits += 8; + notbitstream = ~bitstream; + DECODEITERA(0); + DECODEITERA(1); + DECODEITERA(2); + DECODEITERA(3); + DECODEITERA(4); + DECODEITERA(5); + DECODEITERA(6); + DECODEITERA(7); + goto enddec; + DECODEITERB(0); + DECODEITERB(1); + DECODEITERB(2); + DECODEITERB(3); + DECODEITERB(4); + DECODEITERB(5); + DECODEITERB(6); + DECODEITERB(7); + enddec: + while (state && numbits >= 8) { + if (diagstate.hrx.bufcnt >= RXBUFFER_SIZE) { + state = 0; + } else { + *(diagstate.hrx.bufptr)++ = bitbuf >> (16-numbits); + diagstate.hrx.bufcnt++; + numbits -= 8; + } + } + } + diagstate.hrx.numbits = numbits; + diagstate.hrx.state = state; + diagstate.hrx.bitstream = bitstream; + diagstate.hrx.bitbuf = bitbuf; +} + +/* ---------------------------------------------------------------------- */ + +void p3dreceive(struct modemchannel *chan, const unsigned char *pkt, u_int16_t crc) +{ + memcpy(diagstate.p3d.packet, pkt, 512+2); + diagstate.p3d.crc = crc; + diagstate.p3d.newpacket = 1; +} + +void p3drxstate(struct modemchannel *chan, unsigned int synced, unsigned int carrierfreq) +{ + diagstate.p3d.state = synced; + diagstate.p3d.carrierfreq = carrierfreq; + diagstate.p3d.newstate = 1; +} + +/* ---------------------------------------------------------------------- */ + +static inline unsigned int hweight8(unsigned int w) +{ + unsigned int res = (w & 0x55) + ((w >> 1) & 0x55); + res = (res & 0x33) + ((res >> 2) & 0x33); + return (res & 0x0F) + ((res >> 4) & 0x0F); +} + +/* ---------------------------------------------------------------------- */ + +void audiowrite(struct modemchannel *chan, const int16_t *samples, unsigned int nr) +{ + if (!diagstate.audioio->write) + return; + diagstate.audioio->write(diagstate.audioio, samples, nr); +} + +void audioread(struct modemchannel *chan, int16_t *samples, unsigned int nr, u_int16_t tim) +{ + if (!diagstate.audioio->read) { + pthread_exit(NULL); + return; + } + diagstate.audioio->read(diagstate.audioio, samples, nr, tim); +} + +u_int16_t audiocurtime(struct modemchannel *chan) +{ + if (!diagstate.audioio->curtime) + return 0; + return diagstate.audioio->curtime(diagstate.audioio); +} + +/* ---------------------------------------------------------------------- */ + +int pktget(struct modemchannel *chan, unsigned char *data, unsigned int len) +{ + memset(data, 0, len); +#ifdef TXTERMNOCANCEL + if (diagstate.txterminate) + return 0; +#endif + return diagstate.ptt ? len : 0; +} + +void pktput(struct modemchannel *chan, const unsigned char *data, unsigned int len) +{ + unsigned int l; + + while (len > 0) { + l = sizeof(diagstate.rxbuf) - diagstate.rxwr; + if (l > len) + l = len; + memcpy(&diagstate.rxbuf[diagstate.rxwr], data, l); + data += l; + diagstate.rxwr = (diagstate.rxwr + l) % sizeof(diagstate.rxbuf); + len -= l; + } +} + +void pktsetdcd(struct modemchannel *chan, int dcd) +{ + pttsetdcd(&diagstate.pttio, dcd); + diagstate.dcd = dcd; + diagstate.upddcd = 1; +} + +static void *transmitter(void *dummy) +{ + diagstate.pttthr = 0; + diagstate.updpttthr = 1; + pthread_mutex_lock(&diagstate.txmutex); + for (;;) { +#ifdef TXTERMNOCANCEL + if (diagstate.txterminate) { + pthread_mutex_unlock(&diagstate.txmutex); + return NULL; + } +#endif + if (!diagstate.ptt || !diagstate.modch->modulate || !diagstate.audioio->write) { + pthread_cond_wait(&diagstate.txcond, &diagstate.txmutex); + continue; + } + diagstate.pttthr = 1; + diagstate.updpttthr = 1; + pttsetptt(&diagstate.pttio, 1); + if (diagstate.audioio->transmitstart) + diagstate.audioio->transmitstart(diagstate.audioio); + diagstate.modch->modulate(diagstate.modstate, 0); + if (diagstate.audioio->transmitstop) + diagstate.audioio->transmitstop(diagstate.audioio); + pttsetptt(&diagstate.pttio, 0); + diagstate.pttthr = 0; + diagstate.updpttthr = 1; + } +} + +static void *receiver(void *dummy) +{ + if (diagstate.demodch->demodulate) + diagstate.demodch->demodulate(diagstate.demodstate); + pktsetdcd(NULL, 0); + return NULL; +} + +/* ---------------------------------------------------------------------- */ + +static void setled(GtkImage *image, int on) +{ + GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data(on ? (const char **)option2_xpm : (const char **)option1_xpm); + + gtk_image_set_from_pixbuf(image, pixbuf); + g_object_unref(pixbuf); +} + +GtkWidget* create_led_pixmap(gchar *widget_name, gchar *string1, gchar *string2, gint int1, gint int2) +{ + GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data((const char **)option1_xpm); + GtkWidget *image = gtk_image_new_from_pixbuf(pixbuf); + + g_object_unref(pixbuf); + return image; +} + +/* ---------------------------------------------------------------------- */ + +static inline void update_display_p3d(void) +{ + GtkTextView *view; + GtkTextBuffer *model; + GtkWidget *w; + unsigned int i, j; + char buf[4096], *cp; + + if (diagstate.p3d.newstate) { + diagstate.p3d.newstate = 0; + snprintf(buf, sizeof(buf), "%s", diagstate.p3d.state == 2 ? "RECEIVE (SYNCSCAN)" : diagstate.p3d.state ? "RECEIVE" : "SYNC HUNT"); + w = GTK_WIDGET(g_object_get_data(G_OBJECT(p3dwindow), "rxstatus")); + gtk_entry_set_text(GTK_ENTRY(w), buf); + snprintf(buf, sizeof(buf), "%u", diagstate.p3d.carrierfreq); + w = GTK_WIDGET(g_object_get_data(G_OBJECT(p3dwindow), "carrierfreq")); + gtk_entry_set_text(GTK_ENTRY(w), buf); + } + if (diagstate.p3d.newpacket) { + diagstate.p3d.newpacket = 0; + cp = buf; + cp += sprintf(cp, "P3D Telemetry Packet: CRC 0x%04x", diagstate.p3d.crc); + for (i = 0; i < 512; i += 0x10) { + cp += sprintf(cp, "\n%04x:", i); + for (j = 0; j < 0x10; j++) + cp += sprintf(cp, " %02x", diagstate.p3d.packet[i+j]); + cp += sprintf(cp, " "); + for (j = 0; j < 0x10; j++) { + if (diagstate.p3d.packet[i+j] < ' ' || diagstate.p3d.packet[i+j] >= 0x80) + cp += sprintf(cp, "."); + else + cp += sprintf(cp, "%c", diagstate.p3d.packet[i+j]); + } + } + cp += sprintf(cp, "\n%04x: %02x %02x%44s", 512, diagstate.p3d.packet[512], diagstate.p3d.packet[514], " "); + for (i = 512; i < 514; i++) { + if (diagstate.p3d.packet[i] < ' ' || diagstate.p3d.packet[i] >= 0x80) + cp += sprintf(cp, "."); + else + cp += sprintf(cp, "%c", diagstate.p3d.packet[i]); + } + cp += sprintf(cp, "\n\n"); + view = GTK_TEXT_VIEW(g_object_get_data(G_OBJECT(receivewindow), "packettext")); + model = gtk_text_view_get_buffer(GTK_TEXT_VIEW(view)); + gtk_text_buffer_insert_at_cursor(model, buf, cp-buf); + i = gtk_text_buffer_get_char_count(model); + if (i > 16384) { + GtkTextIter start, end; + gchar *text; + + gtk_text_buffer_get_iter_at_offset(model, &start, 16384); + gtk_text_buffer_get_iter_at_offset(model, &end, -1); + text = gtk_text_buffer_get_text(model, &start, &end, TRUE); + gtk_text_buffer_set_text(model, text, -1); + g_free(text); + } + gtk_text_view_scroll_mark_onscreen(view, gtk_text_buffer_get_insert(model)); + /* decode cooked packet if CRC ok or passall selected */ + if (!diagstate.p3d.crc || + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(g_object_get_data(G_OBJECT(p3dwindow), "buttonpassall")))) { + + } + } +} + +static void update_display(void) +{ + GtkWidget *w; + gboolean b; + unsigned int c0, c1; + char buf[64]; + unsigned char ch; + + if (diagstate.upddcd) { + setled(GTK_IMAGE(g_object_get_data(G_OBJECT(receivewindow), "leddcd")), diagstate.dcd); + setled(GTK_IMAGE(g_object_get_data(G_OBJECT(scopewindow), "leddcd")), diagstate.dcd); + setled(GTK_IMAGE(g_object_get_data(G_OBJECT(specwindow), "leddcd")), diagstate.dcd); + diagstate.upddcd = 0; + } + if (diagstate.updptt) { + b = diagstate.ptt ? TRUE : FALSE; + w = GTK_WIDGET(g_object_get_data(G_OBJECT(receivewindow), "ptt")); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), b); + w = GTK_WIDGET(g_object_get_data(G_OBJECT(scopewindow), "ptt")); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), b); + w = GTK_WIDGET(g_object_get_data(G_OBJECT(specwindow), "ptt")); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), b); + diagstate.updptt = 0; + } + if (diagstate.updpttthr) { + setled(GTK_IMAGE(g_object_get_data(G_OBJECT(receivewindow), "ledptt")), diagstate.pttthr); + setled(GTK_IMAGE(g_object_get_data(G_OBJECT(scopewindow), "ledptt")), diagstate.pttthr); + setled(GTK_IMAGE(g_object_get_data(G_OBJECT(specwindow), "ledptt")), diagstate.pttthr); + diagstate.updpttthr = 0; + } + if (diagstate.rxrd != diagstate.rxwr) { + GtkTextView *view; + GtkTextBuffer *model; + + view = GTK_TEXT_VIEW(g_object_get_data(G_OBJECT(receivewindow), "bitstext")); + model = gtk_text_view_get_buffer(GTK_TEXT_VIEW(view)); + while (diagstate.rxrd != diagstate.rxwr) { + ch = diagstate.rxbuf[diagstate.rxrd]; + diagstate.rxrd = (diagstate.rxrd + 1) % sizeof(diagstate.rxbuf); + hdlc_receive(&ch, 1); + c0 = hweight8(ch); + diagstate.count0 += 8-c0; + diagstate.count1 += c0; + buf[0] = '0'+(ch & 1); + buf[1] = '0'+((ch >> 1) & 1); + buf[2] = '0'+((ch >> 2) & 1); + buf[3] = '0'+((ch >> 3) & 1); + buf[4] = '0'+((ch >> 4) & 1); + buf[5] = '0'+((ch >> 5) & 1); + buf[6] = '0'+((ch >> 6) & 1); + buf[7] = '0'+((ch >> 7) & 1); + gtk_text_buffer_insert_at_cursor(model, buf, 8); + } + c0 = gtk_text_buffer_get_char_count(model); + if (c0 > 2048) { + GtkTextIter start, end; + gchar *text; + + gtk_text_buffer_get_iter_at_offset(model, &start, 2048); + gtk_text_buffer_get_iter_at_offset(model, &end, -1); + text = gtk_text_buffer_get_text(model, &start, &end, TRUE); + gtk_text_buffer_set_text(model, text, -1); + g_free(text); + } + gtk_text_view_scroll_mark_onscreen(view, gtk_text_buffer_get_insert(model)); + diagstate.updcount = 1; + } + if (diagstate.updcount) { + c0 = diagstate.count0; + c1 = diagstate.count1; + diagstate.updcount = 0; + sprintf(buf, "%d", c0); + w = GTK_WIDGET(g_object_get_data(G_OBJECT(receivewindow), "count0")); + gtk_entry_set_text(GTK_ENTRY(w), buf); + sprintf(buf, "%d", c1); + w = GTK_WIDGET(g_object_get_data(G_OBJECT(receivewindow), "count1")); + gtk_entry_set_text(GTK_ENTRY(w), buf); + sprintf(buf, "%d", c0+c1); + w = GTK_WIDGET(g_object_get_data(G_OBJECT(receivewindow), "counttot")); + gtk_entry_set_text(GTK_ENTRY(w), buf); + } + update_display_p3d(); +} + +static gint periodictasks(gpointer user_data) +{ + int16_t samp[SPECTRUM_NUMSAMPLES]; + + update_display(); + diagstate.traceupd++; + if (diagstate.traceupd > 1) + diagstate.traceupd = 0; + if (diagstate.traceupd || (diagstate.dcdfreeze && !diagstate.dcd) || !(diagstate.flags & (DIAGFLG_SCOPE|DIAGFLG_SPECTRUM)) || + !diagstate.audioio->read || !diagstate.audioio->curtime) + return TRUE; /* repeat */ + diagstate.audioio->read(diagstate.audioio, samp, SPECTRUM_NUMSAMPLES, diagstate.audioio->curtime(diagstate.audioio)-SPECTRUM_NUMSAMPLES); + if (diagstate.flags & DIAGFLG_SCOPE) { + Scope *scope = SCOPE(g_object_get_data(G_OBJECT(scopewindow), "scope")); + scope_setdata(scope, &samp[SPECTRUM_NUMSAMPLES-SCOPE_NUMSAMPLES]); + } + if (diagstate.flags & DIAGFLG_SPECTRUM) { + Spectrum *spec = SPECTRUM(g_object_get_data(G_OBJECT(specwindow), "spec")); + spectrum_setdata(spec, samp); + } + return TRUE; /* repeat */ +} + +/* ---------------------------------------------------------------------- */ + +void diag_stop(void) +{ + if (!(diagstate.flags & DIAGFLG_MODEM)) { + diagstate.flags = 0; + return; + } + g_source_remove(diagstate.timeoutid); +#ifdef TXTERMNOCANCEL + diagstate.txterminate = 1; + pthread_cond_broadcast(&diagstate.txcond); +#else + pthread_cancel(diagstate.txthread); +#endif +#if 0 + pthread_cancel(diagstate.rxthread); +#else + if (diagstate.audioio->terminateread) + diagstate.audioio->terminateread(diagstate.audioio); +#endif + g_printerr("Joining TxThread\n"); + pthread_join(diagstate.txthread, NULL); + g_printerr("Joining RxThread\n"); + pthread_join(diagstate.rxthread, NULL); + g_printerr("Releasing IO\n"); + diagstate.audioio->release(diagstate.audioio); + if (diagstate.modch->free) + diagstate.modch->free(diagstate.modstate); + if (diagstate.demodch->free) + diagstate.demodch->free(diagstate.demodstate); + pttsetptt(&diagstate.pttio, 0); + pttrelease(&diagstate.pttio); + diagstate.flags = 0; + diagstate.ptt = 0; + diagstate.pttthr = 0; + diagstate.updptt = 1; + diagstate.updpttthr = 1; +} + +#define MAX_PAR 10 + +static void getparam(const char *cfgname, const char *chname, const char *typname, + const struct modemparams *par, const char *parptr[MAX_PAR], char params[MAX_PAR][64]) +{ + unsigned int i; + + memset(parptr, 0, sizeof(parptr)); + for (i = 0; i < MAX_PAR && par->name; i++, par++) + if (xml_getprop(cfgname, chname, typname, par->name, params[i], sizeof(params[i])) > 0) + parptr[i] = params[i]; +} + +static int diag_start(void) +{ + struct modulator *modch = &modchain_x; + struct demodulator *demodch = &demodchain_x; + char params[MAX_PAR][64]; + const char *parptr[MAX_PAR]; + unsigned int i; + + if (diagstate.flags & DIAGFLG_MODEM) + return 0; + pthread_mutex_init(&diagstate.txmutex, NULL); + pthread_cond_init(&diagstate.txcond, NULL); +#ifdef TXTERMNOCANCEL + diagstate.txterminate = 0; +#endif + /* get current config/channel name */ + diagstate.cfgname = diagstate.chname = NULL; + diagstate.cfgname = g_object_get_data(G_OBJECT(configmodel), "cfgname"); + diagstate.chname = g_object_get_data(G_OBJECT(configmodel), "chname"); + if (!diagstate.cfgname || !diagstate.chname) { + g_printerr("diag activate: no channel selected\n"); + return -1; + } + /* search current modulator/demodulator */ + if (xml_getprop(diagstate.cfgname, diagstate.chname, "mod", "mode", params[0], sizeof(params[0])) > 0) { + for (; modch && strcmp(modch->name, params[0]); modch = modch->next); + } + if (modch) + diagstate.modch = modch; + else + diagstate.modch = &modchain_x; + if (xml_getprop(diagstate.cfgname, diagstate.chname, "demod", "mode", params[0], sizeof(params[0])) > 0) { + for (; demodch && strcmp(demodch->name, params[0]); demodch = demodch->next); + } + if (demodch) + diagstate.demodch = demodch; + else + diagstate.demodch = &demodchain_x; + g_print("Modulator: %s Demodulator: %s\n", diagstate.modch->name, diagstate.demodch->name); + /* prepare modulator/demodulator and find minimum sampling rate */ + diagstate.samplerate = 5000; + if (diagstate.modch->params && diagstate.modch->config) { + getparam(diagstate.cfgname, diagstate.chname, "mod", diagstate.modch->params, parptr, params); + for (i = 0; i < MAX_PAR && diagstate.modch->params[i].name; i++) + g_print("Modulator: parameter %s value %s\n", + diagstate.modch->params[i].name, parptr[i] ? : "(null)"); + i = diagstate.samplerate; + diagstate.modstate = diagstate.modch->config(NULL, &i, parptr); + if (i > diagstate.samplerate) + diagstate.samplerate = i; + } + if (diagstate.demodch->params && diagstate.demodch->config) { + getparam(diagstate.cfgname, diagstate.chname, "demod", diagstate.demodch->params, parptr, params); + for (i = 0; i < MAX_PAR && diagstate.demodch->params[i].name; i++) + g_print("Demodulator: parameter %s value %s\n", + diagstate.demodch->params[i].name, parptr[i] ? : "(null)"); + i = diagstate.samplerate; + diagstate.demodstate = diagstate.demodch->config(NULL, &i, parptr); + if (i > diagstate.samplerate) + diagstate.samplerate = i; + } + g_print("Minimum sampling rate: %u\n", diagstate.samplerate); + /* start Audio */ + getparam(diagstate.cfgname, NULL, "audio", ioparam_type, parptr, params); + g_print("Audio IO: type %s\n", parptr[0] ? : "(null)"); + if (parptr[0] && !strcmp(parptr[0], ioparam_type[0].u.c.combostr[1])) { + getparam(diagstate.cfgname, NULL, "audio", ioparams_filein, parptr, params); + diagstate.audioio = ioopen_filein(&diagstate.samplerate, IO_RDONLY, parptr); + } else if (parptr[0] && !strcmp(parptr[0], ioparam_type[0].u.c.combostr[2])) { + getparam(diagstate.cfgname, NULL, "audio", ioparams_sim, parptr, params); + diagstate.audioio = ioopen_sim(&diagstate.samplerate, IO_RDWR, parptr); +#ifdef HAVE_ALSA + } else if (parptr[0] && !strcmp(parptr[0], ioparam_type[0].u.c.combostr[3])) { + getparam(diagstate.cfgname, NULL, "audio", ioparams_alsasoundcard, parptr, params); + diagstate.audioio = ioopen_alsasoundcard(&diagstate.samplerate, diagstate.modch->modulate ? IO_RDWR : IO_RDONLY, parptr); +#endif /* HAVE_ALSA */ + } else { + getparam(diagstate.cfgname, NULL, "audio", ioparams_soundcard, parptr, params); + diagstate.audioio = ioopen_soundcard(&diagstate.samplerate, diagstate.modch->modulate ? IO_RDWR : IO_RDONLY, parptr); + } + if (!diagstate.audioio) { + if (diagstate.modch->free) + diagstate.modch->free(diagstate.modstate); + if (diagstate.demodch->free) + diagstate.demodch->free(diagstate.demodstate); + error_dialog("Cannot start audio IO\n"); + return -1; + } + /* start modems */ + g_print("Real sampling rate: %u\n", diagstate.samplerate); + if (diagstate.modch->init) + diagstate.modch->init(diagstate.modstate, diagstate.samplerate); + if (diagstate.demodch->init) + diagstate.demodch->init(diagstate.demodstate, diagstate.samplerate, &diagstate.bitrate); + /* start PTT */ + getparam(diagstate.cfgname, NULL, "ptt", pttparams, parptr, params); + if (pttinit(&diagstate.pttio, parptr)) + g_printerr("cannot start PTT output\n"); + /* periodic start */ + diagstate.timeoutid = g_timeout_add(100, periodictasks, NULL); + diagstate.flags |= DIAGFLG_MODEM; + if (pthread_create(&diagstate.rxthread, NULL, receiver, NULL)) + logerr(MLOG_FATAL, "pthread_create"); + if (pthread_create(&diagstate.txthread, NULL, transmitter, NULL)) + logerr(MLOG_FATAL, "pthread_create"); + return 0; +} + +/* ---------------------------------------------------------------------- */ + +void on_diagscope_activate(GtkMenuItem *menuitem, gpointer user_data) +{ + if (diag_start()) + return; + diagstate.flags |= DIAGFLG_SCOPE; + gtk_widget_show(scopewindow); +} + +void on_diagspectrum_activate(GtkMenuItem *menuitem, gpointer user_data) +{ + if (diag_start()) + return; + diagstate.flags |= DIAGFLG_SPECTRUM; + gtk_widget_show(specwindow); +} + +void on_diagmodem_activate(GtkMenuItem *menuitem, gpointer user_data) +{ + if (diag_start()) + return; + diagstate.flags |= DIAGFLG_RECEIVE; + gtk_widget_show(receivewindow); +} + +void on_diagp3dmodem_activate(GtkMenuItem *menuitem, gpointer user_data) +{ + if (diag_start()) + return; + diagstate.flags |= DIAGFLG_P3DRECEIVE; + gtk_widget_show(p3dwindow); +} + +void on_diagpassall_activate(GtkMenuItem *menuitem, gpointer user_data) +{ + GtkCheckMenuItem *citem = GTK_CHECK_MENU_ITEM(menuitem); + printf("passall: %u\n", gtk_check_menu_item_get_active(citem)); + diagstate.hrx.passall = gtk_check_menu_item_get_active(citem); +} + +/* ---------------------------------------------------------------------- */ + +void on_ptt_toggled(GtkToggleButton *togglebutton, gpointer user_data) +{ + diagstate.ptt = gtk_toggle_button_get_active(togglebutton) ? 1 : 0; + diagstate.updptt = 1; + pthread_cond_broadcast(&diagstate.txcond); +} + +void on_clearbutton_clicked(GtkButton *button, gpointer user_data) +{ + diagstate.count0 = diagstate.count1 = 0; + diagstate.updcount = 1; + update_display(); +} + +gboolean on_spec_motion_event(GtkWidget *widget, GdkEventMotion *event, gpointer user_data) +{ + Spectrum *spec; + GtkEntry *entry; + char buf[16]; + + snprintf(buf, sizeof(buf), "%d Hz", (int)(event->x * diagstate.samplerate * (1.0 / SPECTRUM_NUMSAMPLES))); + entry = GTK_ENTRY(g_object_get_data(G_OBJECT(specwindow), "specfreqpointer")); + gtk_entry_set_text(entry, buf); + spec = SPECTRUM(g_object_get_data(G_OBJECT(specwindow), "spec")); + spectrum_setmarker(spec, event->x); + return FALSE; +} + +gboolean on_specwindow_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) +{ + diagstate.flags &= ~DIAGFLG_SPECTRUM; + gtk_widget_hide(specwindow); + if (!(diagstate.flags & DIAGFLG_WINDOWMASK)) + diag_stop(); + return TRUE; +} + +gboolean on_scopewindow_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) +{ + diagstate.flags &= ~DIAGFLG_SCOPE; + gtk_widget_hide(scopewindow); + if (!(diagstate.flags & DIAGFLG_WINDOWMASK)) + diag_stop(); + return TRUE; +} + +void on_dcdfreeze_toggled(GtkToggleButton *togglebutton, gpointer user_data) +{ + diagstate.dcdfreeze = gtk_toggle_button_get_active(togglebutton); +} + +gboolean on_receivewindow_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) +{ + diagstate.flags &= ~DIAGFLG_RECEIVE; + gtk_widget_hide(receivewindow); + if (!(diagstate.flags & DIAGFLG_WINDOWMASK)) + diag_stop(); + return TRUE; +} + +gboolean on_p3dwindow_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) +{ + diagstate.flags &= ~DIAGFLG_P3DRECEIVE; + gtk_widget_hide(p3dwindow); + if (!(diagstate.flags & DIAGFLG_WINDOWMASK)) + diag_stop(); + return TRUE; +} diff --git a/configapp/src/interface.c b/configapp/src/interface.c new file mode 100644 index 0000000..29916e2 --- /dev/null +++ b/configapp/src/interface.c @@ -0,0 +1,1089 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include + +#include +#include + +#include "callbacks.h" +#include "spectrum.h" +#include "scope.h" +#include "interface.h" +#include "support.h" +#include "snm-compat-gtk2.h" + +#define GLADE_HOOKUP_OBJECT(component,widget,name) \ + g_object_set_data_full (G_OBJECT (component), name, \ + g_object_ref (widget), (GDestroyNotify) g_object_unref) + +#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \ + g_object_set_data (G_OBJECT (component), name, widget) + +GtkWidget* +create_mainwindow (void) +{ + GtkWidget *mainwindow; + GtkWidget *vbox1; + GtkWidget *handlebox1; + GtkWidget *menubar1; + GtkWidget *file; + GtkWidget *file_menu; + GtkWidget *new; + GtkWidget *new_menu; + GtkWidget *newconfiguration; + GtkWidget *newchannel; + GtkWidget *delete; + GtkWidget *delete_menu; + GtkWidget *deleteconfiguration; + GtkWidget *deletechannel; + GtkWidget *separator1; + GtkWidget *quit; + GtkWidget *diagnostics; + GtkWidget *diagnostics_menu; + GtkWidget *diagscope; + GtkWidget *diagspectrum; + GtkWidget *diagmodem; + GtkWidget *diagp3dmodem; + GtkWidget *diagpassall; + GtkWidget *help; + GtkWidget *help_menu; + GtkWidget *about; + GtkWidget *configbox; + GtkWidget *scrolledwindow1; + GtkWidget *viewport1; + GtkWidget *configtree; + GtkWidget *vbox3; + GtkWidget *confignotebook; + GtkWidget *empty_notebook_page; + GtkWidget *label32; + GtkWidget *label33; + GtkWidget *statusbar1; + + mainwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (mainwindow), _("SoundModem Configurator")); + gtk_window_set_default_size (GTK_WINDOW (mainwindow), 550, 330); + + vbox1 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox1); + gtk_container_add (GTK_CONTAINER (mainwindow), vbox1); + + handlebox1 = gtk_handle_box_new (); + gtk_widget_show (handlebox1); + gtk_box_pack_start (GTK_BOX (vbox1), handlebox1, FALSE, TRUE, 0); + + menubar1 = gtk_menu_bar_new (); + gtk_widget_show (menubar1); + gtk_container_add (GTK_CONTAINER (handlebox1), menubar1); + + file = gtk_menu_item_new_with_mnemonic (_("File")); + gtk_widget_show (file); + gtk_container_add (GTK_CONTAINER (menubar1), file); + + file_menu = gtk_menu_new (); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (file), file_menu); + + new = gtk_menu_item_new_with_mnemonic (_("New")); + gtk_widget_show (new); + gtk_container_add (GTK_CONTAINER (file_menu), new); + + new_menu = gtk_menu_new (); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (new), new_menu); + + newconfiguration = gtk_menu_item_new_with_mnemonic (_("Configuration")); + gtk_widget_show (newconfiguration); + gtk_container_add (GTK_CONTAINER (new_menu), newconfiguration); + + newchannel = gtk_menu_item_new_with_mnemonic (_("Channel")); + gtk_widget_show (newchannel); + gtk_container_add (GTK_CONTAINER (new_menu), newchannel); + + delete = gtk_menu_item_new_with_mnemonic (_("Delete")); + gtk_widget_show (delete); + gtk_container_add (GTK_CONTAINER (file_menu), delete); + + delete_menu = gtk_menu_new (); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (delete), delete_menu); + + deleteconfiguration = gtk_menu_item_new_with_mnemonic (_("Configuration")); + gtk_widget_show (deleteconfiguration); + gtk_container_add (GTK_CONTAINER (delete_menu), deleteconfiguration); + + deletechannel = gtk_menu_item_new_with_mnemonic (_("Channel")); + gtk_widget_show (deletechannel); + gtk_container_add (GTK_CONTAINER (delete_menu), deletechannel); + + separator1 = gtk_menu_item_new (); + gtk_widget_show (separator1); + gtk_container_add (GTK_CONTAINER (file_menu), separator1); + gtk_widget_set_sensitive (separator1, FALSE); + + quit = gtk_menu_item_new_with_mnemonic (_("Quit")); + gtk_widget_show (quit); + gtk_container_add (GTK_CONTAINER (file_menu), quit); + + diagnostics = gtk_menu_item_new_with_mnemonic (_("Diagnostics")); + gtk_widget_show (diagnostics); + gtk_container_add (GTK_CONTAINER (menubar1), diagnostics); + + diagnostics_menu = gtk_menu_new (); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (diagnostics), diagnostics_menu); + + diagscope = gtk_menu_item_new_with_mnemonic (_("Scope")); + gtk_widget_show (diagscope); + gtk_container_add (GTK_CONTAINER (diagnostics_menu), diagscope); + + diagspectrum = gtk_menu_item_new_with_mnemonic (_("Spectrum")); + gtk_widget_show (diagspectrum); + gtk_container_add (GTK_CONTAINER (diagnostics_menu), diagspectrum); + + diagmodem = gtk_menu_item_new_with_mnemonic (_("Modem")); + gtk_widget_show (diagmodem); + gtk_container_add (GTK_CONTAINER (diagnostics_menu), diagmodem); + + diagp3dmodem = gtk_menu_item_new_with_mnemonic (_("AO-40 P3D Modem")); + gtk_widget_show (diagp3dmodem); + gtk_container_add (GTK_CONTAINER (diagnostics_menu), diagp3dmodem); + + diagpassall = gtk_check_menu_item_new_with_mnemonic (_("PASSALL (do not check CRC)")); + gtk_widget_show (diagpassall); + gtk_container_add (GTK_CONTAINER (diagnostics_menu), diagpassall); + + help = gtk_menu_item_new_with_mnemonic (_("Help")); + gtk_widget_show (help); + gtk_container_add (GTK_CONTAINER (menubar1), help); + + help_menu = gtk_menu_new (); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (help), help_menu); + + about = gtk_menu_item_new_with_mnemonic (_("About")); + gtk_widget_show (about); + gtk_container_add (GTK_CONTAINER (help_menu), about); + + configbox = gtk_hbox_new (FALSE, 0); + gtk_widget_show (configbox); + gtk_box_pack_start (GTK_BOX (vbox1), configbox, TRUE, TRUE, 0); + + scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_show (scrolledwindow1); + gtk_box_pack_start (GTK_BOX (configbox), scrolledwindow1, TRUE, TRUE, 0); + gtk_widget_set_can_focus (scrolledwindow1, FALSE); + + viewport1 = gtk_viewport_new (NULL, NULL); + gtk_widget_show (viewport1); + gtk_container_add (GTK_CONTAINER (scrolledwindow1), viewport1); + + configtree = gtk_tree_view_new (); + gtk_widget_show (configtree); + gtk_container_add (GTK_CONTAINER (viewport1), configtree); + gtk_widget_set_can_focus (configtree, FALSE); + + vbox3 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox3); + gtk_box_pack_start (GTK_BOX (configbox), vbox3, TRUE, TRUE, 0); + + confignotebook = gtk_notebook_new (); + gtk_widget_show (confignotebook); + gtk_box_pack_start (GTK_BOX (vbox3), confignotebook, TRUE, TRUE, 0); + + empty_notebook_page = gtk_vbox_new (FALSE, 0); + gtk_widget_show (empty_notebook_page); + gtk_container_add (GTK_CONTAINER (confignotebook), empty_notebook_page); + + label32 = gtk_label_new (""); + gtk_widget_show (label32); + gtk_notebook_set_tab_label (GTK_NOTEBOOK (confignotebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (confignotebook), 0), label32); + + empty_notebook_page = gtk_vbox_new (FALSE, 0); + gtk_widget_show (empty_notebook_page); + gtk_container_add (GTK_CONTAINER (confignotebook), empty_notebook_page); + + label33 = gtk_label_new (""); + gtk_widget_show (label33); + gtk_notebook_set_tab_label (GTK_NOTEBOOK (confignotebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (confignotebook), 1), label33); + + statusbar1 = gtk_statusbar_new (); + gtk_widget_show (statusbar1); + gtk_box_pack_start (GTK_BOX (vbox1), statusbar1, FALSE, FALSE, 0); + + g_signal_connect ((gpointer) mainwindow, "destroy_event", + G_CALLBACK (on_mainwindow_destroy_event), + NULL); + g_signal_connect ((gpointer) mainwindow, "delete_event", + G_CALLBACK (on_mainwindow_delete_event), + NULL); + g_signal_connect ((gpointer) newconfiguration, "activate", + G_CALLBACK (on_newconfiguration_activate), + NULL); + g_signal_connect ((gpointer) newchannel, "activate", + G_CALLBACK (on_newchannel_activate), + NULL); + g_signal_connect ((gpointer) deleteconfiguration, "activate", + G_CALLBACK (on_deleteconfiguration_activate), + NULL); + g_signal_connect ((gpointer) deletechannel, "activate", + G_CALLBACK (on_deletechannel_activate), + NULL); + g_signal_connect ((gpointer) quit, "activate", + G_CALLBACK (on_quit_activate), + NULL); + g_signal_connect ((gpointer) diagscope, "activate", + G_CALLBACK (on_diagscope_activate), + NULL); + g_signal_connect ((gpointer) diagspectrum, "activate", + G_CALLBACK (on_diagspectrum_activate), + NULL); + g_signal_connect ((gpointer) diagmodem, "activate", + G_CALLBACK (on_diagmodem_activate), + NULL); + g_signal_connect ((gpointer) diagp3dmodem, "activate", + G_CALLBACK (on_diagp3dmodem_activate), + NULL); + g_signal_connect ((gpointer) diagpassall, "activate", + G_CALLBACK (on_diagpassall_activate), + NULL); + g_signal_connect ((gpointer) about, "activate", + G_CALLBACK (on_about_activate), + NULL); + + /* Store pointers to all widgets, for use by lookup_widget(). */ + GLADE_HOOKUP_OBJECT_NO_REF (mainwindow, mainwindow, "mainwindow"); + GLADE_HOOKUP_OBJECT (mainwindow, vbox1, "vbox1"); + GLADE_HOOKUP_OBJECT (mainwindow, handlebox1, "handlebox1"); + GLADE_HOOKUP_OBJECT (mainwindow, menubar1, "menubar1"); + GLADE_HOOKUP_OBJECT (mainwindow, file, "file"); + GLADE_HOOKUP_OBJECT (mainwindow, file_menu, "file_menu"); + GLADE_HOOKUP_OBJECT (mainwindow, new, "new"); + GLADE_HOOKUP_OBJECT (mainwindow, new_menu, "new_menu"); + GLADE_HOOKUP_OBJECT (mainwindow, newconfiguration, "newconfiguration"); + GLADE_HOOKUP_OBJECT (mainwindow, newchannel, "newchannel"); + GLADE_HOOKUP_OBJECT (mainwindow, delete, "delete"); + GLADE_HOOKUP_OBJECT (mainwindow, delete_menu, "delete_menu"); + GLADE_HOOKUP_OBJECT (mainwindow, deleteconfiguration, "deleteconfiguration"); + GLADE_HOOKUP_OBJECT (mainwindow, deletechannel, "deletechannel"); + GLADE_HOOKUP_OBJECT (mainwindow, separator1, "separator1"); + GLADE_HOOKUP_OBJECT (mainwindow, quit, "quit"); + GLADE_HOOKUP_OBJECT (mainwindow, diagnostics, "diagnostics"); + GLADE_HOOKUP_OBJECT (mainwindow, diagnostics_menu, "diagnostics_menu"); + GLADE_HOOKUP_OBJECT (mainwindow, diagscope, "diagscope"); + GLADE_HOOKUP_OBJECT (mainwindow, diagspectrum, "diagspectrum"); + GLADE_HOOKUP_OBJECT (mainwindow, diagmodem, "diagmodem"); + GLADE_HOOKUP_OBJECT (mainwindow, diagp3dmodem, "diagp3dmodem"); + GLADE_HOOKUP_OBJECT (mainwindow, diagpassall, "diagpassall"); + GLADE_HOOKUP_OBJECT (mainwindow, help, "help"); + GLADE_HOOKUP_OBJECT (mainwindow, help_menu, "help_menu"); + GLADE_HOOKUP_OBJECT (mainwindow, about, "about"); + GLADE_HOOKUP_OBJECT (mainwindow, configbox, "configbox"); + GLADE_HOOKUP_OBJECT (mainwindow, scrolledwindow1, "scrolledwindow1"); + GLADE_HOOKUP_OBJECT (mainwindow, viewport1, "viewport1"); + GLADE_HOOKUP_OBJECT (mainwindow, configtree, "configtree"); + GLADE_HOOKUP_OBJECT (mainwindow, vbox3, "vbox3"); + GLADE_HOOKUP_OBJECT (mainwindow, confignotebook, "confignotebook"); + GLADE_HOOKUP_OBJECT (mainwindow, label32, "label32"); + GLADE_HOOKUP_OBJECT (mainwindow, label33, "label33"); + GLADE_HOOKUP_OBJECT (mainwindow, statusbar1, "statusbar1"); + + return mainwindow; +} + +GtkWidget* +create_aboutwindow (void) +{ + GtkWidget *aboutwindow; + GtkWidget *dialog_vbox1; + GtkWidget *frame1; + GtkWidget *vbox4; + GtkWidget *label13; + GtkWidget *label14; + GtkWidget *label1; + GtkWidget *dialog_action_area1; + GtkWidget *hbuttonbox1; + GtkWidget *aboutok; + + aboutwindow = gtk_dialog_new (); + gtk_window_set_title (GTK_WINDOW (aboutwindow), _("About SoundModem Configurator")); + gtk_window_set_type_hint (GTK_WINDOW (aboutwindow), GDK_WINDOW_TYPE_HINT_DIALOG); + + dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG (aboutwindow)); + gtk_widget_show (dialog_vbox1); + + frame1 = gtk_frame_new (NULL); + gtk_widget_show (frame1); + gtk_box_pack_start (GTK_BOX (dialog_vbox1), frame1, TRUE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (frame1), 6); + gtk_frame_set_label_align (GTK_FRAME (frame1), 0.5, 0.5); + + vbox4 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox4); + gtk_container_add (GTK_CONTAINER (frame1), vbox4); + + label13 = gtk_label_new (_("Copyright 2000")); + gtk_widget_show (label13); + gtk_box_pack_start (GTK_BOX (vbox4), label13, TRUE, TRUE, 0); + gtk_label_set_justify (GTK_LABEL (label13), GTK_JUSTIFY_CENTER); + + label14 = gtk_label_new (_("Thomas Sailer")); + gtk_widget_show (label14); + gtk_box_pack_start (GTK_BOX (vbox4), label14, TRUE, TRUE, 0); + gtk_label_set_justify (GTK_LABEL (label14), GTK_JUSTIFY_CENTER); + + label1 = gtk_label_new (_("SoundModem Configurator")); + gtk_widget_show (label1); + gtk_frame_set_label_widget (GTK_FRAME (frame1), label1); + + dialog_action_area1 = gtk_dialog_get_action_area (GTK_DIALOG (aboutwindow)); + gtk_widget_show (dialog_action_area1); + gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END); + + hbuttonbox1 = gtk_hbutton_box_new (); + gtk_widget_show (hbuttonbox1); + gtk_container_add (GTK_CONTAINER (dialog_action_area1), hbuttonbox1); + gtk_box_set_spacing (GTK_BOX (hbuttonbox1), 30); + + aboutok = gtk_button_new_with_mnemonic (_("Ok")); + gtk_widget_show (aboutok); + gtk_container_add (GTK_CONTAINER (hbuttonbox1), aboutok); + gtk_widget_set_can_default (aboutok, TRUE); + + /* Store pointers to all widgets, for use by lookup_widget(). */ + GLADE_HOOKUP_OBJECT_NO_REF (aboutwindow, aboutwindow, "aboutwindow"); + GLADE_HOOKUP_OBJECT_NO_REF (aboutwindow, dialog_vbox1, "dialog_vbox1"); + GLADE_HOOKUP_OBJECT (aboutwindow, frame1, "frame1"); + GLADE_HOOKUP_OBJECT (aboutwindow, vbox4, "vbox4"); + GLADE_HOOKUP_OBJECT (aboutwindow, label13, "label13"); + GLADE_HOOKUP_OBJECT (aboutwindow, label14, "label14"); + GLADE_HOOKUP_OBJECT (aboutwindow, label1, "label1"); + GLADE_HOOKUP_OBJECT_NO_REF (aboutwindow, dialog_action_area1, "dialog_action_area1"); + GLADE_HOOKUP_OBJECT (aboutwindow, hbuttonbox1, "hbuttonbox1"); + GLADE_HOOKUP_OBJECT (aboutwindow, aboutok, "aboutok"); + + return aboutwindow; +} + +GtkWidget* +create_newconfigwindow (void) +{ + GtkWidget *newconfigwindow; + GtkWidget *dialog_vbox2; + GtkWidget *hbox2; + GtkWidget *label15; + GtkWidget *newconfigentry; + GtkWidget *dialog_action_area2; + GtkWidget *hbuttonbox2; + GtkWidget *newconfigcancel; + GtkWidget *newconfigok; + GtkAccelGroup *accel_group; + + accel_group = gtk_accel_group_new (); + + newconfigwindow = gtk_dialog_new (); + gtk_window_set_title (GTK_WINDOW (newconfigwindow), _("New Configuration")); + gtk_window_set_type_hint (GTK_WINDOW (newconfigwindow), GDK_WINDOW_TYPE_HINT_DIALOG); + + dialog_vbox2 = gtk_dialog_get_content_area (GTK_DIALOG (newconfigwindow)); + gtk_widget_show (dialog_vbox2); + + hbox2 = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox2); + gtk_box_pack_start (GTK_BOX (dialog_vbox2), hbox2, TRUE, TRUE, 0); + + label15 = gtk_label_new (_("Configuration Name")); + gtk_widget_show (label15); + gtk_box_pack_start (GTK_BOX (hbox2), label15, FALSE, TRUE, 0); + gtk_label_set_justify (GTK_LABEL (label15), GTK_JUSTIFY_CENTER); + gtk_misc_set_padding (GTK_MISC (label15), 6, 6); + + newconfigentry = gtk_entry_new (); + gtk_widget_show (newconfigentry); + gtk_box_pack_start (GTK_BOX (hbox2), newconfigentry, TRUE, TRUE, 6); + gtk_entry_set_invisible_char (GTK_ENTRY (newconfigentry), 9679); + + dialog_action_area2 = gtk_dialog_get_action_area (GTK_DIALOG (newconfigwindow)); + gtk_widget_show (dialog_action_area2); + gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area2), GTK_BUTTONBOX_END); + + hbuttonbox2 = gtk_hbutton_box_new (); + gtk_widget_show (hbuttonbox2); + gtk_container_add (GTK_CONTAINER (dialog_action_area2), hbuttonbox2); + gtk_box_set_spacing (GTK_BOX (hbuttonbox2), 30); + + newconfigcancel = gtk_button_new_with_mnemonic (_("Cancel")); + gtk_widget_show (newconfigcancel); + gtk_container_add (GTK_CONTAINER (hbuttonbox2), newconfigcancel); + gtk_widget_set_can_default (newconfigcancel, TRUE); + gtk_widget_add_accelerator (newconfigcancel, "clicked", accel_group, + GDK_Escape, (GdkModifierType) 0, + GTK_ACCEL_VISIBLE); + + newconfigok = gtk_button_new_with_mnemonic (_("OK")); + gtk_widget_show (newconfigok); + gtk_container_add (GTK_CONTAINER (hbuttonbox2), newconfigok); + gtk_widget_set_can_default (newconfigok, TRUE); + gtk_widget_add_accelerator (newconfigok, "clicked", accel_group, + GDK_Return, (GdkModifierType) 0, + GTK_ACCEL_VISIBLE); + + /* Store pointers to all widgets, for use by lookup_widget(). */ + GLADE_HOOKUP_OBJECT_NO_REF (newconfigwindow, newconfigwindow, "newconfigwindow"); + GLADE_HOOKUP_OBJECT_NO_REF (newconfigwindow, dialog_vbox2, "dialog_vbox2"); + GLADE_HOOKUP_OBJECT (newconfigwindow, hbox2, "hbox2"); + GLADE_HOOKUP_OBJECT (newconfigwindow, label15, "label15"); + GLADE_HOOKUP_OBJECT (newconfigwindow, newconfigentry, "newconfigentry"); + GLADE_HOOKUP_OBJECT_NO_REF (newconfigwindow, dialog_action_area2, "dialog_action_area2"); + GLADE_HOOKUP_OBJECT (newconfigwindow, hbuttonbox2, "hbuttonbox2"); + GLADE_HOOKUP_OBJECT (newconfigwindow, newconfigcancel, "newconfigcancel"); + GLADE_HOOKUP_OBJECT (newconfigwindow, newconfigok, "newconfigok"); + + gtk_window_add_accel_group (GTK_WINDOW (newconfigwindow), accel_group); + + return newconfigwindow; +} + +GtkWidget* +create_errordialog (void) +{ + GtkWidget *errordialog; + GtkWidget *dialog_vbox3; + GtkWidget *errorlabel; + GtkWidget *dialog_action_area3; + GtkWidget *hbuttonbox3; + GtkWidget *errorok; + GtkAccelGroup *accel_group; + + accel_group = gtk_accel_group_new (); + + errordialog = gtk_dialog_new (); + gtk_window_set_title (GTK_WINDOW (errordialog), _("Error")); + gtk_window_set_modal (GTK_WINDOW (errordialog), TRUE); + gtk_window_set_type_hint (GTK_WINDOW (errordialog), GDK_WINDOW_TYPE_HINT_DIALOG); + + dialog_vbox3 = gtk_dialog_get_content_area (GTK_DIALOG (errordialog)); + gtk_widget_show (dialog_vbox3); + + errorlabel = gtk_label_new (_("Error")); + gtk_widget_show (errorlabel); + gtk_box_pack_start (GTK_BOX (dialog_vbox3), errorlabel, TRUE, TRUE, 0); + gtk_label_set_justify (GTK_LABEL (errorlabel), GTK_JUSTIFY_CENTER); + gtk_label_set_line_wrap (GTK_LABEL (errorlabel), TRUE); + gtk_misc_set_padding (GTK_MISC (errorlabel), 6, 6); + + dialog_action_area3 = gtk_dialog_get_action_area (GTK_DIALOG (errordialog)); + gtk_widget_show (dialog_action_area3); + gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area3), GTK_BUTTONBOX_END); + + hbuttonbox3 = gtk_hbutton_box_new (); + gtk_widget_show (hbuttonbox3); + gtk_container_add (GTK_CONTAINER (dialog_action_area3), hbuttonbox3); + gtk_box_set_spacing (GTK_BOX (hbuttonbox3), 30); + + errorok = gtk_button_new_with_mnemonic (_("OK")); + gtk_widget_show (errorok); + gtk_container_add (GTK_CONTAINER (hbuttonbox3), errorok); + gtk_widget_set_can_default (errorok, TRUE); + gtk_widget_add_accelerator (errorok, "clicked", accel_group, + GDK_Return, (GdkModifierType) 0, + GTK_ACCEL_VISIBLE); + + /* Store pointers to all widgets, for use by lookup_widget(). */ + GLADE_HOOKUP_OBJECT_NO_REF (errordialog, errordialog, "errordialog"); + GLADE_HOOKUP_OBJECT_NO_REF (errordialog, dialog_vbox3, "dialog_vbox3"); + GLADE_HOOKUP_OBJECT (errordialog, errorlabel, "errorlabel"); + GLADE_HOOKUP_OBJECT_NO_REF (errordialog, dialog_action_area3, "dialog_action_area3"); + GLADE_HOOKUP_OBJECT (errordialog, hbuttonbox3, "hbuttonbox3"); + GLADE_HOOKUP_OBJECT (errordialog, errorok, "errorok"); + + gtk_window_add_accel_group (GTK_WINDOW (errordialog), accel_group); + + return errordialog; +} + +GtkWidget* +create_specwindow (void) +{ + GtkWidget *specwindow; + GtkWidget *vbox1; + GtkWidget *hbox1; + GtkWidget *label1; + GtkWidget *specfreqpointer; + GtkWidget *label25; + GtkWidget *ptt; + GtkWidget *label20; + GtkWidget *ledptt; + GtkWidget *label19; + GtkWidget *leddcd; + GtkWidget *frame4; + GtkWidget *spec; + GtkWidget *label26; + + specwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (specwindow), _("Spectrum Display")); + + vbox1 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox1); + gtk_container_add (GTK_CONTAINER (specwindow), vbox1); + + hbox1 = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (hbox1), 4); + + label1 = gtk_label_new (_("Pointer")); + gtk_widget_show (label1); + gtk_box_pack_start (GTK_BOX (hbox1), label1, FALSE, TRUE, 0); + gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_CENTER); + + specfreqpointer = gtk_entry_new (); + gtk_widget_show (specfreqpointer); + gtk_box_pack_start (GTK_BOX (hbox1), specfreqpointer, FALSE, TRUE, 4); + gtk_widget_set_can_focus (specfreqpointer, FALSE); + gtk_editable_set_editable (GTK_EDITABLE (specfreqpointer), FALSE); + gtk_entry_set_invisible_char (GTK_ENTRY (specfreqpointer), 9679); + + label25 = gtk_label_new (""); + gtk_widget_show (label25); + gtk_box_pack_start (GTK_BOX (hbox1), label25, TRUE, TRUE, 0); + gtk_label_set_justify (GTK_LABEL (label25), GTK_JUSTIFY_CENTER); + + ptt = gtk_toggle_button_new_with_mnemonic (_("PTT")); + gtk_widget_show (ptt); + gtk_box_pack_start (GTK_BOX (hbox1), ptt, FALSE, TRUE, 4); + gtk_widget_set_can_focus (ptt, FALSE); + + label20 = gtk_label_new (_("PTT")); + gtk_widget_show (label20); + gtk_box_pack_start (GTK_BOX (hbox1), label20, FALSE, TRUE, 0); + gtk_label_set_justify (GTK_LABEL (label20), GTK_JUSTIFY_CENTER); + gtk_misc_set_padding (GTK_MISC (label20), 7, 0); + + ledptt = create_led_pixmap ("ledptt", "", "", 0, 0); + gtk_widget_show (ledptt); + gtk_box_pack_start (GTK_BOX (hbox1), ledptt, FALSE, TRUE, 4); + gtk_widget_set_can_focus (ledptt, FALSE); + gtk_widget_set_can_default (ledptt, FALSE); + + label19 = gtk_label_new (_("DCD")); + gtk_widget_show (label19); + gtk_box_pack_start (GTK_BOX (hbox1), label19, FALSE, TRUE, 0); + gtk_label_set_justify (GTK_LABEL (label19), GTK_JUSTIFY_CENTER); + gtk_misc_set_padding (GTK_MISC (label19), 7, 0); + + leddcd = create_led_pixmap ("leddcd", "", "", 0, 0); + gtk_widget_show (leddcd); + gtk_box_pack_start (GTK_BOX (hbox1), leddcd, FALSE, TRUE, 4); + gtk_widget_set_can_focus (leddcd, FALSE); + gtk_widget_set_can_default (leddcd, FALSE); + + frame4 = gtk_frame_new (NULL); + gtk_widget_show (frame4); + gtk_box_pack_start (GTK_BOX (vbox1), frame4, FALSE, FALSE, 0); + + spec = spectrum_new ("spec", "", "", 0, 0); + gtk_widget_show (spec); + gtk_container_add (GTK_CONTAINER (frame4), spec); + gtk_widget_set_size_request (spec, 512, 384); + gtk_widget_set_can_focus (spec, TRUE); + gtk_widget_set_can_default (spec, FALSE); + gtk_widget_set_events (spec, GDK_POINTER_MOTION_MASK); + + label26 = gtk_label_new (_("Spectrum")); + gtk_widget_show (label26); + gtk_frame_set_label_widget (GTK_FRAME (frame4), label26); + + g_signal_connect ((gpointer) specwindow, "delete_event", + G_CALLBACK (on_specwindow_delete_event), + NULL); + g_signal_connect ((gpointer) ptt, "toggled", + G_CALLBACK (on_ptt_toggled), + NULL); + g_signal_connect ((gpointer) spec, "motion_notify_event", + G_CALLBACK (on_spec_motion_event), + NULL); + + /* Store pointers to all widgets, for use by lookup_widget(). */ + GLADE_HOOKUP_OBJECT_NO_REF (specwindow, specwindow, "specwindow"); + GLADE_HOOKUP_OBJECT (specwindow, vbox1, "vbox1"); + GLADE_HOOKUP_OBJECT (specwindow, hbox1, "hbox1"); + GLADE_HOOKUP_OBJECT (specwindow, label1, "label1"); + GLADE_HOOKUP_OBJECT (specwindow, specfreqpointer, "specfreqpointer"); + GLADE_HOOKUP_OBJECT (specwindow, label25, "label25"); + GLADE_HOOKUP_OBJECT (specwindow, ptt, "ptt"); + GLADE_HOOKUP_OBJECT (specwindow, label20, "label20"); + GLADE_HOOKUP_OBJECT (specwindow, ledptt, "ledptt"); + GLADE_HOOKUP_OBJECT (specwindow, label19, "label19"); + GLADE_HOOKUP_OBJECT (specwindow, leddcd, "leddcd"); + GLADE_HOOKUP_OBJECT (specwindow, frame4, "frame4"); + GLADE_HOOKUP_OBJECT (specwindow, spec, "spec"); + GLADE_HOOKUP_OBJECT (specwindow, label26, "label26"); + + return specwindow; +} + +GtkWidget* +create_scopewindow (void) +{ + GtkWidget *scopewindow; + GtkWidget *vbox5; + GtkWidget *hbox2; + GtkWidget *dcdfreeze; + GtkWidget *label26; + GtkWidget *ptt; + GtkWidget *label21; + GtkWidget *ledptt; + GtkWidget *label22; + GtkWidget *leddcd; + GtkWidget *frame5; + GtkWidget *scope; + GtkWidget *label27; + + scopewindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (scopewindow), _("Scope")); + + vbox5 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox5); + gtk_container_add (GTK_CONTAINER (scopewindow), vbox5); + + hbox2 = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox2); + gtk_box_pack_start (GTK_BOX (vbox5), hbox2, FALSE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (hbox2), 4); + + dcdfreeze = gtk_toggle_button_new_with_mnemonic (_("Freeze when not DCD")); + gtk_widget_show (dcdfreeze); + gtk_box_pack_start (GTK_BOX (hbox2), dcdfreeze, FALSE, FALSE, 4); + + label26 = gtk_label_new (""); + gtk_widget_show (label26); + gtk_box_pack_start (GTK_BOX (hbox2), label26, TRUE, TRUE, 0); + gtk_label_set_justify (GTK_LABEL (label26), GTK_JUSTIFY_CENTER); + + ptt = gtk_toggle_button_new_with_mnemonic (_("PTT")); + gtk_widget_show (ptt); + gtk_box_pack_start (GTK_BOX (hbox2), ptt, FALSE, FALSE, 4); + + label21 = gtk_label_new (_("PTT")); + gtk_widget_show (label21); + gtk_box_pack_start (GTK_BOX (hbox2), label21, FALSE, TRUE, 0); + gtk_label_set_justify (GTK_LABEL (label21), GTK_JUSTIFY_CENTER); + gtk_misc_set_padding (GTK_MISC (label21), 7, 0); + + ledptt = create_led_pixmap ("ledptt", "", "", 0, 0); + gtk_widget_show (ledptt); + gtk_box_pack_start (GTK_BOX (hbox2), ledptt, FALSE, TRUE, 4); + gtk_widget_set_can_focus (ledptt, FALSE); + gtk_widget_set_can_default (ledptt, FALSE); + + label22 = gtk_label_new (_("DCD")); + gtk_widget_show (label22); + gtk_box_pack_start (GTK_BOX (hbox2), label22, FALSE, TRUE, 0); + gtk_label_set_justify (GTK_LABEL (label22), GTK_JUSTIFY_CENTER); + gtk_misc_set_padding (GTK_MISC (label22), 7, 0); + + leddcd = create_led_pixmap ("leddcd", "", "", 0, 0); + gtk_widget_show (leddcd); + gtk_box_pack_start (GTK_BOX (hbox2), leddcd, FALSE, TRUE, 4); + gtk_widget_set_can_focus (leddcd, FALSE); + gtk_widget_set_can_default (leddcd, FALSE); + + frame5 = gtk_frame_new (NULL); + gtk_widget_show (frame5); + gtk_box_pack_start (GTK_BOX (vbox5), frame5, FALSE, FALSE, 0); + + scope = scope_new ("scope", "", "", 0, 0); + gtk_widget_show (scope); + gtk_container_add (GTK_CONTAINER (frame5), scope); + gtk_widget_set_size_request (scope, 512, 384); + gtk_widget_set_can_focus (scope, TRUE); + gtk_widget_set_can_default (scope, FALSE); + + label27 = gtk_label_new (_("Scope")); + gtk_widget_show (label27); + gtk_frame_set_label_widget (GTK_FRAME (frame5), label27); + + g_signal_connect ((gpointer) scopewindow, "delete_event", + G_CALLBACK (on_scopewindow_delete_event), + NULL); + g_signal_connect ((gpointer) dcdfreeze, "toggled", + G_CALLBACK (on_dcdfreeze_toggled), + NULL); + g_signal_connect ((gpointer) ptt, "toggled", + G_CALLBACK (on_ptt_toggled), + NULL); + + /* Store pointers to all widgets, for use by lookup_widget(). */ + GLADE_HOOKUP_OBJECT_NO_REF (scopewindow, scopewindow, "scopewindow"); + GLADE_HOOKUP_OBJECT (scopewindow, vbox5, "vbox5"); + GLADE_HOOKUP_OBJECT (scopewindow, hbox2, "hbox2"); + GLADE_HOOKUP_OBJECT (scopewindow, dcdfreeze, "dcdfreeze"); + GLADE_HOOKUP_OBJECT (scopewindow, label26, "label26"); + GLADE_HOOKUP_OBJECT (scopewindow, ptt, "ptt"); + GLADE_HOOKUP_OBJECT (scopewindow, label21, "label21"); + GLADE_HOOKUP_OBJECT (scopewindow, ledptt, "ledptt"); + GLADE_HOOKUP_OBJECT (scopewindow, label22, "label22"); + GLADE_HOOKUP_OBJECT (scopewindow, leddcd, "leddcd"); + GLADE_HOOKUP_OBJECT (scopewindow, frame5, "frame5"); + GLADE_HOOKUP_OBJECT (scopewindow, scope, "scope"); + GLADE_HOOKUP_OBJECT (scopewindow, label27, "label27"); + + return scopewindow; +} + +GtkWidget* +create_receivewindow (void) +{ + GtkWidget *receivewindow; + GtkWidget *vbox6; + GtkWidget *hbox3; + GtkWidget *clearbutton; + GtkWidget *label7; + GtkWidget *count0; + GtkWidget *label17; + GtkWidget *count1; + GtkWidget *label18; + GtkWidget *counttot; + GtkWidget *label27; + GtkWidget *ptt; + GtkWidget *label23; + GtkWidget *ledptt; + GtkWidget *label24; + GtkWidget *leddcd; + GtkWidget *vpaned1; + GtkWidget *frame6; + GtkWidget *scrolledwindow2; + GtkWidget *packettext; + GtkWidget *label28; + GtkWidget *frame7; + GtkWidget *scrolledwindow3; + GtkWidget *bitstext; + GtkWidget *label29; + + receivewindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (receivewindow), _("Receive Packets/Bits")); + + vbox6 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox6); + gtk_container_add (GTK_CONTAINER (receivewindow), vbox6); + + hbox3 = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox3); + gtk_box_pack_start (GTK_BOX (vbox6), hbox3, FALSE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (hbox3), 4); + + clearbutton = gtk_button_new_with_mnemonic (_("Clear Count")); + gtk_widget_show (clearbutton); + gtk_box_pack_start (GTK_BOX (hbox3), clearbutton, FALSE, FALSE, 4); + + label7 = gtk_label_new (_("Zeros")); + gtk_widget_show (label7); + gtk_box_pack_start (GTK_BOX (hbox3), label7, FALSE, FALSE, 3); + gtk_label_set_justify (GTK_LABEL (label7), GTK_JUSTIFY_CENTER); + + count0 = gtk_entry_new (); + gtk_widget_show (count0); + gtk_box_pack_start (GTK_BOX (hbox3), count0, FALSE, TRUE, 4); + gtk_widget_set_size_request (count0, 60, -1); + gtk_widget_set_can_focus (count0, FALSE); + gtk_editable_set_editable (GTK_EDITABLE (count0), FALSE); + gtk_entry_set_invisible_char (GTK_ENTRY (count0), 9679); + + label17 = gtk_label_new (_("Ones")); + gtk_widget_show (label17); + gtk_box_pack_start (GTK_BOX (hbox3), label17, FALSE, FALSE, 3); + gtk_label_set_justify (GTK_LABEL (label17), GTK_JUSTIFY_CENTER); + + count1 = gtk_entry_new (); + gtk_widget_show (count1); + gtk_box_pack_start (GTK_BOX (hbox3), count1, FALSE, TRUE, 0); + gtk_widget_set_size_request (count1, 60, -1); + gtk_widget_set_can_focus (count1, FALSE); + gtk_editable_set_editable (GTK_EDITABLE (count1), FALSE); + gtk_entry_set_invisible_char (GTK_ENTRY (count1), 9679); + + label18 = gtk_label_new (_("Total")); + gtk_widget_show (label18); + gtk_box_pack_start (GTK_BOX (hbox3), label18, FALSE, FALSE, 3); + gtk_label_set_justify (GTK_LABEL (label18), GTK_JUSTIFY_CENTER); + + counttot = gtk_entry_new (); + gtk_widget_show (counttot); + gtk_box_pack_start (GTK_BOX (hbox3), counttot, FALSE, TRUE, 0); + gtk_widget_set_size_request (counttot, 60, -1); + gtk_widget_set_can_focus (counttot, FALSE); + gtk_editable_set_editable (GTK_EDITABLE (counttot), FALSE); + gtk_entry_set_invisible_char (GTK_ENTRY (counttot), 9679); + + label27 = gtk_label_new (""); + gtk_widget_show (label27); + gtk_box_pack_start (GTK_BOX (hbox3), label27, TRUE, TRUE, 0); + gtk_label_set_justify (GTK_LABEL (label27), GTK_JUSTIFY_CENTER); + + ptt = gtk_toggle_button_new_with_mnemonic (_("PTT")); + gtk_widget_show (ptt); + gtk_box_pack_start (GTK_BOX (hbox3), ptt, FALSE, FALSE, 4); + + label23 = gtk_label_new (_("PTT")); + gtk_widget_show (label23); + gtk_box_pack_start (GTK_BOX (hbox3), label23, FALSE, TRUE, 0); + gtk_label_set_justify (GTK_LABEL (label23), GTK_JUSTIFY_CENTER); + gtk_misc_set_padding (GTK_MISC (label23), 7, 0); + + ledptt = create_led_pixmap ("ledptt", "", "", 0, 0); + gtk_widget_show (ledptt); + gtk_box_pack_start (GTK_BOX (hbox3), ledptt, FALSE, TRUE, 4); + gtk_widget_set_can_focus (ledptt, FALSE); + gtk_widget_set_can_default (ledptt, FALSE); + + label24 = gtk_label_new (_("DCD")); + gtk_widget_show (label24); + gtk_box_pack_start (GTK_BOX (hbox3), label24, FALSE, TRUE, 0); + gtk_label_set_justify (GTK_LABEL (label24), GTK_JUSTIFY_CENTER); + gtk_misc_set_padding (GTK_MISC (label24), 7, 0); + + leddcd = create_led_pixmap ("leddcd", "", "", 0, 0); + gtk_widget_show (leddcd); + gtk_box_pack_start (GTK_BOX (hbox3), leddcd, FALSE, TRUE, 4); + gtk_widget_set_can_focus (leddcd, FALSE); + gtk_widget_set_can_default (leddcd, FALSE); + + vpaned1 = gtk_vpaned_new (); + gtk_widget_show (vpaned1); + gtk_box_pack_start (GTK_BOX (vbox6), vpaned1, TRUE, TRUE, 0); + gtk_widget_set_can_focus (vpaned1, FALSE); + + frame6 = gtk_frame_new (NULL); + gtk_widget_show (frame6); + gtk_paned_pack1 (GTK_PANED (vpaned1), frame6, TRUE, TRUE); + + scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_show (scrolledwindow2); + gtk_container_add (GTK_CONTAINER (frame6), scrolledwindow2); + gtk_widget_set_can_focus (scrolledwindow2, FALSE); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_SHADOW_IN); + + packettext = gtk_text_view_new (); + gtk_widget_show (packettext); + gtk_container_add (GTK_CONTAINER (scrolledwindow2), packettext); + gtk_widget_set_can_focus (packettext, FALSE); + gtk_text_view_set_editable (GTK_TEXT_VIEW (packettext), FALSE); + gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (packettext), GTK_WRAP_WORD); + + label28 = gtk_label_new (_("Received Packets")); + gtk_widget_show (label28); + gtk_frame_set_label_widget (GTK_FRAME (frame6), label28); + + frame7 = gtk_frame_new (NULL); + gtk_widget_show (frame7); + gtk_paned_pack2 (GTK_PANED (vpaned1), frame7, TRUE, TRUE); + + scrolledwindow3 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_show (scrolledwindow3); + gtk_container_add (GTK_CONTAINER (frame7), scrolledwindow3); + gtk_widget_set_can_focus (scrolledwindow3, FALSE); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow3), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow3), GTK_SHADOW_IN); + + bitstext = gtk_text_view_new (); + gtk_widget_show (bitstext); + gtk_container_add (GTK_CONTAINER (scrolledwindow3), bitstext); + gtk_widget_set_can_focus (bitstext, FALSE); + gtk_text_view_set_editable (GTK_TEXT_VIEW (bitstext), FALSE); + gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (bitstext), GTK_WRAP_CHAR); + + label29 = gtk_label_new (_("Received Bits")); + gtk_widget_show (label29); + gtk_frame_set_label_widget (GTK_FRAME (frame7), label29); + + g_signal_connect ((gpointer) receivewindow, "delete_event", + G_CALLBACK (on_receivewindow_delete_event), + NULL); + g_signal_connect ((gpointer) clearbutton, "clicked", + G_CALLBACK (on_clearbutton_clicked), + NULL); + g_signal_connect ((gpointer) ptt, "toggled", + G_CALLBACK (on_ptt_toggled), + NULL); + + /* Store pointers to all widgets, for use by lookup_widget(). */ + GLADE_HOOKUP_OBJECT_NO_REF (receivewindow, receivewindow, "receivewindow"); + GLADE_HOOKUP_OBJECT (receivewindow, vbox6, "vbox6"); + GLADE_HOOKUP_OBJECT (receivewindow, hbox3, "hbox3"); + GLADE_HOOKUP_OBJECT (receivewindow, clearbutton, "clearbutton"); + GLADE_HOOKUP_OBJECT (receivewindow, label7, "label7"); + GLADE_HOOKUP_OBJECT (receivewindow, count0, "count0"); + GLADE_HOOKUP_OBJECT (receivewindow, label17, "label17"); + GLADE_HOOKUP_OBJECT (receivewindow, count1, "count1"); + GLADE_HOOKUP_OBJECT (receivewindow, label18, "label18"); + GLADE_HOOKUP_OBJECT (receivewindow, counttot, "counttot"); + GLADE_HOOKUP_OBJECT (receivewindow, label27, "label27"); + GLADE_HOOKUP_OBJECT (receivewindow, ptt, "ptt"); + GLADE_HOOKUP_OBJECT (receivewindow, label23, "label23"); + GLADE_HOOKUP_OBJECT (receivewindow, ledptt, "ledptt"); + GLADE_HOOKUP_OBJECT (receivewindow, label24, "label24"); + GLADE_HOOKUP_OBJECT (receivewindow, leddcd, "leddcd"); + GLADE_HOOKUP_OBJECT (receivewindow, vpaned1, "vpaned1"); + GLADE_HOOKUP_OBJECT (receivewindow, frame6, "frame6"); + GLADE_HOOKUP_OBJECT (receivewindow, scrolledwindow2, "scrolledwindow2"); + GLADE_HOOKUP_OBJECT (receivewindow, packettext, "packettext"); + GLADE_HOOKUP_OBJECT (receivewindow, label28, "label28"); + GLADE_HOOKUP_OBJECT (receivewindow, frame7, "frame7"); + GLADE_HOOKUP_OBJECT (receivewindow, scrolledwindow3, "scrolledwindow3"); + GLADE_HOOKUP_OBJECT (receivewindow, bitstext, "bitstext"); + GLADE_HOOKUP_OBJECT (receivewindow, label29, "label29"); + + return receivewindow; +} + +GtkWidget* +create_p3dwindow (void) +{ + GtkWidget *p3dwindow; + GtkWidget *vbox6; + GtkWidget *hbox3; + GtkWidget *label7; + GtkWidget *rxstatus; + GtkWidget *label17; + GtkWidget *carrierfreq; + GtkWidget *label18; + GtkWidget *buttonpassall; + GtkWidget *vpaned1; + GtkWidget *frame6; + GtkWidget *scrolledwindow2; + GtkWidget *packetcooked; + GtkWidget *label30; + GtkWidget *frame7; + GtkWidget *scrolledwindow3; + GtkWidget *packetraw; + GtkWidget *label31; + + p3dwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (p3dwindow), _("AO-40 Phase 3D Receive Window")); + + vbox6 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox6); + gtk_container_add (GTK_CONTAINER (p3dwindow), vbox6); + + hbox3 = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox3); + gtk_box_pack_start (GTK_BOX (vbox6), hbox3, FALSE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (hbox3), 4); + + label7 = gtk_label_new (_("Receiver Status")); + gtk_widget_show (label7); + gtk_box_pack_start (GTK_BOX (hbox3), label7, FALSE, FALSE, 3); + gtk_label_set_justify (GTK_LABEL (label7), GTK_JUSTIFY_CENTER); + + rxstatus = gtk_entry_new (); + gtk_widget_show (rxstatus); + gtk_box_pack_start (GTK_BOX (hbox3), rxstatus, FALSE, TRUE, 4); + gtk_widget_set_size_request (rxstatus, 120, -1); + gtk_widget_set_can_focus (rxstatus, FALSE); + gtk_editable_set_editable (GTK_EDITABLE (rxstatus), FALSE); + gtk_entry_set_invisible_char (GTK_ENTRY (rxstatus), 9679); + + label17 = gtk_label_new (_("Carrier Frequency")); + gtk_widget_show (label17); + gtk_box_pack_start (GTK_BOX (hbox3), label17, FALSE, FALSE, 3); + gtk_label_set_justify (GTK_LABEL (label17), GTK_JUSTIFY_CENTER); + + carrierfreq = gtk_entry_new (); + gtk_widget_show (carrierfreq); + gtk_box_pack_start (GTK_BOX (hbox3), carrierfreq, FALSE, TRUE, 0); + gtk_widget_set_size_request (carrierfreq, 60, -1); + gtk_widget_set_can_focus (carrierfreq, FALSE); + gtk_editable_set_editable (GTK_EDITABLE (carrierfreq), FALSE); + gtk_entry_set_invisible_char (GTK_ENTRY (carrierfreq), 9679); + + label18 = gtk_label_new (_("Hz")); + gtk_widget_show (label18); + gtk_box_pack_start (GTK_BOX (hbox3), label18, FALSE, FALSE, 3); + gtk_label_set_justify (GTK_LABEL (label18), GTK_JUSTIFY_CENTER); + + buttonpassall = gtk_toggle_button_new_with_mnemonic (_("Decode All Packets (Faulty CRC)")); + gtk_widget_show (buttonpassall); + gtk_box_pack_end (GTK_BOX (hbox3), buttonpassall, FALSE, FALSE, 0); + + vpaned1 = gtk_vpaned_new (); + gtk_widget_show (vpaned1); + gtk_box_pack_start (GTK_BOX (vbox6), vpaned1, TRUE, TRUE, 0); + gtk_widget_set_can_focus (vpaned1, FALSE); + + frame6 = gtk_frame_new (NULL); + gtk_widget_show (frame6); + gtk_paned_pack1 (GTK_PANED (vpaned1), frame6, TRUE, TRUE); + + scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_show (scrolledwindow2); + gtk_container_add (GTK_CONTAINER (frame6), scrolledwindow2); + gtk_widget_set_can_focus (scrolledwindow2, FALSE); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_SHADOW_IN); + + packetcooked = gtk_text_view_new (); + gtk_widget_show (packetcooked); + gtk_container_add (GTK_CONTAINER (scrolledwindow2), packetcooked); + gtk_widget_set_can_focus (packetcooked, FALSE); + gtk_text_view_set_editable (GTK_TEXT_VIEW (packetcooked), FALSE); + gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (packetcooked), GTK_WRAP_CHAR); + + label30 = gtk_label_new (_("Received Decoded Packets")); + gtk_widget_show (label30); + gtk_frame_set_label_widget (GTK_FRAME (frame6), label30); + + frame7 = gtk_frame_new (NULL); + gtk_widget_show (frame7); + gtk_paned_pack2 (GTK_PANED (vpaned1), frame7, TRUE, TRUE); + + scrolledwindow3 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_show (scrolledwindow3); + gtk_container_add (GTK_CONTAINER (frame7), scrolledwindow3); + gtk_widget_set_can_focus (scrolledwindow3, FALSE); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow3), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow3), GTK_SHADOW_IN); + + packetraw = gtk_text_view_new (); + gtk_widget_show (packetraw); + gtk_container_add (GTK_CONTAINER (scrolledwindow3), packetraw); + gtk_widget_set_can_focus (packetraw, FALSE); + gtk_text_view_set_editable (GTK_TEXT_VIEW (packetraw), FALSE); + gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (packetraw), GTK_WRAP_CHAR); + + label31 = gtk_label_new (_("Received Raw Packets")); + gtk_widget_show (label31); + gtk_frame_set_label_widget (GTK_FRAME (frame7), label31); + + g_signal_connect ((gpointer) p3dwindow, "delete_event", + G_CALLBACK (on_p3dwindow_delete_event), + NULL); + + /* Store pointers to all widgets, for use by lookup_widget(). */ + GLADE_HOOKUP_OBJECT_NO_REF (p3dwindow, p3dwindow, "p3dwindow"); + GLADE_HOOKUP_OBJECT (p3dwindow, vbox6, "vbox6"); + GLADE_HOOKUP_OBJECT (p3dwindow, hbox3, "hbox3"); + GLADE_HOOKUP_OBJECT (p3dwindow, label7, "label7"); + GLADE_HOOKUP_OBJECT (p3dwindow, rxstatus, "rxstatus"); + GLADE_HOOKUP_OBJECT (p3dwindow, label17, "label17"); + GLADE_HOOKUP_OBJECT (p3dwindow, carrierfreq, "carrierfreq"); + GLADE_HOOKUP_OBJECT (p3dwindow, label18, "label18"); + GLADE_HOOKUP_OBJECT (p3dwindow, buttonpassall, "buttonpassall"); + GLADE_HOOKUP_OBJECT (p3dwindow, vpaned1, "vpaned1"); + GLADE_HOOKUP_OBJECT (p3dwindow, frame6, "frame6"); + GLADE_HOOKUP_OBJECT (p3dwindow, scrolledwindow2, "scrolledwindow2"); + GLADE_HOOKUP_OBJECT (p3dwindow, packetcooked, "packetcooked"); + GLADE_HOOKUP_OBJECT (p3dwindow, label30, "label30"); + GLADE_HOOKUP_OBJECT (p3dwindow, frame7, "frame7"); + GLADE_HOOKUP_OBJECT (p3dwindow, scrolledwindow3, "scrolledwindow3"); + GLADE_HOOKUP_OBJECT (p3dwindow, packetraw, "packetraw"); + GLADE_HOOKUP_OBJECT (p3dwindow, label31, "label31"); + + return p3dwindow; +} + diff --git a/configapp/src/interface.h b/configapp/src/interface.h new file mode 100644 index 0000000..d0e2a7c --- /dev/null +++ b/configapp/src/interface.h @@ -0,0 +1,12 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +GtkWidget* create_mainwindow (void); +GtkWidget* create_aboutwindow (void); +GtkWidget* create_newconfigwindow (void); +GtkWidget* create_errordialog (void); +GtkWidget* create_specwindow (void); +GtkWidget* create_scopewindow (void); +GtkWidget* create_receivewindow (void); +GtkWidget* create_p3dwindow (void); diff --git a/configapp/src/main.c b/configapp/src/main.c new file mode 100644 index 0000000..72a1808 --- /dev/null +++ b/configapp/src/main.c @@ -0,0 +1,664 @@ +/* + * Initial main.c file generated by Glade. Edit as required. + * Glade will not overwrite this file. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "configapp.h" + +#include "getopt.h" + +#include + +#include "interface.h" +#include "support.h" + +#ifdef WIN32 + +#include + +#else + +/* libxml includes */ +#include +#include + +#endif + +#include +#include +#include +#include + +#include "simd.h" + +/* ---------------------------------------------------------------------- */ + +GtkWidget *mainwindow, *specwindow, *scopewindow, *receivewindow, *p3dwindow; +GtkTreeModel *configmodel; + +/* ---------------------------------------------------------------------- */ + +extern struct modulator afskmodulator; +extern struct demodulator afskdemodulator; + +extern struct modulator fskmodulator; +extern struct demodulator fskdemodulator; +extern struct demodulator fskpspdemodulator; +extern struct modulator fskeqmodulator; +extern struct demodulator fskeqdemodulator; + +extern struct modulator pammodulator; +extern struct demodulator pamdemodulator; + +extern struct modulator pskmodulator; +extern struct demodulator pskdemodulator; + +extern struct modulator newqpskmodulator; +extern struct demodulator newqpskdemodulator; + +/* ---------------------------------------------------------------------- */ + +struct modulator modchain_x = { + &afskmodulator, + "Off", + NULL, + NULL, + NULL, + NULL +}; + +struct demodulator demodchain_x = { + &afskdemodulator, + "Off", + NULL, + NULL, + NULL +}; + +#ifdef HAVE_ALSA +#define ALSA_STR , "alsa" +#else /* HAVE_ALSA */ +#define ALSA_STR +#endif /* HAVE_ALSA */ + +struct modemparams ioparam_type[] = { + { "type", "Audio IO Mode", "Audio IO Mode", "soundcard", MODEMPAR_COMBO, + { c: { { "soundcard", "file", "simulation" ALSA_STR } } } }, + { NULL } +}; + +#undef ALSA_STR + +#ifdef WIN32 + +struct modemparams chaccparams_x[] = { + { "txdelay", "TxDelay", "Transmitter Keyup delay in ms", "150", MODEMPAR_NUMERIC, { n: { 0, 2550, 10, 50 } } }, + { "fulldup", "Full Duplex", "Full Duplex", "0", MODEMPAR_CHECKBUTTON }, + { NULL } +}; + +#else /* WIN32 */ + +struct modemparams pktkissparams_x[] = { + { "file", "File", "File (symlink) to send the KISS stream to", "/dev/soundmodem0", + MODEMPAR_COMBO, { c: { { "/dev/soundmodem0", "/dev/soundmodem1", "/dev/soundmodem2", "/dev/soundmodem3" } } } }, + { "unlink", "Unlink File", "Unlink File (above) on setup", "1", MODEMPAR_CHECKBUTTON }, + { NULL } +}; + +struct modemparams pktmkissparams_x[] = { + { "ifname", "Interface Name", "Name of the Kernel KISS Interface", "sm0", MODEMPAR_COMBO, + { c: { { "sm0", "sm1", "sm2", "ax0" } } } }, + { "hwaddr", "Callsign", "Callsign (Hardware Address)", "", MODEMPAR_STRING }, + { "ip", "IP Address", "IP Address (mandatory)", "10.0.0.1", MODEMPAR_STRING }, + { "netmask", "Network Mask", "Network Mask", "255.255.255.0", MODEMPAR_STRING }, + { "broadcast", "Broadcast Address", "Broadcast Address", "10.0.0.255", MODEMPAR_STRING }, + { NULL } +}; + +struct modemparams chaccparams_x[] = { + { "txdelay", "TxDelay", "Transmitter Keyup delay in ms", "150", MODEMPAR_NUMERIC, { n: { 0, 2550, 10, 50 } } }, + { "slottime", "Slot Time", "Slot Time in ms (normally 100ms)", "100", MODEMPAR_NUMERIC, { n: { 0, 2550, 10, 50 } } }, + { "ppersist", "P-Persistence", "P-Persistence", "40", MODEMPAR_NUMERIC, { n: { 0, 255, 1, 10 } } }, + { "fulldup", "Full Duplex", "Full Duplex", "0", MODEMPAR_CHECKBUTTON }, + { "txtail", "TxTail", "Transmitter Tail delay in ms", "10", MODEMPAR_NUMERIC, { n: { 0, 2550, 10, 50 } } }, + { NULL } +}; + +#endif /* WIN32 */ + +/* ---------------------------------------------------------------------- */ + +#ifdef WIN32 + +#define REGISTRYPATH "SOFTWARE\\FlexNet\\SoundModem" +#define REGISTRYKEY HKEY_LOCAL_MACHINE + +#define MAXCHAN 16 + +static struct { + unsigned int nrchan; + struct onechannel { + char name[16]; + } chan[MAXCHAN]; +} channels; + +static int chancompare(struct onechannel *i, struct onechannel *j) +{ + return strcmp(i->name, j->name); +} + +static int enumchannels(const char *cfgname) +{ + char name[256]; + HKEY regkey; + LONG err; + DWORD len; + DWORD index = 0; + + channels.nrchan = 0; + snprintf(name, sizeof(name), "%s\\%s", REGISTRYPATH, cfgname); + if ((err = RegOpenKeyEx(REGISTRYKEY, name, 0, KEY_READ, ®key)) != ERROR_SUCCESS) { + g_printerr("RegOpenKeyEx(%s) returned 0x%lx\n", name, err); + return -1; + } + while (channels.nrchan < MAXCHAN) { + len = sizeof(channels.chan[channels.nrchan].name); + if ((RegEnumKeyEx(regkey, index, channels.chan[channels.nrchan].name, &len, + NULL, NULL, NULL, NULL)) != ERROR_SUCCESS) + break; + index++; + if (isdigit(channels.chan[channels.nrchan].name[0])) + channels.nrchan++; + } + RegCloseKey(regkey); + if (!channels.nrchan) + return 0; + qsort(&channels.chan[0], channels.nrchan, sizeof(channels.chan[0]), chancompare); + return 0; +} + +int xml_newconfig(const char *newname) +{ + HKEY regkey; + LONG err; + DWORD dispo; + char name[256]; + + if (strchr(newname, '\\')) + return -1; + snprintf(name, sizeof(name), "%s\\%s", REGISTRYPATH, newname); + if ((err = RegCreateKeyEx(REGISTRYKEY, name, 0, "", REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, NULL, ®key, &dispo)) != ERROR_SUCCESS) { + g_printerr("RegCreateKeyEx(%s) returned 0x%lx\n", name, err); + return -1; + } + RegCloseKey(regkey); + return (dispo == REG_CREATED_NEW_KEY) ? 0 : -1; +} + +const char *xml_newchannel(const char *cfgname) +{ + if (enumchannels(cfgname)) + return NULL; + if (channels.nrchan >= MAXCHAN) + return NULL; + if (channels.nrchan == 0) + strncpy(channels.chan[channels.nrchan].name, "0", + sizeof(channels.chan[channels.nrchan].name)); + else + snprintf(channels.chan[channels.nrchan].name, + sizeof(channels.chan[channels.nrchan].name), + "%ld", strtoul(channels.chan[channels.nrchan-1].name, NULL, 0)+1); + channels.nrchan++; + return channels.chan[channels.nrchan-1].name; +} + +static int deletekeyx(HKEY key) +{ + char name[128]; + LONG err; + DWORD len; + HKEY key2; + int ret = 0; + + for (;;) { + len = sizeof(name); + if ((RegEnumKeyEx(key, 0, name, &len, NULL, NULL, NULL, NULL)) != ERROR_SUCCESS) + return ret; + if ((err = RegOpenKeyEx(key, name, 0, KEY_ALL_ACCESS, &key2)) != ERROR_SUCCESS) { + g_printerr("RegOpenKeyEx(%s) returned 0x%lx\n", name, err); + return -1; + } + ret |= deletekeyx(key2); + RegCloseKey(key2); + RegDeleteKey(key, name); + } + return ret; +} + +static int deletekey(const char *name) +{ + HKEY key; + int ret; + DWORD err; + + if ((err = RegOpenKeyEx(REGISTRYKEY, name, 0, KEY_ALL_ACCESS, &key)) != ERROR_SUCCESS) { + g_printerr("RegOpenKeyEx(%s) returned 0x%lx\n", name, err); + return -1; + } + ret = deletekeyx(key); + RegCloseKey(key); + RegDeleteKey(REGISTRYKEY, name); + return ret; +} + +int xml_deleteconfig(const char *newname) +{ + char name[256]; + + snprintf(name, sizeof(name), "%s\\%s", REGISTRYPATH, newname); + return deletekey(name); +} + +int xml_deletechannel(const char *cfgname, const char *chname) +{ + char name[256]; + + snprintf(name, sizeof(name), "%s\\%s\\%s", REGISTRYPATH, cfgname, chname); + return deletekey(name); +} + +int xml_setprop(const char *cfgname, const char *chname, const char *typname, const char *propname, const char *data) +{ + char name[256]; + HKEY key; + DWORD err; + + if (chname) + snprintf(name, sizeof(name), "%s\\%s\\%s\\%s", REGISTRYPATH, cfgname, chname, typname); + else + snprintf(name, sizeof(name), "%s\\%s\\%s", REGISTRYPATH, cfgname, typname); + if ((err = RegCreateKeyEx(REGISTRYKEY, name, 0, "", REG_OPTION_NON_VOLATILE, + KEY_WRITE, NULL, &key, NULL)) != ERROR_SUCCESS) { + g_printerr("RegCreateKeyEx(%s) returned 0x%lx\n", name, err); + return -1; + } + err = RegSetValueEx(key, propname, 0, REG_SZ, data, strlen(data)+1); + RegCloseKey(key); + if (err != ERROR_SUCCESS) { + g_printerr("RegSetValueEx(%s,%s) returned 0x%lx\n", propname, data, err); + return -1; + } + return 0; +} + +int xml_getprop(const char *cfgname, const char *chname, const char *typname, const char *propname, char *buf, unsigned int bufsz) +{ + HKEY key; + DWORD err, vtype, len; + char name[256]; + + buf[0] = 0; + if (chname) + snprintf(name, sizeof(name), "%s\\%s\\%s\\%s", REGISTRYPATH, cfgname, chname, typname); + else + snprintf(name, sizeof(name), "%s\\%s\\%s", REGISTRYPATH, cfgname, typname); + if ((err = RegCreateKeyEx(REGISTRYKEY, name, 0, "", REG_OPTION_NON_VOLATILE, + KEY_READ, NULL, &key, NULL)) != ERROR_SUCCESS) { + g_printerr("RegCreateKeyEx(%s) returned 0x%lx\n", name, err); + return -1; + } + len = bufsz; + err = RegQueryValueEx(key, propname, NULL, &vtype, buf, &len); + RegCloseKey(key); + if (len >= bufsz) + len = bufsz-1; + buf[len] = 0; + if (err != ERROR_SUCCESS) { + g_printerr("RegQueryValueEx(%s) returned 0x%lx\n", propname, err); + return -1; + } + if (vtype != REG_SZ) + return -1; + return len; +} + +static void buildtree(void) +{ + DWORD err; + HKEY key; + DWORD index = 0; + DWORD len; + char name[64]; + unsigned int i; + + if ((err = RegOpenKeyEx(REGISTRYKEY, REGISTRYPATH, 0, KEY_READ, &key)) != ERROR_SUCCESS) { + g_printerr("RegOpenKeyEx(" REGISTRYPATH ") returned 0x%lx\n", err); + return; + } + for (;;) { + len = sizeof(name); + if ((RegEnumKeyEx(key, index, name, &len, NULL, NULL, NULL, NULL)) != ERROR_SUCCESS) + break; + g_print("Configuration: %s\n", name); + index++; + new_configuration(name); + if (enumchannels(name)) + continue; + for (i = 0; i < channels.nrchan; i++) + new_channel(name, channels.chan[i].name); + } + RegCloseKey(key); +} + +#else /* WIN32 */ + +static xmlDocPtr doc = NULL; +static const char *cfgfile = "/etc/ax25/soundmodem.conf"; + +static xmlNodePtr findconfig(const char *newname) +{ + xmlNodePtr node; + const char *name; + + for (node = doc->children->children; node; node = node->next) { + if (!node->name || strcmp(node->name, "configuration")) + continue; + name = xmlGetProp(node, "name"); + if (!name) + continue; + if (!strcmp(name, newname)) + return node; + } + return NULL; +} + +static xmlNodePtr findchannel(xmlNodePtr cfg, const char *newname) +{ + xmlNodePtr node; + const char *name; + + if (!cfg) + return NULL; + for (node = cfg->children; node; node = node->next) { + if (!node->name || strcmp(node->name, "channel")) + continue; + name = xmlGetProp(node, "name"); + if (!name) + continue; + if (!strcmp(name, newname)) + return node; + } + return NULL; +} + +static void namechannels(xmlNodePtr cfg) +{ + xmlNodePtr node, node2; + unsigned int ch = 0; + char buf[64]; + const char *name; + + for (node = cfg->children; node; node = node->next) { + if (!node->name || strcmp(node->name, "channel")) + continue; + name = xmlGetProp(node, "name"); + if (name) { + node2 = findchannel(cfg, name); + if (node2 == node) + continue; + } + for (;;) { + sprintf(buf, "Channel %u", ch++); + xmlSetProp(node, "name", buf); + node2 = findchannel(cfg, buf); + if (node2 == node) + break; + } + } +} + +int xml_newconfig(const char *newname) +{ + xmlNodePtr node = findconfig(newname); + + if (node) + return -1; + node = xmlNewChild(doc->children, NULL, "configuration", NULL); + xmlSetProp(node, "name", newname); + return 0; +} + +const char *xml_newchannel(const char *cfgname) +{ + xmlNodePtr node, node2; + + node = findconfig(cfgname); + if (!node) + return NULL; + node2 = xmlNewChild(node, NULL, "channel", NULL); + namechannels(node); + return xmlGetProp(node2, "name"); +} + +int xml_deleteconfig(const char *newname) +{ + xmlNodePtr node = findconfig(newname); + if (!node) + return -1; + xmlUnlinkNode(node); + xmlFreeNode(node); + return 0; +} + +int xml_deletechannel(const char *cfgname, const char *chname) +{ + xmlNodePtr node = findconfig(cfgname); + node = findchannel(node, chname); + if (!node) + return -1; + xmlUnlinkNode(node); + xmlFreeNode(node); + return 0; +} + +static xmlNodePtr propnode(const char *cfgname, const char *chname, const char *typname, int create) +{ + xmlNodePtr node2, node = findconfig(cfgname); + if (chname) + node = findchannel(node, chname); + if (!node) + return NULL; + for (node2 = node->children; node2; node2 = node2->next) { + if (!node2->name || strcmp(node2->name, typname)) + continue; + return node2; + } + if (!create) + return NULL; + return xmlNewChild(node, NULL, typname, NULL); +} + +int xml_setprop(const char *cfgname, const char *chname, const char *typname, const char *propname, const char *data) +{ + xmlNodePtr node = propnode(cfgname, chname, typname, 1); + if (!node) + return -1; + xmlSetProp(node, propname, data); + return 0; +} + +int xml_getprop(const char *cfgname, const char *chname, const char *typname, const char *propname, char *buf, unsigned int bufsz) +{ + xmlNodePtr node = propnode(cfgname, chname, typname, 0); + const char *cp; + + buf[0] = 0; + if (!node) + return -1; + if (!(cp = xmlGetProp(node, propname))) + return -1; + strncpy(buf, cp, bufsz); + buf[bufsz-1] = 0; + return strlen(buf); +} + +static void buildtree(xmlNodePtr xnode) +{ + xmlNodePtr node; + const char *name; + + for (; xnode; xnode = xnode->next) { + if (!xnode->name || strcmp(xnode->name, "configuration")) + continue; + name = xmlGetProp(xnode, "name"); + if (!name) + continue; + namechannels(xnode); + new_configuration(name); + /* now add channels */ + for (node = xnode->children; node; node = node->next) { + if (!node->name || strcmp(node->name, "channel")) + continue; + new_channel(name, xmlGetProp(node, "name")); + } + } +} + +#endif /* WIN32 */ + +/* ---------------------------------------------------------------------- */ + +int main (int argc, char *argv[]) +{ + static const struct option long_options[] = { + { "expert", no_argument, 0, 'x' }, + { 0, 0, 0, 0 } + }; + int c, err = 0; + unsigned int verblevel = 10, tosyslog = 0, simd = 1, expert = 0; + + afskmodulator.next = &fskmodulator; + afskdemodulator.next = &fskdemodulator; + fskmodulator.next = &pammodulator; + fskdemodulator.next = &fskpspdemodulator; + fskpspdemodulator.next = &pamdemodulator; + fskeqdemodulator.next = &pamdemodulator; + pammodulator.next = &pskmodulator; + pamdemodulator.next = &pskdemodulator; + pskmodulator.next = &newqpskmodulator; + pskdemodulator.next = &newqpskdemodulator; + newqpskdemodulator.next = &p3ddemodulator; + +#ifdef ENABLE_NLS + bindtextdomain(PACKAGE, PACKAGE_LOCALE_DIR); + bind_textdomain_codeset (PACKAGE, "UTF-8"); + textdomain(PACKAGE); +#endif + + gtk_set_locale(); + gtk_init(&argc, &argv); + + add_pixmap_directory(PACKAGE_DATA_DIR "/pixmaps"); + add_pixmap_directory(PACKAGE_SOURCE_DIR "/pixmaps"); + + mainwindow = create_mainwindow(); + gtk_notebook_remove_page(GTK_NOTEBOOK(g_object_get_data(G_OBJECT(mainwindow), "confignotebook")), 0); + gtk_notebook_remove_page(GTK_NOTEBOOK(g_object_get_data(G_OBJECT(mainwindow), "confignotebook")), 0); + gtk_widget_hide(GTK_WIDGET(g_object_get_data(G_OBJECT(mainwindow), "newchannel"))); + gtk_widget_hide(GTK_WIDGET(g_object_get_data(G_OBJECT(mainwindow), "deleteconfiguration"))); + gtk_widget_hide(GTK_WIDGET(g_object_get_data(G_OBJECT(mainwindow), "deletechannel"))); + gtk_widget_hide(GTK_WIDGET(g_object_get_data(G_OBJECT(mainwindow), "diagnostics"))); + specwindow = create_specwindow(); + scopewindow = create_scopewindow(); + receivewindow = create_receivewindow(); + p3dwindow = create_p3dwindow(); + configmodel = create_configmodel(); + + { + GtkWidget *w; + GtkStyle *st; + PangoFontDescription *font_desc = pango_font_description_from_string ("monospace 10"); + if (!font_desc) { + g_printerr("Cannot load monospace\n"); + } else { + w = GTK_WIDGET(g_object_get_data(G_OBJECT(p3dwindow), "packetraw")); + st = gtk_style_copy(gtk_widget_get_style(w)); + st->font_desc = font_desc; + gtk_widget_set_style(w, st); + w = GTK_WIDGET(g_object_get_data(G_OBJECT(p3dwindow), "packetcooked")); + gtk_widget_set_style(w, st); + } + } + + while ((c = getopt_long(argc, argv, "v:sS", long_options, NULL)) != EOF) { + switch (c) { + case 'v': + verblevel = strtoul(optarg, NULL, 0); + break; + + case 's': + tosyslog = 1; + break; + + case 'S': + simd = 0; + break; + + case 'x': + expert = 1; + break; + + default: + err++; + break; + } + } + if (err) { + fprintf(stderr, "usage: []\n"); + exit(1); + } + if (expert) { + fskpspdemodulator.next = &fskeqdemodulator; + } + loginit(verblevel, tosyslog); + initsimd(simd); + ioinit_sim(); + ioinit_filein(); + ioinit_soundcard(); +#ifdef WIN32 + buildtree(); +#else /* WIN32 */ + if (optind < argc) + cfgfile = argv[optind]; + doc = xmlParseFile(cfgfile); + if (doc && (!doc->children || !doc->children->name || strcmp(doc->children->name, "modem"))) { + g_printerr("SoundModem Config: Invalid configuration file %s\n", cfgfile); + exit(1); + } + if (!doc && (doc = xmlNewDoc("1.0"))) + doc->children = xmlNewDocNode(doc, NULL, "modem", NULL); + if (!doc || !doc->children) { + g_printerr("SoundModem Config: out of memory\n"); + exit(1); + } + buildtree(doc->children->children); +#endif /* WIN32 */ + renumber_channels(); + gtk_tree_view_expand_all(GTK_TREE_VIEW(g_object_get_data(G_OBJECT(mainwindow), "configtree"))); + gtk_widget_show(mainwindow); + gtk_main(); +#ifdef WIN32 +#else /* WIN32 */ + if (!xmlSaveFormatFile(cfgfile, doc, 1)) + g_printerr("SoundModem Config: error saving configuration file %s\n", cfgfile); + xmlFreeDoc(doc); +#endif /* WIN32 */ + return 0; +} + diff --git a/configapp/src/scope.c b/configapp/src/scope.c new file mode 100644 index 0000000..0fabddc --- /dev/null +++ b/configapp/src/scope.c @@ -0,0 +1,346 @@ +/* + * Sooundmodem Scope Widget + * Copyright (C) 1999-2000 Thomas Sailer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "scope.h" +#include "snm-compat-gtk2.h" +#include +#include +#include +#include +#include + +/* --------------------------------------------------------------------- */ + +#define PRIO G_PRIORITY_LOW + +static void scope_class_init(ScopeClass *klass); +static void scope_init(Scope *scope); +static void scope_finalize(GObject *object); +static gint scope_expose(GtkWidget *widget, GdkEventExpose *event); +static void scope_realize(GtkWidget *widget); +static void scope_unrealize(GtkWidget *widget); +static void scope_size_allocate(GtkWidget *widget, GtkAllocation *allocation); +static void scope_send_configure (Scope *scope); +static gint idle_callback(gpointer data); + +static GtkWidgetClass *parent_class = NULL; +static ScopeClass *scope_class = NULL; + + +guint scope_get_type(void) +{ + static guint scope_type = 0; + + if (!scope_type) + { + static const GTypeInfo scope_info = + { + sizeof(ScopeClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc)scope_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof(Scope), + 0, /* n_preallocs */ + (GInstanceInitFunc)scope_init, + }; + scope_type = g_type_register_static + (GTK_TYPE_WIDGET, "Scope", &scope_info, 0); + } + return scope_type; +} + +static void scope_class_init(ScopeClass *klass) +{ + GObjectClass *object_class; + GtkWidgetClass *widget_class; + + object_class = (GObjectClass*)klass; + widget_class = (GtkWidgetClass*)klass; + + parent_class = g_type_class_peek(GTK_TYPE_WIDGET); + scope_class = klass; + + object_class->finalize = scope_finalize; + widget_class->expose_event = scope_expose; + widget_class->realize = scope_realize; + widget_class->unrealize = scope_unrealize; + widget_class->size_allocate = scope_size_allocate; +} + +static void scope_init(Scope *scope) +{ + scope->idlefunc = 0; + /* initialize the colors */ + scope->tracecol.red = 11796; + scope->tracecol.green = 53740; + scope->tracecol.blue = 4588; + scope->gridcol.red = 52429; + scope->gridcol.green = 52429; + scope->gridcol.blue = 52429; + scope->trace_gc = scope->grid_gc = NULL; + scope->pixmap = NULL; + /* initialize the data */ + memset(&scope->y, 0, sizeof(scope->y)); +} + +static void scope_realize(GtkWidget *widget) +{ + Scope *scope; + GdkWindowAttr attributes; + gint attributes_mask; + GdkGCValues gc_values; + GtkAllocation allocation; + GdkWindow *window; + GtkStyle *style; + + g_return_if_fail(widget != NULL); + g_return_if_fail(IS_SCOPE(widget)); + + scope = SCOPE(widget); + gtk_widget_set_realized(widget, TRUE); + gtk_widget_get_allocation(widget, &allocation); + + attributes.window_type = GDK_WINDOW_CHILD; + attributes.x = allocation.x; + attributes.y = allocation.y; + attributes.width = allocation.width; + attributes.height = allocation.height; + attributes.wclass = GDK_INPUT_OUTPUT; + attributes.visual = gtk_widget_get_visual(widget); + attributes.colormap = gtk_widget_get_colormap(widget); + attributes.event_mask = gtk_widget_get_events(widget) | GDK_EXPOSURE_MASK; + + attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; + + gtk_widget_set_has_window(widget, TRUE); + window = gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, attributes_mask); + gtk_widget_set_window(widget, window); + gdk_window_set_user_data(window, scope); + + gtk_widget_style_attach(widget); + style = gtk_widget_get_style(widget); + gtk_style_set_background(style, window, GTK_STATE_NORMAL); + + /* gc's if necessary */ + if (!gdk_colormap_alloc_color(style->colormap, &scope->tracecol, + FALSE, TRUE)) + g_warning("unable to allocate color: ( %d %d %d )", + scope->tracecol.red, scope->tracecol.green, scope->tracecol.blue); + gc_values.foreground = scope->tracecol; + scope->trace_gc = gtk_gc_get(style->depth, + style->colormap, + &gc_values, GDK_GC_FOREGROUND); + if (!gdk_colormap_alloc_color(style->colormap, &scope->gridcol, + FALSE, TRUE)) + g_warning("unable to allocate color: ( %d %d %d )", + scope->gridcol.red, scope->gridcol.green, scope->gridcol.blue); + gc_values.foreground = scope->gridcol; + scope->grid_gc = gtk_gc_get(style->depth, + style->colormap, + &gc_values, GDK_GC_FOREGROUND); + /* create backing store */ + scope->pixmap = gdk_pixmap_new(window, SCOPE_WIDTH, SCOPE_HEIGHT, -1); + + scope_send_configure(SCOPE(widget)); +} + +static void scope_unrealize(GtkWidget *widget) +{ + Scope *scope; + + g_return_if_fail(widget != NULL); + g_return_if_fail(IS_SCOPE(widget)); + + scope = SCOPE(widget); + if (scope->idlefunc) + g_source_remove(scope->idlefunc); + if (scope->trace_gc) + gtk_gc_release(scope->trace_gc); + if (scope->grid_gc) + gtk_gc_release(scope->grid_gc); + scope->trace_gc = scope->grid_gc = NULL; + if (scope->pixmap) + g_object_unref(scope->pixmap); + scope->pixmap = NULL; + if (GTK_WIDGET_CLASS(parent_class)->unrealize) + (*GTK_WIDGET_CLASS(parent_class)->unrealize)(widget); +} + +static void scope_size_allocate(GtkWidget *widget, GtkAllocation *allocation) +{ + GtkAllocation alloc; + + g_return_if_fail(widget != NULL); + g_return_if_fail(IS_SCOPE(widget)); + g_return_if_fail(allocation != NULL); + + alloc = *allocation; + alloc.width = SCOPE_WIDTH; + alloc.height = SCOPE_HEIGHT; + gtk_widget_set_allocation(widget, &alloc); + + if (gtk_widget_get_realized(widget)) { + gdk_window_move_resize (gtk_widget_get_window(widget), + allocation->x, allocation->y, + allocation->width, allocation->height); + scope_send_configure(SCOPE(widget)); + } +} + +static void scope_send_configure(Scope *scope) +{ + GtkWidget *widget; + GdkEventConfigure event; + GtkAllocation allocation; + + widget = GTK_WIDGET(scope); + gtk_widget_get_allocation(widget, &allocation); + + event.type = GDK_CONFIGURE; + event.window = gtk_widget_get_window(widget); + event.send_event = TRUE; + event.x = allocation.x; + event.y = allocation.y; + event.width = allocation.width; + event.height = allocation.height; + + gtk_widget_event(widget, (GdkEvent*)&event); +} + + +GtkWidget* scope_new(const char *name, void *dummy0, void *dummy1, unsigned int dummy2, unsigned int dummy3) +{ + Scope *scope; + + scope = g_object_new(scope_get_type(), NULL); + memset(&scope->y, 0, sizeof(scope->y)); + return GTK_WIDGET(scope); +} + +static void scope_finalize(GObject *object) +{ + g_return_if_fail(object != NULL); + g_return_if_fail(IS_SCOPE(object)); + (*G_OBJECT_CLASS(parent_class)->finalize)(object); +} + +static gint scope_expose(GtkWidget *widget, GdkEventExpose *event) +{ + Scope *scope; + + g_return_val_if_fail(widget != NULL, FALSE); + g_return_val_if_fail(IS_SCOPE(widget), FALSE); + g_return_val_if_fail (event != NULL, FALSE); + if (gtk_widget_is_drawable(widget)) { + scope = SCOPE(widget); + if (!scope->idlefunc) + scope->idlefunc = g_idle_add_full(PRIO, idle_callback, scope, NULL); + } + return FALSE; +} + +static void draw(Scope *scope) +{ + guint segcnt, i; + GdkPoint pt[SCOPE_WIDTH+1]; + GdkSegment seg[100], *segp; + GtkWidget *widget; + GtkAllocation allocation; + GtkStyle *style; + + widget = GTK_WIDGET(scope); + g_return_if_fail(gtk_widget_is_drawable(widget)); + g_return_if_fail(scope->pixmap); + gtk_widget_get_allocation(widget, &allocation); + style = gtk_widget_get_style(widget); + /* calculate grid segments */ + for (segp = seg, segcnt = i = 0; i < SCOPE_WIDTH; i += SCOPE_WIDTH/8) { + segp->x1 = segp->x2 = i; + segp->y1 = SCOPE_HEIGHT/2-5; + segp->y2 = SCOPE_HEIGHT/2+5; + segp++; + segcnt++; + } + segp->y1 = segp->y2 = SCOPE_HEIGHT/2; + segp->x1 = 0; + segp->x2 = SCOPE_WIDTH-1; + segp++; + segcnt++; + /* copy data points */ + for (i = 0; i < SCOPE_WIDTH; i++) { + pt[i].x = i; + pt[i].y = ((32767-(int)scope->y[i])*SCOPE_HEIGHT) >> 16; + } + /* clear window */ + gdk_draw_rectangle(scope->pixmap, style->base_gc[gtk_widget_get_state(widget)], + TRUE, 0, 0, + allocation.width, + allocation.height); + /* draw grid */ + gdk_draw_segments(scope->pixmap, scope->grid_gc, seg, segcnt); + /* draw trace */ + gdk_draw_lines(scope->pixmap, scope->trace_gc, pt, SCOPE_WIDTH); + /* draw to screen */ + gdk_draw_drawable(gtk_widget_get_window(widget), style->base_gc[gtk_widget_get_state(widget)], scope->pixmap, + 0, 0, 0, 0, allocation.width, allocation.height); +} + + +static gint idle_callback(gpointer data) +{ + g_return_val_if_fail(data != NULL, FALSE); + g_return_val_if_fail(IS_SCOPE(data), FALSE); + SCOPE(data)->idlefunc = 0; + if (!gtk_widget_is_drawable(GTK_WIDGET(data))) + return FALSE; + draw(SCOPE(data)); + return FALSE; /* don't call this callback again */ +} + +void scope_setdata(Scope *scope, short *samples) +{ + g_return_if_fail(scope != NULL); + g_return_if_fail(IS_SCOPE(scope)); + memcpy(scope->y, samples, sizeof(scope->y)); + if (gtk_widget_is_drawable(GTK_WIDGET(scope))) { + if (!scope->idlefunc) + scope->idlefunc = g_idle_add_full(PRIO, idle_callback, scope, NULL); + } +} + +#if 0 +void scope_setmarker(Scope *scope, int pointer) +{ + g_return_if_fail(scope != NULL); + g_return_if_fail(IS_SCOPE(scope)); + if (pointer >= 0 && pointer < SCOPE_WIDTH) + scope->pointer = pointer; + if (GTK_WIDGET_DRAWABLE(GTK_WIDGET(scope))) { + if (!scope->idlefunc) + scope->idlefunc = g_idle_add_full(PRIO, idle_callback, scope, NULL); + } +} +#endif diff --git a/configapp/src/scope.h b/configapp/src/scope.h new file mode 100644 index 0000000..2218f6c --- /dev/null +++ b/configapp/src/scope.h @@ -0,0 +1,75 @@ +/* + * Scope Widget + * Copyright (C) 1999-2000 Thomas Sailer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library 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. + */ + +#ifndef __SCOPE_H__ +#define __SCOPE_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define SCOPE(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, scope_get_type(), Scope) +#define SCOPE_CLASS(klass) G_TYPE_CHECK_CLASS_CAST(klass, scope_get_type(), ScopeClass) +#define IS_SCOPE(obj) G_TYPE_CHECK_INSTANCE_TYPE(obj, scope_get_type()) + +typedef struct _Scope Scope; +typedef struct _ScopeClass ScopeClass; + +#define SCOPE_NUMSAMPLES 512 + +#define SCOPE_WIDTH (SCOPE_NUMSAMPLES) +#define SCOPE_HEIGHT 384 + +struct _Scope +{ + GtkWidget widget; + + guint idlefunc; + GdkGC *trace_gc; + GdkGC *grid_gc; + GdkGC *pointer_gc; + GdkColor tracecol; + GdkColor gridcol; + + GdkPixmap *pixmap; + + short y[SCOPE_WIDTH]; +}; + +struct _ScopeClass +{ + GtkWidgetClass parent_class; +}; + + +guint scope_get_type(void); +GtkWidget* scope_new(const char *name, void *dummy0, void *dummy1, unsigned int dummy2, unsigned int dummy3); +void scope_setdata(Scope *scope, short *samples); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __SCOPE_H__ */ diff --git a/configapp/src/snm-compat-gtk2.h b/configapp/src/snm-compat-gtk2.h new file mode 100644 index 0000000..6825ee0 --- /dev/null +++ b/configapp/src/snm-compat-gtk2.h @@ -0,0 +1,63 @@ +#ifndef SNM_COMPAT_GTK2_H +#define SNM_COMPAT_GTK2_H + +/* To be included only from C files, not headers. */ + + +#ifndef HAVE_GTK_DIALOG_GET_ACTION_AREA +#define gtk_dialog_get_action_area(_d_) (_d_)->action_area +#endif + +#ifndef HAVE_GTK_DIALOG_GET_CONTENT_AREA +#define gtk_dialog_get_content_area(_d_) (_d_)->vbox +#endif + +#ifndef HAVE_GTK_WIDGET_GET_ALLOCATION +#define gtk_widget_get_allocation(_w_,_a_) (*(_a_) = (_w_)->allocation) +#endif + +#ifndef HAVE_GTK_WIDGET_SET_ALLOCATION +#define gtk_widget_set_allocation(_w_,_a_) ((_w_)->allocation = *(_a_)) +#endif + +#ifndef HAVE_GTK_WIDGET_GET_REALIZED +#define gtk_widget_get_realized(_w_) GTK_WIDGET_REALIZED(_w_) +#endif + +#ifndef HAVE_GTK_WIDGET_SET_REALIZED +#define gtk_widget_set_realized(_w_,_r_) do { if (_r_) GTK_WIDGET_SET_FLAGS(_w_, GTK_REALIZED); else GTK_WIDGET_UNSET_FLAGS(_w_, GTK_REALIZED); } while (0) +#endif + +#ifndef HAVE_GTK_WIDGET_GET_STATE +#define gtk_widget_get_state(_w_) (_w_)->state +#endif + +#ifndef HAVE_GTK_WIDGET_GET_WINDOW +#define gtk_widget_get_window(_w_) (_w_)->window +#endif + +#ifndef HAVE_GTK_WIDGET_SET_WINDOW +#define gtk_widget_set_window(_w_,_o_) ((_w_)->window = (_o_)) +#endif + +#ifndef HAVE_GTK_WIDGET_SET_HAS_WINDOW +#define gtk_widget_set_has_window(_w_, _h_) {} +#endif + +#ifndef HAVE_GTK_WIDGET_IS_DRAWABLE +#define gtk_widget_is_drawable(_w_) GTK_WIDGET_DRAWABLE(_w_) +#endif + +#ifndef HAVE_GTK_WIDGET_SET_CAN_DEFAULT +#define gtk_widget_set_can_default(_w_,_d_) do { if (_d_) GTK_WIDGET_SET_FLAGS(_w_, GTK_CAN_DEFAULT); else GTK_WIDGET_UNSET_FLAGS(_w_, GTK_CAN_DEFAULT); } while (0) +#endif + +#ifndef HAVE_GTK_WIDGET_SET_CAN_FOCUS +#define gtk_widget_set_can_focus(_w_,_f_) do { if (_f_) GTK_WIDGET_SET_FLAGS(_w_, GTK_CAN_FOCUS); else GTK_WIDGET_UNSET_FLAGS(_w_, GTK_CAN_FOCUS); } while (0) +#endif + +#ifndef HAVE_GTK_WIDGET_STYLE_ATTACH +#define gtk_widget_style_attach(_w_) (_w_->style = gtk_style_attach (_w_->style, _w_->window)) +#endif + +#endif diff --git a/configapp/src/soundmodemconfig.8 b/configapp/src/soundmodemconfig.8 new file mode 100644 index 0000000..e9fa5db --- /dev/null +++ b/configapp/src/soundmodemconfig.8 @@ -0,0 +1,28 @@ +.\" Copyright 2000 Thomas Sailer (sailer@ife.ee.ethz.ch) +.\" May be distributed under the GNU General Public License +.\" +.\" " +.TH SOUNDMODEMCONFIG 8 "1 August 2000" "SOUNDMODEM 0.2" "Linux AX.25 Utilities Manual" +.SH NAME +soundmodemconfig \- Soundcard modem configuration utility +.SH SYNOPSIS +.B soundmodemconfig +.B "[ \-sSRM ]" +.B "[\-v verbosity level]" +.B "[\-c configuration name]" + + +.SH DESCRIPTION +.B soundmodemconfig +is a GUI tool for creating a configuration file for soundmodem (8). +The default file name is /etc/ax25/soundmodem.conf, though +any other file name may be specified on the command line. + + +.SH "SEE ALSO" +.nf +.BR ifconfig "\ (8), " soundmodem "\ (8)" +.fi + +.SH AUTHOR +soundmodemconfig was written by Thomas Sailer, HB9JNX/AE4WA (sailer@ife.ee.ethz.ch). diff --git a/configapp/src/spectrum.c b/configapp/src/spectrum.c new file mode 100644 index 0000000..5f60acb --- /dev/null +++ b/configapp/src/spectrum.c @@ -0,0 +1,476 @@ +/* + * Sooundmodem Spectrum Widget + * Copyright (C) 1999-2000 Thomas Sailer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "spectrum.h" +#include "snm-compat-gtk2.h" +#include +#include +#include +#include + +#include +#include + +/* --------------------------------------------------------------------- */ + +static inline float hamming(float x) +{ + return 0.54-0.46*cos(2*M_PI*x); +} + +/* ---------------------------------------------------------------------- */ + +/* + * This fft routine is from ~gabriel/src/filters/fft/fft.c; + * I am unsure of the original source. The file contains no + * copyright notice or description. + * The declaration is changed to the prototype form but the + * function body is unchanged. (J. T. Buck) + */ + +#define SWAP(a, b) tempr=(a); (a)=(b); (b)=tempr + +/* + * Replace data by its discrete Fourier transform, if isign is + * input as 1, or by its inverse discrete Fourier transform, if + * "isign" is input as -1. "data'"is a complex array of length "nn", + * input as a real array data[0..2*nn-1]. "nn" MUST be an integer + * power of 2 (this is not checked for!?) + */ + +static void fft_rif(float *data, int nn, int isign) +{ + int n; + int mmax; + int m, j, istep, i; + float wtemp, wr, wpr, wpi, wi, theta; + float tempr, tempi; + + data--; + n = nn << 1; + j = 1; + + for (i = 1; i < n; i += 2) { + if(j > i) { + SWAP(data[j], data[i]); + SWAP(data[j+1], data[i+1]); + } + m= n >> 1; + while (m >= 2 && j >m) { + j -= m; + m >>= 1; + } + j += m; + } + mmax = 2; + while (n > mmax) { + istep = 2*mmax; + theta = -6.28318530717959/(isign*mmax); + wtemp = sin(0.5*theta); + wpr = -2.0*wtemp*wtemp; + wpi = sin(theta); + wr = 1.0; + wi = 0.0; + for (m = 1; m < mmax; m += 2) { + for (i = m; i < n; i += istep) { + j = i + mmax; + tempr = wr*data[j] - wi*data[j+1]; + tempi = wr*data[j+1] + wi*data[j]; + data[j] = data[i] - tempr; + data[j+1] = data[i+1] - tempi; + data[i] += tempr; + data[i+1] += tempi; + } + wr = (wtemp=wr)*wpr - wi*wpi+wr; + wi = wi*wpr + wtemp*wpi + wi; + } + mmax = istep; + } +} + +#undef SWAP + +/* --------------------------------------------------------------------- */ + +static inline float fsqr(float x) +{ + return x*x; +} + +/* --------------------------------------------------------------------- */ + +#define PRIO G_PRIORITY_LOW +#define DBSPAN 80 + +static void spectrum_class_init(SpectrumClass *klass); +static void spectrum_init(Spectrum *spec); +static void spectrum_finalize(GObject *object); +static gint spectrum_expose(GtkWidget *widget, GdkEventExpose *event); +static void spectrum_realize(GtkWidget *widget); +static void spectrum_unrealize(GtkWidget *widget); +static void spectrum_size_allocate(GtkWidget *widget, GtkAllocation *allocation); +static void spectrum_send_configure (Spectrum *spec); +static gint idle_callback(gpointer data); + +static GtkWidgetClass *parent_class = NULL; +static SpectrumClass *spectrum_class = NULL; + + +guint spectrum_get_type(void) +{ + static guint spectrum_type = 0; + + if (!spectrum_type) + { + static const GTypeInfo spectrum_info = + { + sizeof(SpectrumClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc)spectrum_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof(Spectrum), + 0, /* n_preallocs */ + (GInstanceInitFunc)spectrum_init, + }; + spectrum_type = g_type_register_static + (GTK_TYPE_WIDGET, "Spectrum", &spectrum_info, 0); + } + return spectrum_type; +} + +static void spectrum_class_init(SpectrumClass *klass) +{ + GObjectClass *object_class; + GtkWidgetClass *widget_class; + + object_class = (GObjectClass*)klass; + widget_class = (GtkWidgetClass*)klass; + + parent_class = g_type_class_peek(GTK_TYPE_WIDGET); + spectrum_class = klass; + + object_class->finalize = spectrum_finalize; + widget_class->expose_event = spectrum_expose; + widget_class->realize = spectrum_realize; + widget_class->unrealize = spectrum_unrealize; + widget_class->size_allocate = spectrum_size_allocate; +} + +static void spectrum_init(Spectrum *spec) +{ + spec->idlefunc = 0; + /* initialize the colors */ + spec->tracecol.red = 11796; + spec->tracecol.green = 53740; + spec->tracecol.blue = 4588; + spec->gridcol.red = 52429; + spec->gridcol.green = 52429; + spec->gridcol.blue = 52429; + spec->pointercol.red = 65535; + spec->pointercol.green = 0; + spec->pointercol.blue = 65535; + spec->trace_gc = spec->grid_gc = spec->pointer_gc = NULL; + spec->pixmap = NULL; + /* initialize the data */ + memset(&spec->y, 0, sizeof(spec->y)); + spec->pointer = 0; +} + +static void spectrum_realize(GtkWidget *widget) +{ + Spectrum *spec; + GdkWindowAttr attributes; + gint attributes_mask; + GdkGCValues gc_values; + GtkAllocation allocation; + GdkWindow *window; + GtkStyle *style; + + g_return_if_fail(widget != NULL); + g_return_if_fail(IS_SPECTRUM(widget)); + + spec = SPECTRUM(widget); + gtk_widget_set_realized(widget, TRUE); + gtk_widget_get_allocation(widget, &allocation); + + attributes.window_type = GDK_WINDOW_CHILD; + + attributes.x = allocation.x; + attributes.y = allocation.y; + attributes.width = allocation.width; + attributes.height = allocation.height; + attributes.wclass = GDK_INPUT_OUTPUT; + attributes.visual = gtk_widget_get_visual(widget); + attributes.colormap = gtk_widget_get_colormap(widget); + attributes.event_mask = gtk_widget_get_events(widget) | GDK_EXPOSURE_MASK; + + attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; + + gtk_widget_set_has_window(widget, TRUE); + window = gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, attributes_mask); + gtk_widget_set_window(widget, window); + gdk_window_set_user_data(window, spec); + + gtk_widget_style_attach(widget); + style = gtk_widget_get_style(widget); + gtk_style_set_background(style, window, GTK_STATE_NORMAL); + + /* gc's if necessary */ + if (!gdk_colormap_alloc_color(style->colormap, &spec->tracecol, + FALSE, TRUE)) + g_warning("unable to allocate color: ( %d %d %d )", + spec->tracecol.red, spec->tracecol.green, spec->tracecol.blue); + gc_values.foreground = spec->tracecol; + spec->trace_gc = gtk_gc_get(style->depth, + style->colormap, + &gc_values, GDK_GC_FOREGROUND); + if (!gdk_colormap_alloc_color(style->colormap, &spec->gridcol, + FALSE, TRUE)) + g_warning("unable to allocate color: ( %d %d %d )", + spec->gridcol.red, spec->gridcol.green, spec->gridcol.blue); + gc_values.foreground = spec->gridcol; + spec->grid_gc = gtk_gc_get(style->depth, + style->colormap, + &gc_values, GDK_GC_FOREGROUND); + if (!gdk_colormap_alloc_color(style->colormap, + &spec->pointercol, FALSE, TRUE)) + g_warning("unable to allocate color: ( %d %d %d )", + spec->pointercol.red, spec->pointercol.green, spec->pointercol.blue); + gc_values.foreground = spec->pointercol; + spec->pointer_gc = gtk_gc_get(style->depth, + style->colormap, + &gc_values, GDK_GC_FOREGROUND); + /* create backing store */ + spec->pixmap = gdk_pixmap_new(window, SPECTRUM_WIDTH, SPECTRUM_HEIGHT, -1); + + spectrum_send_configure(SPECTRUM(widget)); +} + +static void spectrum_unrealize(GtkWidget *widget) +{ + Spectrum *spec; + + g_return_if_fail(widget != NULL); + g_return_if_fail(IS_SPECTRUM(widget)); + + spec = SPECTRUM(widget); + if (spec->idlefunc) + g_source_remove(spec->idlefunc); + if (spec->trace_gc) + gtk_gc_release(spec->trace_gc); + if (spec->grid_gc) + gtk_gc_release(spec->grid_gc); + if (spec->pointer_gc) + gtk_gc_release(spec->pointer_gc); + spec->trace_gc = spec->grid_gc = spec->pointer_gc = NULL; + if (spec->pixmap) + g_object_unref(spec->pixmap); + spec->pixmap = NULL; + if (GTK_WIDGET_CLASS(parent_class)->unrealize) + (*GTK_WIDGET_CLASS(parent_class)->unrealize)(widget); +} + +static void spectrum_size_allocate(GtkWidget *widget, GtkAllocation *allocation) +{ + GtkAllocation alloc; + + g_return_if_fail(widget != NULL); + g_return_if_fail(IS_SPECTRUM(widget)); + g_return_if_fail(allocation != NULL); + + alloc = *allocation; + alloc.width = SPECTRUM_WIDTH; + alloc.height = SPECTRUM_HEIGHT; + gtk_widget_set_allocation(widget, &alloc); + + if (gtk_widget_get_realized(widget)) { + gdk_window_move_resize (gtk_widget_get_window(widget), + allocation->x, allocation->y, + allocation->width, allocation->height); + spectrum_send_configure(SPECTRUM(widget)); + } +} + +static void spectrum_send_configure(Spectrum *spec) +{ + GtkWidget *widget; + GdkEventConfigure event; + GtkAllocation allocation; + + widget = GTK_WIDGET(spec); + gtk_widget_get_allocation(widget, &allocation); + + event.type = GDK_CONFIGURE; + event.window = gtk_widget_get_window(widget); + event.send_event = TRUE; + event.x = allocation.x; + event.y = allocation.y; + event.width = allocation.width; + event.height = allocation.height; + + gtk_widget_event(widget, (GdkEvent*)&event); +} + + +GtkWidget* spectrum_new(const char *name, void *dummy0, void *dummy1, unsigned int dummy2, unsigned int dummy3) +{ + Spectrum *spec; + unsigned int i; + + spec = g_object_new(spectrum_get_type(), NULL); + memset(&spec->y, 0, sizeof(spec->y)); + for (i = 0; i < SPECTRUM_NUMSAMPLES; i++) + spec->window[i] = (1.0 / 32767.0 / SPECTRUM_NUMSAMPLES) * hamming(i * (1.0 / (SPECTRUM_NUMSAMPLES-1))); + return GTK_WIDGET(spec); +} + +static void spectrum_finalize(GObject *object) +{ + g_return_if_fail(object != NULL); + g_return_if_fail(IS_SPECTRUM(object)); + (*G_OBJECT_CLASS(parent_class)->finalize)(object); +} + +static gint spectrum_expose(GtkWidget *widget, GdkEventExpose *event) +{ + Spectrum *spec; + + g_return_val_if_fail(widget != NULL, FALSE); + g_return_val_if_fail(IS_SPECTRUM(widget), FALSE); + g_return_val_if_fail (event != NULL, FALSE); + if (gtk_widget_is_drawable(widget)) { + spec = SPECTRUM(widget); + if (!spec->idlefunc) + spec->idlefunc = g_idle_add_full(PRIO, idle_callback, spec, NULL); + } + return FALSE; +} + +static void draw(Spectrum *spec) +{ + guint segcnt, i; + GdkPoint pt[SPECTRUM_WIDTH+1]; + GdkSegment seg[100], *segp; + GtkWidget *widget; + GtkAllocation allocation; + GtkStyle *style; + + widget = GTK_WIDGET(spec); + g_return_if_fail(gtk_widget_is_drawable(widget)); + g_return_if_fail(spec->pixmap); + gtk_widget_get_allocation(widget, &allocation); + style = gtk_widget_get_style(widget); + /* calculate grid segments */ + for (segp = seg, segcnt = i = 0; i < SPECTRUM_WIDTH; i += SPECTRUM_WIDTH/8) { + segp->x1 = segp->x2 = i; + segp->y1 = 0; + segp->y2 = SPECTRUM_HEIGHT-1; + segp++; + segcnt++; + } + for (i = 0; i < SPECTRUM_HEIGHT; i += (SPECTRUM_HEIGHT * 10 + DBSPAN/2) / DBSPAN) { + segp->y1 = segp->y2 = i; + segp->x1 = 0; + segp->x2 = SPECTRUM_WIDTH-1; + segp++; + segcnt++; + } + /* copy data points */ + for (i = 0; i < SPECTRUM_WIDTH; i++) { + pt[i].x = i; + pt[i].y = spec->y[i]; + } + /* clear window */ + gdk_draw_rectangle(spec->pixmap, style->base_gc[gtk_widget_get_state(widget)], + TRUE, 0, 0, + allocation.width, + allocation.height); + /* draw grid */ + gdk_draw_segments(spec->pixmap, spec->grid_gc, seg, segcnt); + /* draw markers */ + gdk_draw_line(spec->pixmap, spec->pointer_gc, + spec->pointer, + 0, + spec->pointer, + allocation.height-1); + /* draw trace */ + gdk_draw_lines(spec->pixmap, spec->trace_gc, pt, SPECTRUM_WIDTH); + /* draw to screen */ + gdk_draw_drawable(gtk_widget_get_window(widget), style->base_gc[gtk_widget_get_state(widget)], spec->pixmap, + 0, 0, 0, 0, allocation.width, allocation.height); +} + + +static gint idle_callback(gpointer data) +{ + g_return_val_if_fail(data != NULL, FALSE); + g_return_val_if_fail(IS_SPECTRUM(data), FALSE); + SPECTRUM(data)->idlefunc = 0; + if (!gtk_widget_is_drawable(GTK_WIDGET(data))) + return FALSE; + draw(SPECTRUM(data)); + return FALSE; /* don't call this callback again */ +} + +void spectrum_setdata(Spectrum *spec, short *samples) +{ + float fdata[2*SPECTRUM_NUMSAMPLES]; + float f; + unsigned int i; + + g_return_if_fail(spec != NULL); + g_return_if_fail(IS_SPECTRUM(spec)); + for (i = 0; i < SPECTRUM_NUMSAMPLES; i++) { + fdata[2*i] = samples[i] * spec->window[i]; + fdata[2*i+1] = 0; + } + fft_rif(fdata, SPECTRUM_NUMSAMPLES, 1); + for (i = 0; i < SPECTRUM_NUMSAMPLES; i++) { + f = log10(fsqr(fdata[2*i]) + fsqr(fdata[2*i+1])); + f *= -(10.0 * SPECTRUM_HEIGHT / DBSPAN); + if (f < 0) + f = 0; + if (f > SPECTRUM_HEIGHT-1) + f = SPECTRUM_HEIGHT-1; + spec->y[i] = f; + } + if (gtk_widget_is_drawable(GTK_WIDGET(spec))) { + if (!spec->idlefunc) + spec->idlefunc = g_idle_add_full(PRIO, idle_callback, spec, NULL); + } +} + +void spectrum_setmarker(Spectrum *spec, int pointer) +{ + g_return_if_fail(spec != NULL); + g_return_if_fail(IS_SPECTRUM(spec)); + if (pointer >= 0 && pointer < SPECTRUM_WIDTH) + spec->pointer = pointer; + if (gtk_widget_is_drawable(GTK_WIDGET(spec))) { + if (!spec->idlefunc) + spec->idlefunc = g_idle_add_full(PRIO, idle_callback, spec, NULL); + } +} diff --git a/configapp/src/spectrum.h b/configapp/src/spectrum.h new file mode 100644 index 0000000..b71495f --- /dev/null +++ b/configapp/src/spectrum.h @@ -0,0 +1,81 @@ +/* + * Spectrum Widget + * Copyright (C) 1999-2000 Thomas Sailer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library 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. + */ + +#ifndef __SPECTRUM_H__ +#define __SPECTRUM_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define SPECTRUM(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, spectrum_get_type(), Spectrum) +#define SPECTRUM_CLASS(klass) G_TYPE_CHECK_CLASS_CAST(klass, spectrum_get_type(), SpectrumClass) +#define IS_SPECTRUM(obj) G_TYPE_CHECK_INSTANCE_TYPE(obj, spectrum_get_type()) + +typedef struct _Spectrum Spectrum; +typedef struct _SpectrumClass SpectrumClass; + +#define SPECTRUM_NUMSAMPLES 1024 + +#define SPECTRUM_WIDTH ((SPECTRUM_NUMSAMPLES) >> 1) +#define SPECTRUM_HEIGHT 384 + +struct _Spectrum +{ + GtkWidget widget; + + guint idlefunc; + GdkGC *trace_gc; + GdkGC *grid_gc; + GdkGC *pointer_gc; + GdkColor tracecol; + GdkColor gridcol; + GdkColor pointercol; + + GdkPixmap *pixmap; + + /* marker */ + unsigned int pointer; + + unsigned short y[SPECTRUM_WIDTH]; + float window[SPECTRUM_NUMSAMPLES]; +}; + +struct _SpectrumClass +{ + GtkWidgetClass parent_class; +}; + + +guint spectrum_get_type(void); +GtkWidget* spectrum_new(const char *name, void *dummy0, void *dummy1, unsigned int dummy2, unsigned int dummy3); +void spectrum_setdata(Spectrum *spec, short *samples); +void spectrum_setmarker(Spectrum *spec, int pointer); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __SPECTRUM_H__ */ diff --git a/configapp/src/support.c b/configapp/src/support.c new file mode 100644 index 0000000..f2e61b8 --- /dev/null +++ b/configapp/src/support.c @@ -0,0 +1,144 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include + +#include + +#include "support.h" + +GtkWidget* +lookup_widget (GtkWidget *widget, + const gchar *widget_name) +{ + GtkWidget *parent, *found_widget; + + for (;;) + { + if (GTK_IS_MENU (widget)) + parent = gtk_menu_get_attach_widget (GTK_MENU (widget)); + else + parent = gtk_widget_get_parent(widget); + if (!parent) + parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey"); + if (parent == NULL) + break; + widget = parent; + } + + found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget), + widget_name); + if (!found_widget) + g_warning ("Widget not found: %s", widget_name); + return found_widget; +} + +static GList *pixmaps_directories = NULL; + +/* Use this function to set the directory containing installed pixmaps. */ +void +add_pixmap_directory (const gchar *directory) +{ + pixmaps_directories = g_list_prepend (pixmaps_directories, + g_strdup (directory)); +} + +/* This is an internally used function to find pixmap files. */ +static gchar* +find_pixmap_file (const gchar *filename) +{ + GList *elem; + + /* We step through each of the pixmaps directory to find it. */ + elem = pixmaps_directories; + while (elem) + { + gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data, + G_DIR_SEPARATOR_S, filename); + if (g_file_test (pathname, G_FILE_TEST_EXISTS)) + return pathname; + g_free (pathname); + elem = elem->next; + } + return NULL; +} + +/* This is an internally used function to create pixmaps. */ +GtkWidget* +create_pixmap (GtkWidget *widget, + const gchar *filename) +{ + gchar *pathname = NULL; + GtkWidget *pixmap; + + if (!filename || !filename[0]) + return gtk_image_new (); + + pathname = find_pixmap_file (filename); + + if (!pathname) + { + g_warning (_("Couldn't find pixmap file: %s"), filename); + return gtk_image_new (); + } + + pixmap = gtk_image_new_from_file (pathname); + g_free (pathname); + return pixmap; +} + +/* This is an internally used function to create pixmaps. */ +GdkPixbuf* +create_pixbuf (const gchar *filename) +{ + gchar *pathname = NULL; + GdkPixbuf *pixbuf; + GError *error = NULL; + + if (!filename || !filename[0]) + return NULL; + + pathname = find_pixmap_file (filename); + + if (!pathname) + { + g_warning (_("Couldn't find pixmap file: %s"), filename); + return NULL; + } + + pixbuf = gdk_pixbuf_new_from_file (pathname, &error); + if (!pixbuf) + { + fprintf (stderr, "Failed to load pixbuf file: %s: %s\n", + pathname, error->message); + g_error_free (error); + } + g_free (pathname); + return pixbuf; +} + +/* This is used to set ATK action descriptions. */ +void +glade_set_atk_action_description (AtkAction *action, + const gchar *action_name, + const gchar *description) +{ + gint n_actions, i; + + n_actions = atk_action_get_n_actions (action); + for (i = 0; i < n_actions; i++) + { + if (!strcmp (atk_action_get_name (action, i), action_name)) + atk_action_set_description (action, i, description); + } +} + diff --git a/configapp/src/support.h b/configapp/src/support.h new file mode 100644 index 0000000..a32649e --- /dev/null +++ b/configapp/src/support.h @@ -0,0 +1,69 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +/* + * Standard gettext macros. + */ +#ifdef ENABLE_NLS +# include +# undef _ +# define _(String) dgettext (PACKAGE, String) +# define Q_(String) g_strip_context ((String), gettext (String)) +# ifdef gettext_noop +# define N_(String) gettext_noop (String) +# else +# define N_(String) (String) +# endif +#else +# define textdomain(String) (String) +# define gettext(String) (String) +# define dgettext(Domain,Message) (Message) +# define dcgettext(Domain,Message,Type) (Message) +# define bindtextdomain(Domain,Directory) (Domain) +# define _(String) (String) +# define Q_(String) g_strip_context ((String), (String)) +# define N_(String) (String) +#endif + + +/* + * Public Functions. + */ + +/* + * This function returns a widget in a component created by Glade. + * Call it with the toplevel widget in the component (i.e. a window/dialog), + * or alternatively any widget in the component, and the name of the widget + * you want returned. + */ +GtkWidget* lookup_widget (GtkWidget *widget, + const gchar *widget_name); + + +/* Use this function to set the directory containing installed pixmaps. */ +void add_pixmap_directory (const gchar *directory); + + +/* + * Private Functions. + */ + +/* This is used to create the pixmaps used in the interface. */ +GtkWidget* create_pixmap (GtkWidget *widget, + const gchar *filename); + +/* This is used to create the pixbufs used in the interface. */ +GdkPixbuf* create_pixbuf (const gchar *filename); + +/* This is used to set ATK action descriptions. */ +void glade_set_atk_action_description (AtkAction *action, + const gchar *action_name, + const gchar *description); + diff --git a/configure b/configure new file mode 100755 index 0000000..c917040 --- /dev/null +++ b/configure @@ -0,0 +1,11897 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.68. +# +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +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 +IFS=$as_save_IFS + + ;; +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 + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; 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 + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# 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 + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_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 sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# 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'" + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= +PACKAGE_URL= + +ac_unique_file="soundmodem.spec" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +gt_needs= +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +WIN32 +PTHREAD_CFLAGS +PTHREAD_LIBS +USEVIS +USEMMX +LIBTHREAD +M_PI +HAVE_IFRNEWNAME +HAVE_MKISS +HAVE_DIRECTX +HAVE_BITTYPES +WIN32_FALSE +WIN32_TRUE +DIRECTX_FALSE +DIRECTX_TRUE +CROSSCOMP_FALSE +CROSSCOMP_TRUE +USEVIS_FALSE +USEVIS_TRUE +USEMMX_FALSE +USEMMX_TRUE +AUDIOFILE_LIBS +AUDIOFILE_CFLAGS +GTK_LIBS +GTK_CFLAGS +XML_LIBS +XML_CFLAGS +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH +PKG_CONFIG +POSUB +LTLIBINTL +LIBINTL +INTLLIBS +LTLIBICONV +LIBICONV +INTL_MACOSX_LIBS +XGETTEXT_EXTRA_OPTIONS +MSGMERGE +XGETTEXT_015 +XGETTEXT +GMSGFMT_015 +MSGFMT_015 +GMSGFMT +MSGFMT +GETTEXT_MACRO_VERSION +USE_NLS +HAVE_ALSA +ALSA_LIBS +ALSA_CFLAGS +LIBOBJS +WINDRES +LD +AR +AS +DLLTOOL +RANLIB +am__fastdepCXX_FALSE +am__fastdepCXX_TRUE +CXXDEPMODE +ac_ct_CXX +CXXFLAGS +CXX +ALLOCA +EGREP +GREP +CPP +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__quote +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +target_os +target_vendor +target_cpu +target +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_dependency_tracking +with_alsa_prefix +with_alsa_inc_prefix +enable_alsatest +enable_nls +with_gnu_ld +enable_rpath +with_libiconv_prefix +with_libintl_prefix +enable_mmx +enable_vis +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +CXX +CXXFLAGS +CCC +PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR +XML_CFLAGS +XML_LIBS +GTK_CFLAGS +GTK_LIBS +AUDIOFILE_CFLAGS +AUDIOFILE_LIBS' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# 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. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +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 + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -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) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$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 ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$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 ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + 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 ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$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_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=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 ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_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'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +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 + $as_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 + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# 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 the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + 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 + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# 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 this package 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 \`..'] + +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] + --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] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] + --target=TARGET configure for building compilers for TARGET [HOST] +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --disable-alsatest Do not try to compile and run a test Alsa program + --disable-nls do not use Native Language Support + --disable-rpath do not hardcode runtime library paths + --enable-mmx Utilize MMX(tm) instructions if available (x86 only) + --enable-vis Utilize VIS(tm) instructions if available (ultrasparc only) + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-alsa-prefix=PFX Prefix where Alsa library is installed(optional) + --with-alsa-inc-prefix=PFX Prefix where include libraries are (optional) + --with-gnu-ld assume the C compiler uses GNU ld default=no + --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib + --without-libiconv-prefix don't search for libiconv in includedir and libdir + --with-libintl-prefix[=DIR] search for libintl in DIR/include and DIR/lib + --without-libintl-prefix don't search for libintl in includedir and libdir + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + CXX C++ compiler command + CXXFLAGS C++ compiler flags + PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path + XML_CFLAGS C compiler flags for XML, overriding pkg-config + XML_LIBS linker flags for XML, overriding pkg-config + GTK_CFLAGS C compiler flags for GTK, overriding pkg-config + GTK_LIBS linker flags for GTK, overriding pkg-config + AUDIOFILE_CFLAGS + C compiler flags for AUDIOFILE, overriding pkg-config + AUDIOFILE_LIBS + linker flags for AUDIOFILE, overriding pkg-config + +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 the package provider. +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested 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 + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +configure +generated by GNU Autoconf 2.68 + +Copyright (C) 2010 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 +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* 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_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func + +# ac_fn_cxx_try_compile LINENO +# ---------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_compile + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.68. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +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` +/usr/bin/hostinfo = `(/usr/bin/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=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&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_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=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append 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 + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset 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: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > 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 + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + 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. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +gt_needs="$gt_needs " +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; 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,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_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 + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_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. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +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_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 + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 +$as_echo_n "checking target system type... " >&6; } +if ${ac_cv_target+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$target_alias" = x; then + ac_cv_target=$ac_cv_host +else + ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 +$as_echo "$ac_cv_target" >&6; } +case $ac_cv_target in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; +esac +target=$ac_cv_target +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_target +shift +target_cpu=$1 +target_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +target_os=$* +IFS=$ac_save_IFS +case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac + + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + + +am__api_version='1.11' + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; +esac + +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken +alias in your environment" "$LINENO" 5 + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if ${ac_cv_path_mkdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac + +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AWK+:} false; then : + $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE=soundmodem + VERSION=0.16 + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + + +ac_config_headers="$ac_config_headers config.h" + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from `make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +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 +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM 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. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; 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 | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* 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 -std 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 -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 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 +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +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 + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing strerror" >&5 +$as_echo_n "checking for library containing strerror... " >&6; } +if ${ac_cv_search_strerror+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char strerror (); +int +main () +{ +return strerror (); + ; + return 0; +} +_ACEOF +for ac_lib in '' cposix; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_strerror=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_strerror+:} false; then : + break +fi +done +if ${ac_cv_search_strerror+:} false; then : + +else + ac_cv_search_strerror=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_strerror" >&5 +$as_echo "$ac_cv_search_strerror" >&6; } +ac_res=$ac_cv_search_strerror +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +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 +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* 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 -std 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 -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 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 +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +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 + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +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 +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* 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 -std 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 -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 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 +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +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 + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + +am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +$as_echo_n "checking for an ANSI C-conforming const... " >&6; } +if ${ac_cv_c_const+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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 cs; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *pcpcc; + char **ppc; + /* 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"; + pcpcc = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++pcpcc; + ppc = (char**) pcpcc; + pcpcc = (char const *const *) ppc; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + if (s) return 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; + if (!foo) return 0; + } + return !cs[0] && !zero.x; +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_const=yes +else + ac_cv_c_const=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +$as_echo "$ac_cv_c_const" >&6; } +if test $ac_cv_c_const = no; then + +$as_echo "#define const /**/" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if ${ac_cv_c_inline+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* 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 +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_inline=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +$as_echo "$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 + +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&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 to if __STDC__ is defined, since + # 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$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 to if __STDC__ is defined, since + # 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +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 + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#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)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +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=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF + +fi + +# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 +$as_echo_n "checking for working alloca.h... " >&6; } +if ${ac_cv_working_alloca_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +char *p = (char *) alloca (2 * sizeof (int)); + if (p) return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_working_alloca_h=yes +else + ac_cv_working_alloca_h=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 +$as_echo "$ac_cv_working_alloca_h" >&6; } +if test $ac_cv_working_alloca_h = yes; then + +$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 +$as_echo_n "checking for alloca... " >&6; } +if ${ac_cv_func_alloca_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __GNUC__ +# define alloca __builtin_alloca +#else +# ifdef _MSC_VER +# include +# define alloca _alloca +# else +# ifdef HAVE_ALLOCA_H +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +void *alloca (size_t); +# endif +# endif +# endif +# endif +#endif + +int +main () +{ +char *p = (char *) alloca (1); + if (p) return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_func_alloca_works=yes +else + ac_cv_func_alloca_works=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 +$as_echo "$ac_cv_func_alloca_works" >&6; } + +if test $ac_cv_func_alloca_works = yes; then + +$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h + +else + # The SVR3 libPW and SVR4 libucb both contain incompatible functions +# that cause trouble. Some versions do not even contain alloca or +# contain a buggy version. If you still want to use their alloca, +# use ar to extract alloca.o from them instead of compiling alloca.c. + +ALLOCA=\${LIBOBJDIR}alloca.$ac_objext + +$as_echo "#define C_ALLOCA 1" >>confdefs.h + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5 +$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } +if ${ac_cv_os_cray+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined CRAY && ! defined CRAY2 +webecray +#else +wenotbecray +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "webecray" >/dev/null 2>&1; then : + ac_cv_os_cray=yes +else + ac_cv_os_cray=no +fi +rm -f conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5 +$as_echo "$ac_cv_os_cray" >&6; } +if test $ac_cv_os_cray = yes; then + for ac_func in _getb67 GETB67 getb67; do + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + +cat >>confdefs.h <<_ACEOF +#define CRAY_STACKSEG_END $ac_func +_ACEOF + + break +fi + + done +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 +$as_echo_n "checking stack direction for C alloca... " >&6; } +if ${ac_cv_c_stack_direction+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_c_stack_direction=0 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +find_stack_direction () +{ + static char *addr = 0; + auto char dummy; + if (addr == 0) + { + addr = &dummy; + return find_stack_direction (); + } + else + return (&dummy > addr) ? 1 : -1; +} + +int +main () +{ + return find_stack_direction () < 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_c_stack_direction=1 +else + ac_cv_c_stack_direction=-1 +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 +$as_echo "$ac_cv_c_stack_direction" >&6; } +cat >>confdefs.h <<_ACEOF +#define STACK_DIRECTION $ac_cv_c_stack_direction +_ACEOF + + +fi + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +$as_echo "$CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +$as_echo "$ac_ct_CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 +$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } +if ${ac_cv_cxx_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= +fi +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +$as_echo_n "checking whether $CXX accepts -g... " >&6; } +if ${ac_cv_prog_cxx_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_g=yes +else + CXXFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + +else + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +$as_echo "$ac_cv_prog_cxx_g" >&6; } +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +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 + +depcc="$CXX" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CXX_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RANLIB+:} false; then : + $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DLLTOOL="dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_DLLTOOL" && ac_cv_prog_DLLTOOL="dlltool" +fi +fi +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "as", so it can be a program name with args. +set dummy as; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AS+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AS"; then + ac_cv_prog_AS="$AS" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in as +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AS="as" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="as" +fi +fi +AS=$ac_cv_prog_AS +if test -n "$AS"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 +$as_echo "$AS" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in ar +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AR="ar" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar" +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "ld", so it can be a program name with args. +set dummy ld; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$LD"; then + ac_cv_prog_LD="$LD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in ld +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_LD="ld" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_LD" && ac_cv_prog_LD="ld" +fi +fi +LD=$ac_cv_prog_LD +if test -n "$LD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "windres", so it can be a program name with args. +set dummy windres; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_WINDRES+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$WINDRES"; then + ac_cv_prog_WINDRES="$WINDRES" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_WINDRES="windres" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_WINDRES" && ac_cv_prog_WINDRES="i686-pc-cygwin-windres" +fi +fi +WINDRES=$ac_cv_prog_WINDRES +if test -n "$WINDRES"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WINDRES" >&5 +$as_echo "$WINDRES" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + +case $host_os in + *cygwin* ) CYGWIN=yes;; + * ) CYGWIN=no;; +esac + + +case $host_os in + *mingw32* ) MINGW32=yes;; + * ) MINGW32=no;; +esac + + + + +if test x$cross_compiling = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cross compiler path" >&5 +$as_echo_n "checking for cross compiler path... " >&6; } + if test -d /usr/local/cross/i686-pc-cygwin; then + CROSSCOMPPATH=/usr/local/cross/i686-pc-cygwin + elif test -d /usr/local/cygwin/i686-pc-cygwin; then + CROSSCOMPPATH=/usr/local/cygwin/i686-pc-cygwin + else + as_fn_error $? "\"cross compiler not found\"" "$LINENO" 5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CROSSCOMPPATH" >&5 +$as_echo "$CROSSCOMPPATH" >&6; } +fi + +if test x$CYGWIN != xyes -a x$MINGW32 != xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqrt in -lm" >&5 +$as_echo_n "checking for sqrt in -lm... " >&6; } +if ${ac_cv_lib_m_sqrt+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char sqrt (); +int +main () +{ +return sqrt (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_m_sqrt=yes +else + ac_cv_lib_m_sqrt=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_sqrt" >&5 +$as_echo "$ac_cv_lib_m_sqrt" >&6; } +if test "x$ac_cv_lib_m_sqrt" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBM 1 +_ACEOF + + LIBS="-lm $LIBS" + +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread32" >&5 +$as_echo_n "checking for pthread_create in -lpthread32... " >&6; } +if ${ac_cv_lib_pthread32_pthread_create+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread32 $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_create (); +int +main () +{ +return pthread_create (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_pthread32_pthread_create=yes +else + ac_cv_lib_pthread32_pthread_create=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread32_pthread_create" >&5 +$as_echo "$ac_cv_lib_pthread32_pthread_create" >&6; } +if test "x$ac_cv_lib_pthread32_pthread_create" = xyes; then : + LIBTHREAD="$LIBTHREAD -lpthread32" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 +$as_echo_n "checking for pthread_create in -lpthread... " >&6; } +if ${ac_cv_lib_pthread_pthread_create+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_create (); +int +main () +{ +return pthread_create (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_pthread_pthread_create=yes +else + ac_cv_lib_pthread_pthread_create=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 +$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } +if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : + LIBTHREAD="$LIBTHREAD -lpthread" +fi + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sched_setscheduler in -lposix4" >&5 +$as_echo_n "checking for sched_setscheduler in -lposix4... " >&6; } +if ${ac_cv_lib_posix4_sched_setscheduler+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lposix4 $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char sched_setscheduler (); +int +main () +{ +return sched_setscheduler (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_posix4_sched_setscheduler=yes +else + ac_cv_lib_posix4_sched_setscheduler=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix4_sched_setscheduler" >&5 +$as_echo "$ac_cv_lib_posix4_sched_setscheduler" >&6; } +if test "x$ac_cv_lib_posix4_sched_setscheduler" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBPOSIX4 1 +_ACEOF + + LIBS="-lposix4 $LIBS" + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GUID_NULL in -luuid" >&5 +$as_echo_n "checking for GUID_NULL in -luuid... " >&6; } +if ${ac_cv_lib_uuid_GUID_NULL+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-luuid $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char GUID_NULL (); +int +main () +{ +return GUID_NULL (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_uuid_GUID_NULL=yes +else + ac_cv_lib_uuid_GUID_NULL=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_uuid_GUID_NULL" >&5 +$as_echo "$ac_cv_lib_uuid_GUID_NULL" >&6; } +if test "x$ac_cv_lib_uuid_GUID_NULL" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBUUID 1 +_ACEOF + + LIBS="-luuid $LIBS" + +fi + +for ac_func in getopt_long +do : + ac_fn_c_check_func "$LINENO" "getopt_long" "ac_cv_func_getopt_long" +if test "x$ac_cv_func_getopt_long" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GETOPT_LONG 1 +_ACEOF + +else + case " $LIBOBJS " in + *" getopt.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS getopt.$ac_objext" + ;; +esac + case " $LIBOBJS " in + *" getopt1.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS getopt1.$ac_objext" + ;; +esac + +fi +done + +for ac_header in sys/audioio.h stropts.h sys/conf.h sys/soundcard.h sys/ioctl.h time.h inttypes.h net/if_arp.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_header in pty.h getopt.h syslog.h sched.h linux/sockios.h sys/ioccom.h linux/ppdev.h linux/hidraw.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_header in sys/socket.h linux/if.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " +#if HAVE_SYS_SOCKET_H +# include +#endif + +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_header in sys/socket.h linux/ax25.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " +#if HAVE_SYS_SOCKET_H +# include +#endif + +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_func in snprintf vsnprintf syslog vsyslog openlog closelog +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +for ac_func in mlockall +do : + ac_fn_c_check_func "$LINENO" "mlockall" "ac_cv_func_mlockall" +if test "x$ac_cv_func_mlockall" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_MLOCKALL 1 +_ACEOF + +fi +done + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for signed bittypes" >&5 +$as_echo_n "checking for signed bittypes... " >&6; } +signedbittypes=no +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + int8_t a; int16_t c; int32_t e; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +$as_echo "#define HAVE_SIGNED_BITTYPES 1" >>confdefs.h + signedbittypes=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $signedbittypes" >&5 +$as_echo "$signedbittypes" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for unsigned bittypes" >&5 +$as_echo_n "checking for unsigned bittypes... " >&6; } +unsignedbittypes=no +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + u_int8_t b; u_int16_t d; u_int32_t f; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +$as_echo "#define HAVE_UNSIGNED_BITTYPES 1" >>confdefs.h + unsignedbittypes=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $unsignedbittypes" >&5 +$as_echo "$unsignedbittypes" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 +$as_echo_n "checking return type of signal handlers... " >&6; } +if ${ac_cv_type_signal+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include + +int +main () +{ +return *(signal (0, 0)) (0) == 1; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_type_signal=int +else + ac_cv_type_signal=void +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 +$as_echo "$ac_cv_type_signal" >&6; } + +cat >>confdefs.h <<_ACEOF +#define RETSIGTYPE $ac_cv_type_signal +_ACEOF + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for M_PI" >&5 +$as_echo_n "checking for M_PI... " >&6; } +mpi=no +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + double f = M_PI; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mpi=yes +else + +$as_echo "#define M_PI 3.14159265358979323846" >>confdefs.h + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpi" >&5 +$as_echo "$mpi" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for M_LOG10E" >&5 +$as_echo_n "checking for M_LOG10E... " >&6; } +mlog10e=no +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + double f = M_LOG10E; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + mlog10e=yes +else + +$as_echo "#define M_LOG10E 0.43429448190325182765" >>confdefs.h + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mlog10e" >&5 +$as_echo "$mlog10e" >&6; } + +case $target_os in + linux*) + alsa_save_CFLAGS="$CFLAGS" +alsa_save_LDFLAGS="$LDFLAGS" +alsa_save_LIBS="$LIBS" +alsa_found=yes + + +# Check whether --with-alsa-prefix was given. +if test "${with_alsa_prefix+set}" = set; then : + withval=$with_alsa_prefix; alsa_prefix="$withval" +else + alsa_prefix="" +fi + + + +# Check whether --with-alsa-inc-prefix was given. +if test "${with_alsa_inc_prefix+set}" = set; then : + withval=$with_alsa_inc_prefix; alsa_inc_prefix="$withval" +else + alsa_inc_prefix="" +fi + + +# Check whether --enable-alsatest was given. +if test "${enable_alsatest+set}" = set; then : + enableval=$enable_alsatest; enable_alsatest="$enableval" +else + enable_alsatest=yes +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ALSA CFLAGS" >&5 +$as_echo_n "checking for ALSA CFLAGS... " >&6; } +if test "$alsa_inc_prefix" != "" ; then + ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix" + CFLAGS="$CFLAGS -I$alsa_inc_prefix" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ALSA_CFLAGS" >&5 +$as_echo "$ALSA_CFLAGS" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ALSA LDFLAGS" >&5 +$as_echo_n "checking for ALSA LDFLAGS... " >&6; } +if test "$alsa_prefix" != "" ; then + ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix" + LDFLAGS="$LDFLAGS $ALSA_LIBS" +fi + +ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl -lpthread" +LIBS="$ALSA_LIBS $LIBS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ALSA_LIBS" >&5 +$as_echo "$ALSA_LIBS" >&6; } + +min_alsa_version=1.0.0 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libasound headers version >= $min_alsa_version" >&5 +$as_echo_n "checking for libasound headers version >= $min_alsa_version... " >&6; } +no_alsa="" + alsa_min_major_version=`echo $min_alsa_version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` + alsa_min_minor_version=`echo $min_alsa_version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` + alsa_min_micro_version=`echo $min_alsa_version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` + + +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 + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include + +int +main () +{ + +/* ensure backward compatibility */ +#if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR) +#define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR +#endif +#if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR) +#define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR +#endif +#if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR) +#define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR +#endif + +# if(SND_LIB_MAJOR > $alsa_min_major_version) + exit(0); +# else +# if(SND_LIB_MAJOR < $alsa_min_major_version) +# error not present +# endif + +# if(SND_LIB_MINOR > $alsa_min_minor_version) + exit(0); +# else +# if(SND_LIB_MINOR < $alsa_min_minor_version) +# error not present +# endif + +# if(SND_LIB_SUBMINOR < $alsa_min_micro_version) +# error not present +# endif +# endif +# endif +exit(0); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found." >&5 +$as_echo "found." >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not present." >&5 +$as_echo "not present." >&6; } + as_fn_error $? "Sufficiently new version of libasound not found." "$LINENO" 5 + alsa_found=no + +fi +rm -f core 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$enable_alsatest" = "xyes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for snd_ctl_open in -lasound" >&5 +$as_echo_n "checking for snd_ctl_open in -lasound... " >&6; } +if ${ac_cv_lib_asound_snd_ctl_open+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lasound $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char snd_ctl_open (); +int +main () +{ +return snd_ctl_open (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_asound_snd_ctl_open=yes +else + ac_cv_lib_asound_snd_ctl_open=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_asound_snd_ctl_open" >&5 +$as_echo "$ac_cv_lib_asound_snd_ctl_open" >&6; } +if test "x$ac_cv_lib_asound_snd_ctl_open" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBASOUND 1 +_ACEOF + + LIBS="-lasound $LIBS" + +else + as_fn_error $? "No linkable libasound was found." "$LINENO" 5 + alsa_found=no + +fi + +fi + +if test "x$alsa_found" = "xyes" ; then + +$as_echo "#define HAVE_ALSA 1" >>confdefs.h + + LIBS=`echo $LIBS | sed 's/-lasound//g'` + LIBS=`echo $LIBS | sed 's/ //'` + LIBS="-lasound $LIBS" +fi +if test "x$alsa_found" = "xno" ; then + : + CFLAGS="$alsa_save_CFLAGS" + LDFLAGS="$alsa_save_LDFLAGS" + LIBS="$alsa_save_LIBS" + ALSA_CFLAGS="" + ALSA_LIBS="" +fi + + + + + ;; +esac + + +ALL_LINGUAS="sv fr" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NLS is requested" >&5 +$as_echo_n "checking whether NLS is requested... " >&6; } + # Check whether --enable-nls was given. +if test "${enable_nls+set}" = set; then : + enableval=$enable_nls; USE_NLS=$enableval +else + USE_NLS=yes +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 +$as_echo "$USE_NLS" >&6; } + + + + + GETTEXT_MACRO_VERSION=0.18 + + + + +# Prepare PATH_SEPARATOR. +# 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 + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_MSGFMT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case "$MSGFMT" in + [\\/]* | ?:[\\/]*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&5 + if $ac_dir/$ac_word --statistics /dev/null >&5 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test "$MSGFMT" != ":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5 +$as_echo "$MSGFMT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_GMSGFMT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $GMSGFMT in + [\\/]* | ?:[\\/]*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + *) + 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT=$ac_cv_path_GMSGFMT +if test -n "$GMSGFMT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GMSGFMT" >&5 +$as_echo "$GMSGFMT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;; + *) MSGFMT_015=$MSGFMT ;; + esac + + case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; + *) GMSGFMT_015=$GMSGFMT ;; + esac + + + +# Prepare PATH_SEPARATOR. +# 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 + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_XGETTEXT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case "$XGETTEXT" in + [\\/]* | ?:[\\/]*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&5 + if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&5 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test "$XGETTEXT" != ":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5 +$as_echo "$XGETTEXT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + rm -f messages.po + + case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; + *) XGETTEXT_015=$XGETTEXT ;; + esac + + + +# Prepare PATH_SEPARATOR. +# 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 + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "msgmerge", so it can be a program name with args. +set dummy msgmerge; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_MSGMERGE+:} false; then : + $as_echo_n "(cached) " >&6 +else + case "$MSGMERGE" in + [\\/]* | ?:[\\/]*) + ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&5 + if $ac_dir/$ac_word --update -q /dev/null /dev/null >&5 2>&1; then + ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" + test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" + ;; +esac +fi +MSGMERGE="$ac_cv_path_MSGMERGE" +if test "$MSGMERGE" != ":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGMERGE" >&5 +$as_echo "$MSGMERGE" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$localedir" || localedir='${datadir}/locale' + + + test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= + + + ac_config_commands="$ac_config_commands po-directories" + + + + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +# Prepare PATH_SEPARATOR. +# 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 +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by GCC" >&5 +$as_echo_n "checking for ld used by GCC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if ${acl_cv_path_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in + *GNU* | *'with BFD'*) + test "$with_gnu_ld" != no && break ;; + *) + test "$with_gnu_ld" != yes && break ;; + esac + fi + done + IFS="$ac_save_ifs" +else + acl_cv_path_LD="$LD" # Let the user override the test with a path. +fi +fi + +LD="$acl_cv_path_LD" +if test -n "$LD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if ${acl_cv_prog_gnu_ld+:} false; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$acl_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$acl_cv_prog_gnu_ld + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5 +$as_echo_n "checking for shared library run path origin... " >&6; } +if ${acl_cv_rpath+:} false; then : + $as_echo_n "(cached) " >&6 +else + + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5 +$as_echo "$acl_cv_rpath" >&6; } + wl="$acl_cv_wl" + acl_libext="$acl_cv_libext" + acl_shlibext="$acl_cv_shlibext" + acl_libname_spec="$acl_cv_libname_spec" + acl_library_names_spec="$acl_cv_library_names_spec" + acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + acl_hardcode_direct="$acl_cv_hardcode_direct" + acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" + # Check whether --enable-rpath was given. +if test "${enable_rpath+set}" = set; then : + enableval=$enable_rpath; : +else + enable_rpath=yes +fi + + + + + acl_libdirstem=lib + acl_libdirstem2= + case "$host_os" in + solaris*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit host" >&5 +$as_echo_n "checking for 64-bit host... " >&6; } +if ${gl_cv_solaris_64bit+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef _LP64 +sixtyfour bits +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "sixtyfour bits" >/dev/null 2>&1; then : + gl_cv_solaris_64bit=yes +else + gl_cv_solaris_64bit=no +fi +rm -f conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_solaris_64bit" >&5 +$as_echo "$gl_cv_solaris_64bit" >&6; } + if test $gl_cv_solaris_64bit = yes; then + acl_libdirstem=lib/64 + case "$host_cpu" in + sparc*) acl_libdirstem2=lib/sparcv9 ;; + i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; + esac + fi + ;; + *) + searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` + if test -n "$searchpath"; then + acl_save_IFS="${IFS= }"; IFS=":" + for searchdir in $searchpath; do + if test -d "$searchdir"; then + case "$searchdir" in + */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; + */../ | */.. ) + # Better ignore directories of this form. They are misleading. + ;; + *) searchdir=`cd "$searchdir" && pwd` + case "$searchdir" in + */lib64 ) acl_libdirstem=lib64 ;; + esac ;; + esac + fi + done + IFS="$acl_save_IFS" + fi + ;; + esac + test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" + + + + + + + + + + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + +# Check whether --with-libiconv-prefix was given. +if test "${with_libiconv_prefix+set}" = set; then : + withval=$with_libiconv_prefix; + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + if test "$acl_libdirstem2" != "$acl_libdirstem" \ + && ! test -d "$withval/$acl_libdirstem"; then + additional_libdir="$withval/$acl_libdirstem2" + fi + fi + fi + +fi + + LIBICONV= + LTLIBICONV= + INCICONV= + LIBICONV_PREFIX= + HAVE_LIBICONV= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='iconv ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + dir="$additional_libdir" + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no \ + || test "X$found_dir" = "X/usr/$acl_libdirstem" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$acl_hardcode_direct" = yes; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" + fi + if test "$acl_hardcode_minus_L" != no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + if test "$name" = 'iconv'; then + LIBICONV_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem2 | */$acl_libdirstem2/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` + if test "$name" = 'iconv'; then + LIBICONV_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" + ;; + esac + done + fi + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$acl_hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" + done + fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFPreferencesCopyAppValue" >&5 +$as_echo_n "checking for CFPreferencesCopyAppValue... " >&6; } +if ${gt_cv_func_CFPreferencesCopyAppValue+:} false; then : + $as_echo_n "(cached) " >&6 +else + gt_save_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +CFPreferencesCopyAppValue(NULL, NULL) + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gt_cv_func_CFPreferencesCopyAppValue=yes +else + gt_cv_func_CFPreferencesCopyAppValue=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$gt_save_LIBS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5 +$as_echo "$gt_cv_func_CFPreferencesCopyAppValue" >&6; } + if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then + +$as_echo "#define HAVE_CFPREFERENCESCOPYAPPVALUE 1" >>confdefs.h + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFLocaleCopyCurrent" >&5 +$as_echo_n "checking for CFLocaleCopyCurrent... " >&6; } +if ${gt_cv_func_CFLocaleCopyCurrent+:} false; then : + $as_echo_n "(cached) " >&6 +else + gt_save_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +CFLocaleCopyCurrent(); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gt_cv_func_CFLocaleCopyCurrent=yes +else + gt_cv_func_CFLocaleCopyCurrent=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$gt_save_LIBS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFLocaleCopyCurrent" >&5 +$as_echo "$gt_cv_func_CFLocaleCopyCurrent" >&6; } + if test $gt_cv_func_CFLocaleCopyCurrent = yes; then + +$as_echo "#define HAVE_CFLOCALECOPYCURRENT 1" >>confdefs.h + + fi + INTL_MACOSX_LIBS= + if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then + INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" + fi + + + + + + + LIBINTL= + LTLIBINTL= + POSUB= + + case " $gt_needs " in + *" need-formatstring-macros "*) gt_api_version=3 ;; + *" need-ngettext "*) gt_api_version=2 ;; + *) gt_api_version=1 ;; + esac + gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc" + gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl" + + if test "$USE_NLS" = "yes"; then + gt_use_preinstalled_gnugettext=no + + + if test $gt_api_version -ge 3; then + gt_revision_test_code=' +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +' + else + gt_revision_test_code= + fi + if test $gt_api_version -ge 2; then + gt_expression_test_code=' + * ngettext ("", "", 0)' + else + gt_expression_test_code= + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libc" >&5 +$as_echo_n "checking for GNU gettext in libc... " >&6; } +if eval \${$gt_func_gnugettext_libc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +$gt_revision_test_code +extern int _nl_msg_cat_cntr; +extern int *_nl_domain_bindings; +int +main () +{ +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$gt_func_gnugettext_libc=yes" +else + eval "$gt_func_gnugettext_libc=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$gt_func_gnugettext_libc + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then + + + + + + am_save_CPPFLAGS="$CPPFLAGS" + + for element in $INCICONV; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 +$as_echo_n "checking for iconv... " >&6; } +if ${am_cv_func_iconv+:} false; then : + $as_echo_n "(cached) " >&6 +else + + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + am_cv_func_iconv=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +int +main () +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + am_cv_lib_iconv=yes + am_cv_func_iconv=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$am_save_LIBS" + fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5 +$as_echo "$am_cv_func_iconv" >&6; } + if test "$am_cv_func_iconv" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working iconv" >&5 +$as_echo_n "checking for working iconv... " >&6; } +if ${am_cv_func_iconv_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + + am_save_LIBS="$LIBS" + if test $am_cv_lib_iconv = yes; then + LIBS="$LIBS $LIBICONV" + fi + if test "$cross_compiling" = yes; then : + case "$host_os" in + aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; + *) am_cv_func_iconv_works="guessing yes" ;; + esac +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +int main () +{ + /* Test against AIX 5.1 bug: Failures are not distinguishable from successful + returns. */ + { + iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); + if (cd_utf8_to_88591 != (iconv_t)(-1)) + { + static const char input[] = "\342\202\254"; /* EURO SIGN */ + char buf[10]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_utf8_to_88591, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + return 1; + } + } + /* Test against Solaris 10 bug: Failures are not distinguishable from + successful returns. */ + { + iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); + if (cd_ascii_to_88591 != (iconv_t)(-1)) + { + static const char input[] = "\263"; + char buf[10]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_ascii_to_88591, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + return 1; + } + } +#if 0 /* This bug could be worked around by the caller. */ + /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + char buf[50]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_88591_to_utf8, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if ((int)res > 0) + return 1; + } + } +#endif + /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is + provided. */ + if (/* Try standardized names. */ + iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) + /* Try IRIX, OSF/1 names. */ + && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) + /* Try AIX names. */ + && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) + /* Try HP-UX names. */ + && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) + return 1; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + am_cv_func_iconv_works=yes +else + am_cv_func_iconv_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + LIBS="$am_save_LIBS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv_works" >&5 +$as_echo "$am_cv_func_iconv_works" >&6; } + case "$am_cv_func_iconv_works" in + *no) am_func_iconv=no am_cv_lib_iconv=no ;; + *) am_func_iconv=yes ;; + esac + else + am_func_iconv=no am_cv_lib_iconv=no + fi + if test "$am_func_iconv" = yes; then + +$as_echo "#define HAVE_ICONV 1" >>confdefs.h + + fi + if test "$am_cv_lib_iconv" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5 +$as_echo_n "checking how to link with libiconv... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5 +$as_echo "$LIBICONV" >&6; } + else + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + + + + + + + + + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + +# Check whether --with-libintl-prefix was given. +if test "${with_libintl_prefix+set}" = set; then : + withval=$with_libintl_prefix; + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + if test "$acl_libdirstem2" != "$acl_libdirstem" \ + && ! test -d "$withval/$acl_libdirstem"; then + additional_libdir="$withval/$acl_libdirstem2" + fi + fi + fi + +fi + + LIBINTL= + LTLIBINTL= + INCINTL= + LIBINTL_PREFIX= + HAVE_LIBINTL= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='intl ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBINTL="${LIBINTL}${LIBINTL:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + dir="$additional_libdir" + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no \ + || test "X$found_dir" = "X/usr/$acl_libdirstem" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$acl_hardcode_direct" = yes; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir" + fi + if test "$acl_hardcode_minus_L" != no; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_a" + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + if test "$name" = 'intl'; then + LIBINTL_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem2 | */$acl_libdirstem2/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` + if test "$name" = 'intl'; then + LIBINTL_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCINTL="${INCINTL}${INCINTL:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBINTL="${LIBINTL}${LIBINTL:+ }$dep" + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$dep" + ;; + esac + done + fi + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$acl_hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-R$found_dir" + done + fi + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libintl" >&5 +$as_echo_n "checking for GNU gettext in libintl... " >&6; } +if eval \${$gt_func_gnugettext_libintl+:} false; then : + $as_echo_n "(cached) " >&6 +else + gt_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCINTL" + gt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBINTL" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +$gt_revision_test_code +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (const char *); +int +main () +{ +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("") + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$gt_func_gnugettext_libintl=yes" +else + eval "$gt_func_gnugettext_libintl=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then + LIBS="$LIBS $LIBICONV" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +$gt_revision_test_code +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (const char *); +int +main () +{ +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("") + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + LIBINTL="$LIBINTL $LIBICONV" + LTLIBINTL="$LTLIBINTL $LTLIBICONV" + eval "$gt_func_gnugettext_libintl=yes" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + CPPFLAGS="$gt_save_CPPFLAGS" + LIBS="$gt_save_LIBS" +fi +eval ac_res=\$$gt_func_gnugettext_libintl + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + fi + + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ + || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ + && test "$PACKAGE" != gettext-runtime \ + && test "$PACKAGE" != gettext-tools; }; then + gt_use_preinstalled_gnugettext=yes + else + LIBINTL= + LTLIBINTL= + INCINTL= + fi + + + + if test -n "$INTL_MACOSX_LIBS"; then + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" + LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" + fi + fi + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + +$as_echo "#define ENABLE_NLS 1" >>confdefs.h + + else + USE_NLS=no + fi + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use NLS" >&5 +$as_echo_n "checking whether to use NLS... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 +$as_echo "$USE_NLS" >&6; } + if test "$USE_NLS" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking where the gettext function comes from" >&5 +$as_echo_n "checking where the gettext function comes from... " >&6; } + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then + gt_source="external libintl" + else + gt_source="libc" + fi + else + gt_source="included intl directory" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_source" >&5 +$as_echo "$gt_source" >&6; } + fi + + if test "$USE_NLS" = "yes"; then + + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libintl" >&5 +$as_echo_n "checking how to link with libintl... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBINTL" >&5 +$as_echo "$LIBINTL" >&6; } + + for element in $INCINTL; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + fi + + +$as_echo "#define HAVE_GETTEXT 1" >>confdefs.h + + +$as_echo "#define HAVE_DCGETTEXT 1" >>confdefs.h + + fi + + POSUB=po + fi + + + + INTLLIBS="$LIBINTL" + + + + + + + +if test "x${prefix}" = "xNONE"; then + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_LOCALE_DIR "${ac_default_prefix}/${DATADIRNAME}/locale" +_ACEOF + +else + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_LOCALE_DIR "${prefix}/${DATADIRNAME}/locale" +_ACEOF + +fi + +if test "x${datadir}" = 'x${prefix}/share'; then + if test "x${prefix}" = "xNONE"; then + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_DATA_DIR "${ac_default_prefix}/share/${PACKAGE}" +_ACEOF + + else + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_DATA_DIR "${prefix}/share/${PACKAGE}" +_ACEOF + + fi +else + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_DATA_DIR "${datadir}/${PACKAGE}" +_ACEOF + +fi + +packagesrcdir=`cd $srcdir && pwd` + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_SOURCE_DIR "${packagesrcdir}" +_ACEOF + + +if test x$CYGWIN = xyes -o x$MINGW32 = xyes; then + +$as_echo "#define WIN32 1" >>confdefs.h + + LIBS="$LIBS -ldsound -lgdi32" +fi + +if test x$cross_compiling = xyes; then + gtk=no + xlibs="$LIBS" + LIBS="$LIBS -L$CROSSCOMPPATH/gtk/lib" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gtk_main in -lgtk" >&5 +$as_echo_n "checking for gtk_main in -lgtk... " >&6; } +if ${ac_cv_lib_gtk_gtk_main+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgtk $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char gtk_main (); +int +main () +{ +return gtk_main (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_gtk_gtk_main=yes +else + ac_cv_lib_gtk_gtk_main=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gtk_gtk_main" >&5 +$as_echo "$ac_cv_lib_gtk_gtk_main" >&6; } +if test "x$ac_cv_lib_gtk_gtk_main" = xyes; then : + gtk=yes +fi + + LIBS="$xlibs" + if test x$gtk = xyes; then + GTK_CFLAGS="-I$CROSSCOMPPATH/gtk/include -I$CROSSCOMPPATH/gtk/include/glib -I$CROSSCOMPPATH/gtk/include/gdk" + GTK_LIBS="-L$CROSSCOMPPATH/gtk/lib -lgtk -lgdk -lglib" + PTHREAD_CFLAGS="-I$CROSSCOMPPATH/gtk/include" + PTHREAD_LIBS="-L$CROSSCOMPPATH/gtk/lib" + AUDIOFILE_CFLAGS="-I$CROSSCOMPPATH/audiofile/include" + AUDIOFILE_LIBS="-L$CROSSCOMPPATH/audiofile/lib -laudiofile" + fi +else + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi +fi + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XML" >&5 +$as_echo_n "checking for XML... " >&6; } + +if test -n "$XML_CFLAGS"; then + pkg_cv_XML_CFLAGS="$XML_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libxml-2.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_XML_CFLAGS=`$PKG_CONFIG --cflags "libxml-2.0" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$XML_LIBS"; then + pkg_cv_XML_LIBS="$XML_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libxml-2.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_XML_LIBS=`$PKG_CONFIG --libs "libxml-2.0" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + XML_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libxml-2.0" 2>&1` + else + XML_PKG_ERRORS=`$PKG_CONFIG --print-errors "libxml-2.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$XML_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (libxml-2.0) were not met: + +$XML_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables XML_CFLAGS +and XML_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 + +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables XML_CFLAGS +and XML_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } + +else + XML_CFLAGS=$pkg_cv_XML_CFLAGS + XML_LIBS=$pkg_cv_XML_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GTK" >&5 +$as_echo_n "checking for GTK... " >&6; } + +if test -n "$GTK_CFLAGS"; then + pkg_cv_GTK_CFLAGS="$GTK_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gtk+-2.0 >= 2.6.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gtk+-2.0 >= 2.6.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GTK_CFLAGS=`$PKG_CONFIG --cflags "gtk+-2.0 >= 2.6.0" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$GTK_LIBS"; then + pkg_cv_GTK_LIBS="$GTK_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gtk+-2.0 >= 2.6.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gtk+-2.0 >= 2.6.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GTK_LIBS=`$PKG_CONFIG --libs "gtk+-2.0 >= 2.6.0" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + GTK_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gtk+-2.0 >= 2.6.0" 2>&1` + else + GTK_PKG_ERRORS=`$PKG_CONFIG --print-errors "gtk+-2.0 >= 2.6.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$GTK_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (gtk+-2.0 >= 2.6.0) were not met: + +$GTK_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables GTK_CFLAGS +and GTK_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 + +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables GTK_CFLAGS +and GTK_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } + +else + GTK_CFLAGS=$pkg_cv_GTK_CFLAGS + GTK_LIBS=$pkg_cv_GTK_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for AUDIOFILE" >&5 +$as_echo_n "checking for AUDIOFILE... " >&6; } + +if test -n "$AUDIOFILE_CFLAGS"; then + pkg_cv_AUDIOFILE_CFLAGS="$AUDIOFILE_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"audiofile\""; } >&5 + ($PKG_CONFIG --exists --print-errors "audiofile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_AUDIOFILE_CFLAGS=`$PKG_CONFIG --cflags "audiofile" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$AUDIOFILE_LIBS"; then + pkg_cv_AUDIOFILE_LIBS="$AUDIOFILE_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"audiofile\""; } >&5 + ($PKG_CONFIG --exists --print-errors "audiofile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_AUDIOFILE_LIBS=`$PKG_CONFIG --libs "audiofile" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + AUDIOFILE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "audiofile" 2>&1` + else + AUDIOFILE_PKG_ERRORS=`$PKG_CONFIG --print-errors "audiofile" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$AUDIOFILE_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (audiofile) were not met: + +$AUDIOFILE_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables AUDIOFILE_CFLAGS +and AUDIOFILE_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 + +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables AUDIOFILE_CFLAGS +and AUDIOFILE_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } + +else + AUDIOFILE_CFLAGS=$pkg_cv_AUDIOFILE_CFLAGS + AUDIOFILE_LIBS=$pkg_cv_AUDIOFILE_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi +fi + +xlibs="$LIBS" +LIBS="$GTK_LIBS $LIBS" +for ac_func in gtk_widget_set_tooltip_text gtk_widget_is_drawable gtk_widget_get_realized gtk_widget_set_realized gtk_widget_set_can_default gtk_widget_set_can_focus gtk_dialog_get_action_area gtk_dialog_get_content_area gtk_widget_get_allocation gtk_widget_set_allocation gtk_widget_get_state gtk_widget_get_window gtk_widget_set_window gtk_widget_set_has_window gtk_widget_style_attach +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +LIBS="$xlibs" + +if test "x$GCC" = "xyes"; then + if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then + CFLAGS="$CFLAGS -Wall -O2" + CXXFLAGS="$CXXFLAGS -Wall -O2" + fi +fi + +if test x$CYGWIN = xyes -o x$MINGW32 = xyes; then + XML_CFLAGS= + XML_LIBS= +else + xlibs=$LIBS + LIBS= + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openpty in -lutil" >&5 +$as_echo_n "checking for openpty in -lutil... " >&6; } +if ${ac_cv_lib_util_openpty+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lutil $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char openpty (); +int +main () +{ +return openpty (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_util_openpty=yes +else + ac_cv_lib_util_openpty=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_openpty" >&5 +$as_echo "$ac_cv_lib_util_openpty" >&6; } +if test "x$ac_cv_lib_util_openpty" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBUTIL 1 +_ACEOF + + LIBS="-lutil $LIBS" + +fi + + for ac_func in openpty +do : + ac_fn_c_check_func "$LINENO" "openpty" "ac_cv_func_openpty" +if test "x$ac_cv_func_openpty" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_OPENPTY 1 +_ACEOF + LIBTHREAD="$LIBTHREAD $LIBS" +else + case " $LIBOBJS " in + *" openpty.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS openpty.$ac_objext" + ;; +esac + +fi +done + + LIBS=$xlibs +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rigerror in -lhamlib" >&5 +$as_echo_n "checking for rigerror in -lhamlib... " >&6; } +if ${ac_cv_lib_hamlib_rigerror+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lhamlib $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char rigerror (); +int +main () +{ +return rigerror (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_hamlib_rigerror=yes +else + ac_cv_lib_hamlib_rigerror=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_hamlib_rigerror" >&5 +$as_echo "$ac_cv_lib_hamlib_rigerror" >&6; } +if test "x$ac_cv_lib_hamlib_rigerror" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBHAMLIB 1 +_ACEOF + + LIBS="-lhamlib $LIBS" + +fi + + +xcflags="$CFLAGS" +CFLAGS="$CFLAGS -I$srcdir/directx/include -I$srcdir/directx/include/directx6" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DirectX includes" >&5 +$as_echo_n "checking for DirectX includes... " >&6; } +directx=no +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + LPDIRECTSOUND dsplay; LPDIRECTSOUNDCAPTURE dsrec; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +$as_echo "#define HAVE_DIRECTX 1" >>confdefs.h + directx=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $directx" >&5 +$as_echo "$directx" >&6; } +CFLAGS="$xcflags" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ifr_newname in struct ifreq" >&5 +$as_echo_n "checking for ifr_newname in struct ifreq... " >&6; } +ifrnewname=no +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +struct ifreq ifr; ifr.ifr_newname[0]=0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +$as_echo "#define HAVE_IFRNEWNAME 1" >>confdefs.h + ifrnewname=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ifrnewname" >&5 +$as_echo "$ifrnewname" >&6; } + +xlibs=$LIBS +LIBS= +for ac_func in vsnprintf +do : + ac_fn_c_check_func "$LINENO" "vsnprintf" "ac_cv_func_vsnprintf" +if test "x$ac_cv_func_vsnprintf" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_VSNPRINTF 1 +_ACEOF + +else + case " $LIBOBJS " in + *" vsnprintf.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS vsnprintf.$ac_objext" + ;; +esac + +fi +done + +for ac_func in random +do : + ac_fn_c_check_func "$LINENO" "random" "ac_cv_func_random" +if test "x$ac_cv_func_random" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_RANDOM 1 +_ACEOF + +else + case " $LIBOBJS " in + *" random.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS random.$ac_objext" + ;; +esac + +fi +done + +LIBS=$xlibs + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MKISS (N_AX25 line discipline)" >&5 +$as_echo_n "checking for MKISS (N_AX25 line discipline)... " >&6; } +mkiss=no +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #ifdef N_AX25 + yes + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then : + +$as_echo "#define HAVE_MKISS 1" >>confdefs.h + mkiss=yes +fi +rm -f conftest* + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mkiss" >&5 +$as_echo "$mkiss" >&6; } + +if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *[\ \ ]-Wall[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wall" ;; + esac +fi + +# Check whether --enable-mmx was given. +if test "${enable_mmx+set}" = set; then : + enableval=$enable_mmx; case "${enableval}" in + yes) usemmx=true ;; + no) usemmx=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-mmx" "$LINENO" 5 ;; +esac +else + usemmx=false +fi + + +# Check whether --enable-vis was given. +if test "${enable_vis+set}" = set; then : + enableval=$enable_vis; case "${enableval}" in + yes) usevis=true ;; + no) usevis=false ;; + *) as_fn_error $? "bad value ${enableval} for --enable-vis" "$LINENO" 5 ;; +esac +else + usevis=false +fi + + +if test x$usemmx = xtrue; then + +$as_echo "#define USEMMX 1" >>confdefs.h + +fi + +if test x$usevis = xtrue; then + +$as_echo "#define USEVIS 1" >>confdefs.h + + CFLAGS="$CFLAGS -Wa,-xarch=v8plusa" +fi + + if test x$usemmx = xtrue; then + USEMMX_TRUE= + USEMMX_FALSE='#' +else + USEMMX_TRUE='#' + USEMMX_FALSE= +fi + + if test x$usevis = xtrue; then + USEVIS_TRUE= + USEVIS_FALSE='#' +else + USEVIS_TRUE='#' + USEVIS_FALSE= +fi + + if test x$cross_compiling = xyes; then + CROSSCOMP_TRUE= + CROSSCOMP_FALSE='#' +else + CROSSCOMP_TRUE='#' + CROSSCOMP_FALSE= +fi + + if test x$directx = xyes; then + DIRECTX_TRUE= + DIRECTX_FALSE='#' +else + DIRECTX_TRUE='#' + DIRECTX_FALSE= +fi + + if test x$CYGWIN = xyes -o x$MINGW32 = xyes; then + WIN32_TRUE= + WIN32_FALSE='#' +else + WIN32_TRUE='#' + WIN32_FALSE= +fi + + + + + + + + + + + + + + + + + + + + + + +ac_config_files="$ac_config_files Makefile po/Makefile.in directx/Makefile libmisc/Makefile matlib/Makefile afsk/Makefile fsk/Makefile pammodem/Makefile pskmodem/Makefile newqpsk/Makefile p3dmodem/Makefile soundcard/Makefile flexdrv/Makefile doc/Makefile configapp/Makefile configapp/src/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, we kill variables containing newlines. +# 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. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}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 "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + 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}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${USEMMX_TRUE}" && test -z "${USEMMX_FALSE}"; then + as_fn_error $? "conditional \"USEMMX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${USEVIS_TRUE}" && test -z "${USEVIS_FALSE}"; then + as_fn_error $? "conditional \"USEVIS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${CROSSCOMP_TRUE}" && test -z "${CROSSCOMP_FALSE}"; then + as_fn_error $? "conditional \"CROSSCOMP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${DIRECTX_TRUE}" && test -z "${DIRECTX_FALSE}"; then + as_fn_error $? "conditional \"DIRECTX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${WIN32_TRUE}" && test -z "${WIN32_FALSE}"; then + as_fn_error $? "conditional \"WIN32\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $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} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +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 +IFS=$as_save_IFS + + ;; +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 + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; 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 + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# 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 + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# 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'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by $as_me, which was +generated by GNU Autoconf 2.68. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + 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 + +Configuration commands: +$config_commands + +Report bugs to the package provider." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.68, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2010 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +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=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + 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 || ac_write_fail=1 +if \$ac_cs_recheck; then + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" +# Capture the value of obsolete ALL_LINGUAS because we need it to compute + # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it + # from automake < 1.5. + eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' + # Capture the value of LINGUAS because we need it to compute CATALOGS. + LINGUAS="${LINGUAS-%UNSET%}" + + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "po-directories") CONFIG_COMMANDS="$CONFIG_COMMANDS po-directories" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; + "directx/Makefile") CONFIG_FILES="$CONFIG_FILES directx/Makefile" ;; + "libmisc/Makefile") CONFIG_FILES="$CONFIG_FILES libmisc/Makefile" ;; + "matlib/Makefile") CONFIG_FILES="$CONFIG_FILES matlib/Makefile" ;; + "afsk/Makefile") CONFIG_FILES="$CONFIG_FILES afsk/Makefile" ;; + "fsk/Makefile") CONFIG_FILES="$CONFIG_FILES fsk/Makefile" ;; + "pammodem/Makefile") CONFIG_FILES="$CONFIG_FILES pammodem/Makefile" ;; + "pskmodem/Makefile") CONFIG_FILES="$CONFIG_FILES pskmodem/Makefile" ;; + "newqpsk/Makefile") CONFIG_FILES="$CONFIG_FILES newqpsk/Makefile" ;; + "p3dmodem/Makefile") CONFIG_FILES="$CONFIG_FILES p3dmodem/Makefile" ;; + "soundcard/Makefile") CONFIG_FILES="$CONFIG_FILES soundcard/Makefile" ;; + "flexdrv/Makefile") CONFIG_FILES="$CONFIG_FILES flexdrv/Makefile" ;; + "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "configapp/Makefile") CONFIG_FILES="$CONFIG_FILES configapp/Makefile" ;; + "configapp/src/Makefile") CONFIG_FILES="$CONFIG_FILES configapp/src/Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + 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 + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries 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[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #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. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # 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. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;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&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Autoconf 2.62 quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir=$dirpart/$fdir; as_fn_mkdir_p + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} + ;; + "po-directories":C) + for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + # Treat a directory as a PO directory if and only if it has a + # POTFILES.in file. This allows packages to have multiple PO + # directories under different names or in different locations. + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" + POMAKEFILEDEPS="POTFILES.in" + # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend + # on $ac_dir but don't depend on user-specified configuration + # parameters. + if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then + # The LINGUAS file contains the set of available languages. + if test -n "$OBSOLETE_ALL_LINGUAS"; then + test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" + fi + ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` + # Hide the ALL_LINGUAS assigment from automake < 1.5. + eval 'ALL_LINGUAS''=$ALL_LINGUAS_' + POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" + else + # The set of available languages was given in configure.in. + # Hide the ALL_LINGUAS assigment from automake < 1.5. + eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' + fi + # Compute POFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) + # Compute UPDATEPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) + # Compute DUMMYPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) + # Compute GMOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) + case "$ac_given_srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; + esac + POFILES= + UPDATEPOFILES= + DUMMYPOFILES= + GMOFILES= + for lang in $ALL_LINGUAS; do + POFILES="$POFILES $srcdirpre$lang.po" + UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" + DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + done + # CATALOGS depends on both $ac_dir and the user's LINGUAS + # environment variable. + INST_LINGUAS= + if test -n "$ALL_LINGUAS"; then + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "$LINGUAS"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + INST_LINGUAS="$INST_LINGUAS $presentlang" + fi + done + fi + CATALOGS= + if test -n "$INST_LINGUAS"; then + for lang in $INST_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + done + fi + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do + if test -f "$f"; then + case "$f" in + *.orig | *.bak | *~) ;; + *) cat "$f" >> "$ac_dir/Makefile" ;; + esac + fi + done + fi + ;; + esac + done ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# 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 || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + diff --git a/configure.in b/configure.in new file mode 100644 index 0000000..5f15ae6 --- /dev/null +++ b/configure.in @@ -0,0 +1,299 @@ +AC_INIT(soundmodem.spec) +AC_CANONICAL_SYSTEM + +AM_INIT_AUTOMAKE(soundmodem, 0.16) +AM_CONFIG_HEADER(config.h) + +AC_PREREQ(2.53) + +dnl AC_CHECK_TOOL() + +AC_PROG_MAKE_SET +AC_ISC_POSIX +AC_PROG_CC +AM_PROG_CC_STDC +dnl AC_PROG_RANLIB +AC_C_CONST +AC_C_INLINE +AC_HEADER_STDC +AC_FUNC_ALLOCA +AC_PROG_CXX + +AC_CHECK_PROG(RANLIB, ranlib, ranlib, :) +AC_CHECK_PROG(DLLTOOL, dlltool, dlltool, dlltool) +AC_CHECK_PROG(AS, as, as, as, as) +AC_CHECK_PROG(AR, ar, ar, ar, ar) +AC_CHECK_PROG(LD, ld, ld, ld, ld) +AC_CHECK_PROG(WINDRES, windres, windres, i686-pc-cygwin-windres) + +AC_CYGWIN +AC_MINGW32 +AC_EXEEXT +AC_OBJEXT + +dnl check for cross compiler path +if test x$cross_compiling = xyes; then + AC_MSG_CHECKING(for cross compiler path) + if test -d /usr/local/cross/i686-pc-cygwin; then + CROSSCOMPPATH=/usr/local/cross/i686-pc-cygwin + elif test -d /usr/local/cygwin/i686-pc-cygwin; then + CROSSCOMPPATH=/usr/local/cygwin/i686-pc-cygwin + else + AC_ERROR("cross compiler not found") + fi + AC_MSG_RESULT($CROSSCOMPPATH) +fi + +if test x$CYGWIN != xyes -a x$MINGW32 != xyes; then + AC_CHECK_LIB(m,sqrt) +fi +AC_CHECK_LIB(pthread32,pthread_create,LIBTHREAD="$LIBTHREAD -lpthread32",AC_CHECK_LIB(pthread,pthread_create,LIBTHREAD="$LIBTHREAD -lpthread")) +AC_CHECK_LIB(posix4,sched_setscheduler) +AC_CHECK_LIB(uuid,GUID_NULL) +AC_CHECK_FUNCS(getopt_long,,[AC_LIBOBJ([getopt]) AC_LIBOBJ([getopt1])]) +AC_CHECK_HEADERS(sys/audioio.h stropts.h sys/conf.h sys/soundcard.h sys/ioctl.h time.h inttypes.h net/if_arp.h) +AC_CHECK_HEADERS(pty.h getopt.h syslog.h sched.h linux/sockios.h sys/ioccom.h linux/ppdev.h linux/hidraw.h) +AC_CHECK_HEADERS(sys/socket.h linux/if.h,,, +[[ +#if HAVE_SYS_SOCKET_H +# include +#endif +]]) +AC_CHECK_HEADERS(sys/socket.h linux/ax25.h,,, +[[ +#if HAVE_SYS_SOCKET_H +# include +#endif +]]) +AC_CHECK_FUNCS(snprintf vsnprintf syslog vsyslog openlog closelog) +AC_CHECK_FUNCS(mlockall) + +AC_MSG_CHECKING(for signed bittypes) +signedbittypes=no +AC_TRY_COMPILE([#include ], + [ int8_t a; int16_t c; int32_t e; ], + AC_DEFINE(HAVE_SIGNED_BITTYPES,1,[define if bittypes like int16_t are defined]) signedbittypes=yes) +AC_MSG_RESULT($signedbittypes) + +AC_MSG_CHECKING(for unsigned bittypes) +unsignedbittypes=no +AC_TRY_COMPILE([#include ], + [ u_int8_t b; u_int16_t d; u_int32_t f; ], + AC_DEFINE(HAVE_UNSIGNED_BITTYPES,1,[define if bittypes like u_int16_t are defined]) unsignedbittypes=yes) +AC_MSG_RESULT($unsignedbittypes) + +AC_TYPE_SIGNAL + +AC_MSG_CHECKING(for M_PI) +mpi=no +AC_TRY_COMPILE([#include ], + [ double f = M_PI; ], + mpi=yes,AC_DEFINE(M_PI,3.14159265358979323846,[define if M_PI is not defined by math.h])) +AC_MSG_RESULT($mpi) + +AC_MSG_CHECKING(for M_LOG10E) +mlog10e=no +AC_TRY_COMPILE([#include ], + [ double f = M_LOG10E; ], + mlog10e=yes,AC_DEFINE(M_LOG10E,0.43429448190325182765,[define if M_LOG10E is not defined by math.h])) +AC_MSG_RESULT($mlog10e) + +dnl check for ALSA +case $target_os in + linux*) + AM_PATH_ALSA(1.0.0, AC_DEFINE(HAVE_ALSA,1,[Define if ALSA is available])) + ;; +esac +AC_SUBST(HAVE_ALSA) + +dnl Add the languages which your application supports here. +ALL_LINGUAS="sv fr" +AM_GNU_GETTEXT([external]) + +dnl Set PACKAGE_LOCALE_DIR in config.h. +if test "x${prefix}" = "xNONE"; then + AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR,"${ac_default_prefix}/${DATADIRNAME}/locale",[various directories]) +else + AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR,"${prefix}/${DATADIRNAME}/locale",[various directories]) +fi + +dnl Set PACKAGE_DATA_DIR in config.h. +if test "x${datadir}" = 'x${prefix}/share'; then + if test "x${prefix}" = "xNONE"; then + AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR,"${ac_default_prefix}/share/${PACKAGE}",[various directories]) + else + AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR,"${prefix}/share/${PACKAGE}",[various directories]) + fi +else + AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR,"${datadir}/${PACKAGE}",[various directories]) +fi + +dnl Set PACKAGE_SOURCE_DIR in config.h. +packagesrcdir=`cd $srcdir && pwd` +AC_DEFINE_UNQUOTED(PACKAGE_SOURCE_DIR,"${packagesrcdir}",[various directories]) + +if test x$CYGWIN = xyes -o x$MINGW32 = xyes; then + AC_DEFINE(WIN32,1,[define if compiling under Windows32]) + LIBS="$LIBS -ldsound -lgdi32" +fi + +if test x$cross_compiling = xyes; then + gtk=no + xlibs="$LIBS" + LIBS="$LIBS -L$CROSSCOMPPATH/gtk/lib" + AC_CHECK_LIB(gtk,gtk_main,gtk=yes) + LIBS="$xlibs" + if test x$gtk = xyes; then + GTK_CFLAGS="-I$CROSSCOMPPATH/gtk/include -I$CROSSCOMPPATH/gtk/include/glib -I$CROSSCOMPPATH/gtk/include/gdk" + GTK_LIBS="-L$CROSSCOMPPATH/gtk/lib -lgtk -lgdk -lglib" + PTHREAD_CFLAGS="-I$CROSSCOMPPATH/gtk/include" + PTHREAD_LIBS="-L$CROSSCOMPPATH/gtk/lib" + AUDIOFILE_CFLAGS="-I$CROSSCOMPPATH/audiofile/include" + AUDIOFILE_LIBS="-L$CROSSCOMPPATH/audiofile/lib -laudiofile" + fi +else + PKG_CHECK_MODULES(XML,libxml-2.0) + PKG_CHECK_MODULES(GTK,gtk+-2.0 >= 2.6.0) + PKG_CHECK_MODULES(AUDIOFILE,audiofile) +fi + +dnl Check for recently introduced GTK symbols +xlibs="$LIBS" +LIBS="$GTK_LIBS $LIBS" +AC_CHECK_FUNCS(gtk_widget_set_tooltip_text gtk_widget_is_drawable gtk_widget_get_realized gtk_widget_set_realized gtk_widget_set_can_default gtk_widget_set_can_focus gtk_dialog_get_action_area gtk_dialog_get_content_area gtk_widget_get_allocation gtk_widget_set_allocation gtk_widget_get_state gtk_widget_get_window gtk_widget_set_window gtk_widget_set_has_window gtk_widget_style_attach) +LIBS="$xlibs" + +dnl Enable to try building with XXX_DISABLE_DEPRECATED. Never ship with +dnl them enabled! +dnl GTK_CFLAGS="$GTK_CFLAGS -DPANGO_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGSEAL_ENABLE" +dnl Only use -Wall if we have gcc +if test "x$GCC" = "xyes"; then + if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then + CFLAGS="$CFLAGS -Wall -O2" + CXXFLAGS="$CXXFLAGS -Wall -O2" + fi +fi + +if test x$CYGWIN = xyes -o x$MINGW32 = xyes; then + XML_CFLAGS= + XML_LIBS= +else + xlibs=$LIBS + LIBS= + AC_CHECK_LIB(util,openpty) + AC_CHECK_FUNCS(openpty,LIBTHREAD="$LIBTHREAD $LIBS",[AC_LIBOBJ([openpty])]) + LIBS=$xlibs +fi + +AC_CHECK_LIB(hamlib,rigerror) + +xcflags="$CFLAGS" +CFLAGS="$CFLAGS -I$srcdir/directx/include -I$srcdir/directx/include/directx6" +AC_MSG_CHECKING(for DirectX includes) +directx=no +AC_TRY_COMPILE([#include ], + [ LPDIRECTSOUND dsplay; LPDIRECTSOUNDCAPTURE dsrec; ], + AC_DEFINE(HAVE_DIRECTX,1,[define if we have DirectX includes]) directx=yes) +AC_MSG_RESULT($directx) +CFLAGS="$xcflags" + +AC_MSG_CHECKING(for ifr_newname in struct ifreq) +ifrnewname=no +AC_TRY_COMPILE([#include ], + [struct ifreq ifr; ifr.ifr_newname[0]=0; ], AC_DEFINE(HAVE_IFRNEWNAME,1,[define if struct ifreq has the ifr_newname symbol]) ifrnewname=yes) +AC_MSG_RESULT($ifrnewname) + +xlibs=$LIBS +LIBS= +AC_CHECK_FUNCS(vsnprintf,,[AC_LIBOBJ([vsnprintf])]) +AC_CHECK_FUNCS(random,,[AC_LIBOBJ([random])]) +LIBS=$xlibs + +AC_MSG_CHECKING(for MKISS (N_AX25 line discipline)) +mkiss=no +AC_EGREP_CPP(yes, + [#include + #ifdef N_AX25 + yes + #endif + ], AC_DEFINE(HAVE_MKISS,1,[define if struct ifreq has the ifr_newname symbol]) mkiss=yes) +AC_MSG_RESULT($mkiss) + +dnl Use -Wall if we have gcc. +changequote(,)dnl +if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *[\ \ ]-Wall[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wall" ;; + esac +fi +changequote([,])dnl + +AC_ARG_ENABLE(mmx, +[ --enable-mmx Utilize MMX(tm) instructions if available (x86 only)], +[case "${enableval}" in + yes) usemmx=true ;; + no) usemmx=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-mmx) ;; +esac],[usemmx=false]) + +AC_ARG_ENABLE(vis, +[ --enable-vis Utilize VIS(tm) instructions if available (ultrasparc only)], +[case "${enableval}" in + yes) usevis=true ;; + no) usevis=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-vis) ;; +esac],[usevis=false]) + +if test x$usemmx = xtrue; then + AC_DEFINE(USEMMX,1,[define if MMX is to be used]) +fi + +if test x$usevis = xtrue; then + AC_DEFINE(USEVIS,1,[define if VIS is to be used]) + dnl CFLAGS="$CFLAGS -mv8plus -mvis -Wa,-xarch=v8plusa" + CFLAGS="$CFLAGS -Wa,-xarch=v8plusa" +fi + +AM_CONDITIONAL(USEMMX, test x$usemmx = xtrue) +AM_CONDITIONAL(USEVIS, test x$usevis = xtrue) +AM_CONDITIONAL(CROSSCOMP, test x$cross_compiling = xyes) +AM_CONDITIONAL(DIRECTX, test x$directx = xyes) +AM_CONDITIONAL(WIN32, test x$CYGWIN = xyes -o x$MINGW32 = xyes) + +AC_SUBST(HAVE_BITTYPES) +AC_SUBST(HAVE_DIRECTX) +AC_SUBST(HAVE_MKISS) +AC_SUBST(HAVE_IFRNEWNAME) +AC_SUBST(M_PI) +AC_SUBST(LIBTHREAD) +AC_SUBST(USEMMX) +AC_SUBST(USEVIS) +AC_SUBST(XML_CFLAGS) +AC_SUBST(XML_LIBS) +AC_SUBST(GTK_LIBS) +AC_SUBST(GTK_CFLAGS) +AC_SUBST(PTHREAD_LIBS) +AC_SUBST(PTHREAD_CFLAGS) +AC_SUBST(WIN32) +AC_SUBST(AR) +AC_SUBST(AS) +AC_SUBST(LD) +AC_SUBST(RANLIB) + +AC_OUTPUT([Makefile +po/Makefile.in +directx/Makefile +libmisc/Makefile +matlib/Makefile +afsk/Makefile +fsk/Makefile +pammodem/Makefile +pskmodem/Makefile +newqpsk/Makefile +p3dmodem/Makefile +soundcard/Makefile +flexdrv/Makefile +doc/Makefile +configapp/Makefile +configapp/src/Makefile]) diff --git a/depcomp b/depcomp new file mode 100755 index 0000000..807b991 --- /dev/null +++ b/depcomp @@ -0,0 +1,423 @@ +#! /bin/sh + +# depcomp - compile a program generating dependencies as side-effects +# Copyright 1999, 2000 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. + +# 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. + +# Originally written by Alexandre Oliva . + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi +# `libtool' can also be set to `yes' or `no'. + +if test -z "$depfile"; then + base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` + dir=`echo "$object" | sed 's,/.*$,/,'` + if test "$dir" = "$object"; then + dir= + fi + # FIXME: should be _deps on DOS. + depfile="$dir.deps/$base" +fi + +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. This file always lives in the current directory. + # Also, the AIX compiler puts `$object:' at the start of each line; + # $object doesn't have directory information. + stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + outname="$stripped.o" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + tmpdepfile1="$dir.libs/$base.lo.d" + tmpdepfile2="$dir.libs/$base.d" + "$@" -Wc,-MD + else + tmpdepfile1="$dir$base.o.d" + tmpdepfile2="$dir$base.d" + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + if test -f "$tmpdepfile1"; then + tmpdepfile="$tmpdepfile1" + else + tmpdepfile="$tmpdepfile2" + fi + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a space and a tab in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. We will use -o /dev/null later, + # however we can't do the remplacement now because + # `-o $object' might simply not be used + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + "$@" -o /dev/null $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + -*) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 diff --git a/directx/Makefile.am b/directx/Makefile.am new file mode 100644 index 0000000..2567daa --- /dev/null +++ b/directx/Makefile.am @@ -0,0 +1,29 @@ + +INCLUDES = -DCONFIGDIR=\"$(sysconfdir)\" -DLOCALSTATEDIR=\"$(localstatedir)\" \ + -I$(top_srcdir)/directx/include -I$(top_srcdir)/directx/include/directx6 + +if DIRECTX +BUILT_SOURCES = libddraw.a libdsound.a libdinput.a libdplayx.a + +noinst_LIBRARIES = libdinput1.a +libdinput1_a_SOURCES = dinput.c + +endif + +libddraw.a libdsound.a libdplayx.a: libddraw.def libdsound.def libdplayx.def + for i in ddraw dsound dplayx; do \ + $(DLLTOOL) --as $(AS) -k --dllname $$i.dll --output-lib lib$$i.a --def $(srcdir)/lib$$i.def; \ + done + +libdinput.a: libdinput1.a libdinput.def + $(DLLTOOL) --as $(AS) -k --dllname dinput.dll --output-lib $@ --def $(srcdir)/libdinput.def + $(AR) xv libdinput1.a dinput.$(OBJEXT) + $(AR) rv $@ dinput.$(OBJEXT) + $(RM) -f $< + +EXTRA_DIST = libddraw.def libdinput.def libdplayx.def libdsound.def dinput.c \ + fixdirectx.sh deunion.pl include/directx.h + +# include/mmsystem.h include/objbase.h + +CLEANFILES = libddraw.a libdinput.a libdplayx.a libdsound.a diff --git a/directx/Makefile.in b/directx/Makefile.in new file mode 100644 index 0000000..8f5e3f8 --- /dev/null +++ b/directx/Makefile.in @@ -0,0 +1,511 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = directx +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +libdinput1_a_AR = $(AR) $(ARFLAGS) +libdinput1_a_LIBADD = +am__libdinput1_a_SOURCES_DIST = dinput.c +@DIRECTX_TRUE@am_libdinput1_a_OBJECTS = dinput.$(OBJEXT) +libdinput1_a_OBJECTS = $(am_libdinput1_a_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libdinput1_a_SOURCES) +DIST_SOURCES = $(am__libdinput1_a_SOURCES_DIST) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUDIOFILE_CFLAGS = @AUDIOFILE_CFLAGS@ +AUDIOFILE_LIBS = @AUDIOFILE_LIBS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +HAVE_ALSA = @HAVE_ALSA@ +HAVE_BITTYPES = @HAVE_BITTYPES@ +HAVE_DIRECTX = @HAVE_DIRECTX@ +HAVE_IFRNEWNAME = @HAVE_IFRNEWNAME@ +HAVE_MKISS = @HAVE_MKISS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTHREAD = @LIBTHREAD@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +M_PI = @M_PI@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USEMMX = @USEMMX@ +USEVIS = @USEVIS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WIN32 = @WIN32@ +WINDRES = @WINDRES@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CFLAGS = @XML_CFLAGS@ +XML_LIBS = @XML_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +INCLUDES = -DCONFIGDIR=\"$(sysconfdir)\" -DLOCALSTATEDIR=\"$(localstatedir)\" \ + -I$(top_srcdir)/directx/include -I$(top_srcdir)/directx/include/directx6 + +@DIRECTX_TRUE@BUILT_SOURCES = libddraw.a libdsound.a libdinput.a libdplayx.a +@DIRECTX_TRUE@noinst_LIBRARIES = libdinput1.a +@DIRECTX_TRUE@libdinput1_a_SOURCES = dinput.c +EXTRA_DIST = libddraw.def libdinput.def libdplayx.def libdsound.def dinput.c \ + fixdirectx.sh deunion.pl include/directx.h + + +# include/mmsystem.h include/objbase.h +CLEANFILES = libddraw.a libdinput.a libdplayx.a libdsound.a +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu directx/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu directx/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libdinput1.a: $(libdinput1_a_OBJECTS) $(libdinput1_a_DEPENDENCIES) + -rm -f libdinput1.a + $(libdinput1_a_AR) libdinput1.a $(libdinput1_a_OBJECTS) $(libdinput1_a_LIBADD) + $(RANLIB) libdinput1.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dinput.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +all-am: Makefile $(LIBRARIES) +installdirs: +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: all check install install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am + + +libddraw.a libdsound.a libdplayx.a: libddraw.def libdsound.def libdplayx.def + for i in ddraw dsound dplayx; do \ + $(DLLTOOL) --as $(AS) -k --dllname $$i.dll --output-lib lib$$i.a --def $(srcdir)/lib$$i.def; \ + done + +libdinput.a: libdinput1.a libdinput.def + $(DLLTOOL) --as $(AS) -k --dllname dinput.dll --output-lib $@ --def $(srcdir)/libdinput.def + $(AR) xv libdinput1.a dinput.$(OBJEXT) + $(AR) rv $@ dinput.$(OBJEXT) + $(RM) -f $< + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/directx/deunion.pl b/directx/deunion.pl new file mode 100755 index 0000000..963ea89 --- /dev/null +++ b/directx/deunion.pl @@ -0,0 +1,47 @@ +#!/usr/bin/perl +# +# Ack! gcc doesn't support unnamed unions -- we have to fake them. +# +# Expected format: +# +#struct blah +#{ +# union +# { +# type1 blah1; +# type2 blah2; +# }; +#} + +$lineno = 0; +$union = 0; +$ucount = 1; +while ( ($line = ) ) { + ++$lineno; + + $line =~ s/\r//; + if ( $line =~ /\sunion\s/ ) { + if ( $union ) { + die("Nested union at line $lineno -- Exiting.\n"); + } + $union = 1; + } + if ( $union ) { + if ( $line =~ /}/ ) { + if ( $line =~ /};/ ) { + chomp($line); + $gnuline = $line; + $gnuline =~ s/};/} u$ucount;/; + $line = +"#if defined(NONAMELESSUNION)\n$gnuline\n#else\n$line\n#endif\n"; + $ucount++; + } + $union = 0; + } + } else { + if ( $line =~ /^}/ ) { + $ucount = 1; + } + } + print $line; +} diff --git a/directx/dinput.c b/directx/dinput.c new file mode 100644 index 0000000..fb1c0b0 --- /dev/null +++ b/directx/dinput.c @@ -0,0 +1,338 @@ + +#include + +/* + * This file contains experimentally determined values for the c_cfDI* + * constants used in DirectX 5.0 + */ + +/* Keyboard */ + +static DIOBJECTDATAFORMAT KBD_fmt[] = { + { &GUID_Key, 0, 0x8000000C, 0x00000000 }, + { &GUID_Key, 1, 0x8000010C, 0x00000000 }, + { &GUID_Key, 2, 0x8000020C, 0x00000000 }, + { &GUID_Key, 3, 0x8000030C, 0x00000000 }, + { &GUID_Key, 4, 0x8000040C, 0x00000000 }, + { &GUID_Key, 5, 0x8000050C, 0x00000000 }, + { &GUID_Key, 6, 0x8000060C, 0x00000000 }, + { &GUID_Key, 7, 0x8000070C, 0x00000000 }, + { &GUID_Key, 8, 0x8000080C, 0x00000000 }, + { &GUID_Key, 9, 0x8000090C, 0x00000000 }, + { &GUID_Key, 10, 0x80000A0C, 0x00000000 }, + { &GUID_Key, 11, 0x80000B0C, 0x00000000 }, + { &GUID_Key, 12, 0x80000C0C, 0x00000000 }, + { &GUID_Key, 13, 0x80000D0C, 0x00000000 }, + { &GUID_Key, 14, 0x80000E0C, 0x00000000 }, + { &GUID_Key, 15, 0x80000F0C, 0x00000000 }, + { &GUID_Key, 16, 0x8000100C, 0x00000000 }, + { &GUID_Key, 17, 0x8000110C, 0x00000000 }, + { &GUID_Key, 18, 0x8000120C, 0x00000000 }, + { &GUID_Key, 19, 0x8000130C, 0x00000000 }, + { &GUID_Key, 20, 0x8000140C, 0x00000000 }, + { &GUID_Key, 21, 0x8000150C, 0x00000000 }, + { &GUID_Key, 22, 0x8000160C, 0x00000000 }, + { &GUID_Key, 23, 0x8000170C, 0x00000000 }, + { &GUID_Key, 24, 0x8000180C, 0x00000000 }, + { &GUID_Key, 25, 0x8000190C, 0x00000000 }, + { &GUID_Key, 26, 0x80001A0C, 0x00000000 }, + { &GUID_Key, 27, 0x80001B0C, 0x00000000 }, + { &GUID_Key, 28, 0x80001C0C, 0x00000000 }, + { &GUID_Key, 29, 0x80001D0C, 0x00000000 }, + { &GUID_Key, 30, 0x80001E0C, 0x00000000 }, + { &GUID_Key, 31, 0x80001F0C, 0x00000000 }, + { &GUID_Key, 32, 0x8000200C, 0x00000000 }, + { &GUID_Key, 33, 0x8000210C, 0x00000000 }, + { &GUID_Key, 34, 0x8000220C, 0x00000000 }, + { &GUID_Key, 35, 0x8000230C, 0x00000000 }, + { &GUID_Key, 36, 0x8000240C, 0x00000000 }, + { &GUID_Key, 37, 0x8000250C, 0x00000000 }, + { &GUID_Key, 38, 0x8000260C, 0x00000000 }, + { &GUID_Key, 39, 0x8000270C, 0x00000000 }, + { &GUID_Key, 40, 0x8000280C, 0x00000000 }, + { &GUID_Key, 41, 0x8000290C, 0x00000000 }, + { &GUID_Key, 42, 0x80002A0C, 0x00000000 }, + { &GUID_Key, 43, 0x80002B0C, 0x00000000 }, + { &GUID_Key, 44, 0x80002C0C, 0x00000000 }, + { &GUID_Key, 45, 0x80002D0C, 0x00000000 }, + { &GUID_Key, 46, 0x80002E0C, 0x00000000 }, + { &GUID_Key, 47, 0x80002F0C, 0x00000000 }, + { &GUID_Key, 48, 0x8000300C, 0x00000000 }, + { &GUID_Key, 49, 0x8000310C, 0x00000000 }, + { &GUID_Key, 50, 0x8000320C, 0x00000000 }, + { &GUID_Key, 51, 0x8000330C, 0x00000000 }, + { &GUID_Key, 52, 0x8000340C, 0x00000000 }, + { &GUID_Key, 53, 0x8000350C, 0x00000000 }, + { &GUID_Key, 54, 0x8000360C, 0x00000000 }, + { &GUID_Key, 55, 0x8000370C, 0x00000000 }, + { &GUID_Key, 56, 0x8000380C, 0x00000000 }, + { &GUID_Key, 57, 0x8000390C, 0x00000000 }, + { &GUID_Key, 58, 0x80003A0C, 0x00000000 }, + { &GUID_Key, 59, 0x80003B0C, 0x00000000 }, + { &GUID_Key, 60, 0x80003C0C, 0x00000000 }, + { &GUID_Key, 61, 0x80003D0C, 0x00000000 }, + { &GUID_Key, 62, 0x80003E0C, 0x00000000 }, + { &GUID_Key, 63, 0x80003F0C, 0x00000000 }, + { &GUID_Key, 64, 0x8000400C, 0x00000000 }, + { &GUID_Key, 65, 0x8000410C, 0x00000000 }, + { &GUID_Key, 66, 0x8000420C, 0x00000000 }, + { &GUID_Key, 67, 0x8000430C, 0x00000000 }, + { &GUID_Key, 68, 0x8000440C, 0x00000000 }, + { &GUID_Key, 69, 0x8000450C, 0x00000000 }, + { &GUID_Key, 70, 0x8000460C, 0x00000000 }, + { &GUID_Key, 71, 0x8000470C, 0x00000000 }, + { &GUID_Key, 72, 0x8000480C, 0x00000000 }, + { &GUID_Key, 73, 0x8000490C, 0x00000000 }, + { &GUID_Key, 74, 0x80004A0C, 0x00000000 }, + { &GUID_Key, 75, 0x80004B0C, 0x00000000 }, + { &GUID_Key, 76, 0x80004C0C, 0x00000000 }, + { &GUID_Key, 77, 0x80004D0C, 0x00000000 }, + { &GUID_Key, 78, 0x80004E0C, 0x00000000 }, + { &GUID_Key, 79, 0x80004F0C, 0x00000000 }, + { &GUID_Key, 80, 0x8000500C, 0x00000000 }, + { &GUID_Key, 81, 0x8000510C, 0x00000000 }, + { &GUID_Key, 82, 0x8000520C, 0x00000000 }, + { &GUID_Key, 83, 0x8000530C, 0x00000000 }, + { &GUID_Key, 84, 0x8000540C, 0x00000000 }, + { &GUID_Key, 85, 0x8000550C, 0x00000000 }, + { &GUID_Key, 86, 0x8000560C, 0x00000000 }, + { &GUID_Key, 87, 0x8000570C, 0x00000000 }, + { &GUID_Key, 88, 0x8000580C, 0x00000000 }, + { &GUID_Key, 89, 0x8000590C, 0x00000000 }, + { &GUID_Key, 90, 0x80005A0C, 0x00000000 }, + { &GUID_Key, 91, 0x80005B0C, 0x00000000 }, + { &GUID_Key, 92, 0x80005C0C, 0x00000000 }, + { &GUID_Key, 93, 0x80005D0C, 0x00000000 }, + { &GUID_Key, 94, 0x80005E0C, 0x00000000 }, + { &GUID_Key, 95, 0x80005F0C, 0x00000000 }, + { &GUID_Key, 96, 0x8000600C, 0x00000000 }, + { &GUID_Key, 97, 0x8000610C, 0x00000000 }, + { &GUID_Key, 98, 0x8000620C, 0x00000000 }, + { &GUID_Key, 99, 0x8000630C, 0x00000000 }, + { &GUID_Key, 100, 0x8000640C, 0x00000000 }, + { &GUID_Key, 101, 0x8000650C, 0x00000000 }, + { &GUID_Key, 102, 0x8000660C, 0x00000000 }, + { &GUID_Key, 103, 0x8000670C, 0x00000000 }, + { &GUID_Key, 104, 0x8000680C, 0x00000000 }, + { &GUID_Key, 105, 0x8000690C, 0x00000000 }, + { &GUID_Key, 106, 0x80006A0C, 0x00000000 }, + { &GUID_Key, 107, 0x80006B0C, 0x00000000 }, + { &GUID_Key, 108, 0x80006C0C, 0x00000000 }, + { &GUID_Key, 109, 0x80006D0C, 0x00000000 }, + { &GUID_Key, 110, 0x80006E0C, 0x00000000 }, + { &GUID_Key, 111, 0x80006F0C, 0x00000000 }, + { &GUID_Key, 112, 0x8000700C, 0x00000000 }, + { &GUID_Key, 113, 0x8000710C, 0x00000000 }, + { &GUID_Key, 114, 0x8000720C, 0x00000000 }, + { &GUID_Key, 115, 0x8000730C, 0x00000000 }, + { &GUID_Key, 116, 0x8000740C, 0x00000000 }, + { &GUID_Key, 117, 0x8000750C, 0x00000000 }, + { &GUID_Key, 118, 0x8000760C, 0x00000000 }, + { &GUID_Key, 119, 0x8000770C, 0x00000000 }, + { &GUID_Key, 120, 0x8000780C, 0x00000000 }, + { &GUID_Key, 121, 0x8000790C, 0x00000000 }, + { &GUID_Key, 122, 0x80007A0C, 0x00000000 }, + { &GUID_Key, 123, 0x80007B0C, 0x00000000 }, + { &GUID_Key, 124, 0x80007C0C, 0x00000000 }, + { &GUID_Key, 125, 0x80007D0C, 0x00000000 }, + { &GUID_Key, 126, 0x80007E0C, 0x00000000 }, + { &GUID_Key, 127, 0x80007F0C, 0x00000000 }, + { &GUID_Key, 128, 0x8000800C, 0x00000000 }, + { &GUID_Key, 129, 0x8000810C, 0x00000000 }, + { &GUID_Key, 130, 0x8000820C, 0x00000000 }, + { &GUID_Key, 131, 0x8000830C, 0x00000000 }, + { &GUID_Key, 132, 0x8000840C, 0x00000000 }, + { &GUID_Key, 133, 0x8000850C, 0x00000000 }, + { &GUID_Key, 134, 0x8000860C, 0x00000000 }, + { &GUID_Key, 135, 0x8000870C, 0x00000000 }, + { &GUID_Key, 136, 0x8000880C, 0x00000000 }, + { &GUID_Key, 137, 0x8000890C, 0x00000000 }, + { &GUID_Key, 138, 0x80008A0C, 0x00000000 }, + { &GUID_Key, 139, 0x80008B0C, 0x00000000 }, + { &GUID_Key, 140, 0x80008C0C, 0x00000000 }, + { &GUID_Key, 141, 0x80008D0C, 0x00000000 }, + { &GUID_Key, 142, 0x80008E0C, 0x00000000 }, + { &GUID_Key, 143, 0x80008F0C, 0x00000000 }, + { &GUID_Key, 144, 0x8000900C, 0x00000000 }, + { &GUID_Key, 145, 0x8000910C, 0x00000000 }, + { &GUID_Key, 146, 0x8000920C, 0x00000000 }, + { &GUID_Key, 147, 0x8000930C, 0x00000000 }, + { &GUID_Key, 148, 0x8000940C, 0x00000000 }, + { &GUID_Key, 149, 0x8000950C, 0x00000000 }, + { &GUID_Key, 150, 0x8000960C, 0x00000000 }, + { &GUID_Key, 151, 0x8000970C, 0x00000000 }, + { &GUID_Key, 152, 0x8000980C, 0x00000000 }, + { &GUID_Key, 153, 0x8000990C, 0x00000000 }, + { &GUID_Key, 154, 0x80009A0C, 0x00000000 }, + { &GUID_Key, 155, 0x80009B0C, 0x00000000 }, + { &GUID_Key, 156, 0x80009C0C, 0x00000000 }, + { &GUID_Key, 157, 0x80009D0C, 0x00000000 }, + { &GUID_Key, 158, 0x80009E0C, 0x00000000 }, + { &GUID_Key, 159, 0x80009F0C, 0x00000000 }, + { &GUID_Key, 160, 0x8000A00C, 0x00000000 }, + { &GUID_Key, 161, 0x8000A10C, 0x00000000 }, + { &GUID_Key, 162, 0x8000A20C, 0x00000000 }, + { &GUID_Key, 163, 0x8000A30C, 0x00000000 }, + { &GUID_Key, 164, 0x8000A40C, 0x00000000 }, + { &GUID_Key, 165, 0x8000A50C, 0x00000000 }, + { &GUID_Key, 166, 0x8000A60C, 0x00000000 }, + { &GUID_Key, 167, 0x8000A70C, 0x00000000 }, + { &GUID_Key, 168, 0x8000A80C, 0x00000000 }, + { &GUID_Key, 169, 0x8000A90C, 0x00000000 }, + { &GUID_Key, 170, 0x8000AA0C, 0x00000000 }, + { &GUID_Key, 171, 0x8000AB0C, 0x00000000 }, + { &GUID_Key, 172, 0x8000AC0C, 0x00000000 }, + { &GUID_Key, 173, 0x8000AD0C, 0x00000000 }, + { &GUID_Key, 174, 0x8000AE0C, 0x00000000 }, + { &GUID_Key, 175, 0x8000AF0C, 0x00000000 }, + { &GUID_Key, 176, 0x8000B00C, 0x00000000 }, + { &GUID_Key, 177, 0x8000B10C, 0x00000000 }, + { &GUID_Key, 178, 0x8000B20C, 0x00000000 }, + { &GUID_Key, 179, 0x8000B30C, 0x00000000 }, + { &GUID_Key, 180, 0x8000B40C, 0x00000000 }, + { &GUID_Key, 181, 0x8000B50C, 0x00000000 }, + { &GUID_Key, 182, 0x8000B60C, 0x00000000 }, + { &GUID_Key, 183, 0x8000B70C, 0x00000000 }, + { &GUID_Key, 184, 0x8000B80C, 0x00000000 }, + { &GUID_Key, 185, 0x8000B90C, 0x00000000 }, + { &GUID_Key, 186, 0x8000BA0C, 0x00000000 }, + { &GUID_Key, 187, 0x8000BB0C, 0x00000000 }, + { &GUID_Key, 188, 0x8000BC0C, 0x00000000 }, + { &GUID_Key, 189, 0x8000BD0C, 0x00000000 }, + { &GUID_Key, 190, 0x8000BE0C, 0x00000000 }, + { &GUID_Key, 191, 0x8000BF0C, 0x00000000 }, + { &GUID_Key, 192, 0x8000C00C, 0x00000000 }, + { &GUID_Key, 193, 0x8000C10C, 0x00000000 }, + { &GUID_Key, 194, 0x8000C20C, 0x00000000 }, + { &GUID_Key, 195, 0x8000C30C, 0x00000000 }, + { &GUID_Key, 196, 0x8000C40C, 0x00000000 }, + { &GUID_Key, 197, 0x8000C50C, 0x00000000 }, + { &GUID_Key, 198, 0x8000C60C, 0x00000000 }, + { &GUID_Key, 199, 0x8000C70C, 0x00000000 }, + { &GUID_Key, 200, 0x8000C80C, 0x00000000 }, + { &GUID_Key, 201, 0x8000C90C, 0x00000000 }, + { &GUID_Key, 202, 0x8000CA0C, 0x00000000 }, + { &GUID_Key, 203, 0x8000CB0C, 0x00000000 }, + { &GUID_Key, 204, 0x8000CC0C, 0x00000000 }, + { &GUID_Key, 205, 0x8000CD0C, 0x00000000 }, + { &GUID_Key, 206, 0x8000CE0C, 0x00000000 }, + { &GUID_Key, 207, 0x8000CF0C, 0x00000000 }, + { &GUID_Key, 208, 0x8000D00C, 0x00000000 }, + { &GUID_Key, 209, 0x8000D10C, 0x00000000 }, + { &GUID_Key, 210, 0x8000D20C, 0x00000000 }, + { &GUID_Key, 211, 0x8000D30C, 0x00000000 }, + { &GUID_Key, 212, 0x8000D40C, 0x00000000 }, + { &GUID_Key, 213, 0x8000D50C, 0x00000000 }, + { &GUID_Key, 214, 0x8000D60C, 0x00000000 }, + { &GUID_Key, 215, 0x8000D70C, 0x00000000 }, + { &GUID_Key, 216, 0x8000D80C, 0x00000000 }, + { &GUID_Key, 217, 0x8000D90C, 0x00000000 }, + { &GUID_Key, 218, 0x8000DA0C, 0x00000000 }, + { &GUID_Key, 219, 0x8000DB0C, 0x00000000 }, + { &GUID_Key, 220, 0x8000DC0C, 0x00000000 }, + { &GUID_Key, 221, 0x8000DD0C, 0x00000000 }, + { &GUID_Key, 222, 0x8000DE0C, 0x00000000 }, + { &GUID_Key, 223, 0x8000DF0C, 0x00000000 }, + { &GUID_Key, 224, 0x8000E00C, 0x00000000 }, + { &GUID_Key, 225, 0x8000E10C, 0x00000000 }, + { &GUID_Key, 226, 0x8000E20C, 0x00000000 }, + { &GUID_Key, 227, 0x8000E30C, 0x00000000 }, + { &GUID_Key, 228, 0x8000E40C, 0x00000000 }, + { &GUID_Key, 229, 0x8000E50C, 0x00000000 }, + { &GUID_Key, 230, 0x8000E60C, 0x00000000 }, + { &GUID_Key, 231, 0x8000E70C, 0x00000000 }, + { &GUID_Key, 232, 0x8000E80C, 0x00000000 }, + { &GUID_Key, 233, 0x8000E90C, 0x00000000 }, + { &GUID_Key, 234, 0x8000EA0C, 0x00000000 }, + { &GUID_Key, 235, 0x8000EB0C, 0x00000000 }, + { &GUID_Key, 236, 0x8000EC0C, 0x00000000 }, + { &GUID_Key, 237, 0x8000ED0C, 0x00000000 }, + { &GUID_Key, 238, 0x8000EE0C, 0x00000000 }, + { &GUID_Key, 239, 0x8000EF0C, 0x00000000 }, + { &GUID_Key, 240, 0x8000F00C, 0x00000000 }, + { &GUID_Key, 241, 0x8000F10C, 0x00000000 }, + { &GUID_Key, 242, 0x8000F20C, 0x00000000 }, + { &GUID_Key, 243, 0x8000F30C, 0x00000000 }, + { &GUID_Key, 244, 0x8000F40C, 0x00000000 }, + { &GUID_Key, 245, 0x8000F50C, 0x00000000 }, + { &GUID_Key, 246, 0x8000F60C, 0x00000000 }, + { &GUID_Key, 247, 0x8000F70C, 0x00000000 }, + { &GUID_Key, 248, 0x8000F80C, 0x00000000 }, + { &GUID_Key, 249, 0x8000F90C, 0x00000000 }, + { &GUID_Key, 250, 0x8000FA0C, 0x00000000 }, + { &GUID_Key, 251, 0x8000FB0C, 0x00000000 }, + { &GUID_Key, 252, 0x8000FC0C, 0x00000000 }, + { &GUID_Key, 253, 0x8000FD0C, 0x00000000 }, + { &GUID_Key, 254, 0x8000FE0C, 0x00000000 }, + { &GUID_Key, 255, 0x8000FF0C, 0x00000000 }, +}; + +const DIDATAFORMAT c_dfDIKeyboard = { 24, 16, 0x00000002, 256, 256, KBD_fmt }; + + +/* Mouse */ + +static DIOBJECTDATAFORMAT PTR_fmt[] = { + { &GUID_XAxis, 0, 0x00FFFF03, 0x00000000 }, + { &GUID_YAxis, 4, 0x00FFFF03, 0x00000000 }, + { &GUID_ZAxis, 8, 0x80FFFF03, 0x00000000 }, + { NULL, 12, 0x00FFFF0C, 0x00000000 }, + { NULL, 13, 0x00FFFF0C, 0x00000000 }, + { NULL, 14, 0x80FFFF0C, 0x00000000 }, + { NULL, 15, 0x80FFFF0C, 0x00000000 }, +}; + +const DIDATAFORMAT c_dfDIMouse = { 24, 16, 0x00000002, 16, 7, PTR_fmt }; + + +/* Joystick */ + +static DIOBJECTDATAFORMAT JOY_fmt[] = { + { &GUID_XAxis, 0, 0x80FFFF03, 0x00000100 }, + { &GUID_YAxis, 4, 0x80FFFF03, 0x00000100 }, + { &GUID_ZAxis, 8, 0x80FFFF03, 0x00000100 }, + { &GUID_RxAxis, 12, 0x80FFFF03, 0x00000100 }, + { &GUID_RyAxis, 16, 0x80FFFF03, 0x00000100 }, + { &GUID_RzAxis, 20, 0x80FFFF03, 0x00000100 }, + { &GUID_Slider, 24, 0x80FFFF03, 0x00000100 }, + { &GUID_Slider, 28, 0x80FFFF03, 0x00000100 }, + { &GUID_POV, 32, 0x80FFFF10, 0x00000000 }, + { &GUID_POV, 36, 0x80FFFF10, 0x00000000 }, + { &GUID_POV, 40, 0x80FFFF10, 0x00000000 }, + { &GUID_POV, 44, 0x80FFFF10, 0x00000000 }, + { NULL, 48, 0x80FFFF0C, 0x00000000 }, + { NULL, 49, 0x80FFFF0C, 0x00000000 }, + { NULL, 50, 0x80FFFF0C, 0x00000000 }, + { NULL, 51, 0x80FFFF0C, 0x00000000 }, + { NULL, 52, 0x80FFFF0C, 0x00000000 }, + { NULL, 53, 0x80FFFF0C, 0x00000000 }, + { NULL, 54, 0x80FFFF0C, 0x00000000 }, + { NULL, 55, 0x80FFFF0C, 0x00000000 }, + { NULL, 56, 0x80FFFF0C, 0x00000000 }, + { NULL, 57, 0x80FFFF0C, 0x00000000 }, + { NULL, 58, 0x80FFFF0C, 0x00000000 }, + { NULL, 59, 0x80FFFF0C, 0x00000000 }, + { NULL, 60, 0x80FFFF0C, 0x00000000 }, + { NULL, 61, 0x80FFFF0C, 0x00000000 }, + { NULL, 62, 0x80FFFF0C, 0x00000000 }, + { NULL, 63, 0x80FFFF0C, 0x00000000 }, + { NULL, 64, 0x80FFFF0C, 0x00000000 }, + { NULL, 65, 0x80FFFF0C, 0x00000000 }, + { NULL, 66, 0x80FFFF0C, 0x00000000 }, + { NULL, 67, 0x80FFFF0C, 0x00000000 }, + { NULL, 68, 0x80FFFF0C, 0x00000000 }, + { NULL, 69, 0x80FFFF0C, 0x00000000 }, + { NULL, 70, 0x80FFFF0C, 0x00000000 }, + { NULL, 71, 0x80FFFF0C, 0x00000000 }, + { NULL, 72, 0x80FFFF0C, 0x00000000 }, + { NULL, 73, 0x80FFFF0C, 0x00000000 }, + { NULL, 74, 0x80FFFF0C, 0x00000000 }, + { NULL, 75, 0x80FFFF0C, 0x00000000 }, + { NULL, 76, 0x80FFFF0C, 0x00000000 }, + { NULL, 77, 0x80FFFF0C, 0x00000000 }, + { NULL, 78, 0x80FFFF0C, 0x00000000 }, + { NULL, 79, 0x80FFFF0C, 0x00000000 }, +}; + +const DIDATAFORMAT c_dfDIJoystick = { 24, 16, 0x00000001, 80, 44, JOY_fmt }; + diff --git a/directx/fixdirectx.sh b/directx/fixdirectx.sh new file mode 100755 index 0000000..beed18b --- /dev/null +++ b/directx/fixdirectx.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# +# A script to fix the DirectX includes so that gcc can compile them... + +#cd `dirname $0` +for file in include/directx6/*.h +do echo "Stripping $file..." + tr -d '\r' <$file >$file.new && mv $file.new $file +done + +# Fix the few remaining headers that have anonymous unions +for file in include/directx6/d3dtypes.h +do if [ -f $file ]; then + echo "Fixing $file..." + perl ./deunion.pl <$file >$file.new && mv $file.new $file + fi +done diff --git a/directx/include/directx.h b/directx/include/directx.h new file mode 100644 index 0000000..cf31b01 --- /dev/null +++ b/directx/include/directx.h @@ -0,0 +1,79 @@ + +#ifndef _directx_h_ +#define _directx_h + +/* Include all of the DirectX 5.0 headers and adds any necessary tweaks */ + +#include +#include +#ifndef WIN32 +#define WIN32 +#endif +#undef WINNT + +/* Far pointers don't exist in 32-bit code */ +#ifndef FAR +#define FAR +#endif + +/* Error codes not yet included in Win32 API header files */ +#ifndef MAKE_HRESULT +#define MAKE_HRESULT(sev,fac,code) \ + ((HRESULT)(((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code)))) +#endif + +#ifndef S_OK +#define S_OK (HRESULT)0x00000000L +#endif + +#ifndef SUCCEEDED +#define SUCCEEDED(x) ((HRESULT)(x) >= 0) +#endif +#ifndef FAILED +#define FAILED(x) ((HRESULT)(x)<0) +#endif + +#ifndef E_FAIL +#define E_FAIL (HRESULT)0x80000008L +#endif +#ifndef E_NOINTERFACE +#define E_NOINTERFACE (HRESULT)0x80004002L +#endif +#ifndef E_OUTOFMEMORY +#define E_OUTOFMEMORY (HRESULT)0x8007000EL +#endif +#ifndef E_INVALIDARG +#define E_INVALIDARG (HRESULT)0x80070057L +#endif +#ifndef E_NOTIMPL +#define E_NOTIMPL (HRESULT)0x80004001L +#endif +#ifndef REGDB_E_CLASSNOTREG +#define REGDB_E_CLASSNOTREG (HRESULT)0x80040154L +#endif + +/* Severity codes */ +#ifndef SEVERITY_ERROR +#define SEVERITY_ERROR 1 +#endif + +/* Error facility codes */ +#ifndef FACILITY_WIN32 +#define FACILITY_WIN32 7 +#endif + +#ifndef FIELD_OFFSET +#define FIELD_OFFSET(type, field) ((LONG)&(((type *)0)->field)) +#endif + +/* DirectX 6.0 header includes + (if it isn't included, I haven't tested it yet) + */ +#ifdef __GNUC__ +#define NONAMELESSUNION +#endif +#include +#include +#include + +#endif /* _directx_h */ diff --git a/directx/libddraw.def b/directx/libddraw.def new file mode 100644 index 0000000..5df0c3a --- /dev/null +++ b/directx/libddraw.def @@ -0,0 +1,3 @@ +EXPORTS + DirectDrawCreate@12 + DirectDrawEnumerateA@8 diff --git a/directx/libdinput.def b/directx/libdinput.def new file mode 100644 index 0000000..f2f3f67 --- /dev/null +++ b/directx/libdinput.def @@ -0,0 +1,2 @@ +EXPORTS + DirectInputCreateA@16 diff --git a/directx/libdplayx.def b/directx/libdplayx.def new file mode 100644 index 0000000..1171d8f --- /dev/null +++ b/directx/libdplayx.def @@ -0,0 +1,2 @@ +EXPORTS + DirectPlayLobbyCreateA@20 diff --git a/directx/libdsound.def b/directx/libdsound.def new file mode 100644 index 0000000..f698fa9 --- /dev/null +++ b/directx/libdsound.def @@ -0,0 +1,9 @@ +EXPORTS + DirectSoundCaptureEnumerateW@8 + DirectSoundCaptureEnumerateA@8 + DirectSoundCaptureCreate@12 + DllGetClassObject + DllCanUnloadNow + DirectSoundEnumerateW@8 + DirectSoundEnumerateA@8 + DirectSoundCreate@12 diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..9cebebb --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,22 @@ +DOC = main +SECTS = $(DOC).sgml intro.sgml +SRC = $(SECTS) builddate + +EXTRA_DIST = $(SECTS) + +builddate: + date "+%e %B %Y" > $@ + +$(DOC).dvi: $(SRC) + db2dvi $< + +$(DOC).ps: $(DOC).dvi + dvips $< -o $@ + +$(DOC).pdf: $(SRC) + db2pdf $< + +$(DOC): $(SRC) + -rm -rf $(DOC) + db2html $< + diff --git a/doc/Makefile.in b/doc/Makefile.in new file mode 100644 index 0000000..9f8d893 --- /dev/null +++ b/doc/Makefile.in @@ -0,0 +1,403 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = doc +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUDIOFILE_CFLAGS = @AUDIOFILE_CFLAGS@ +AUDIOFILE_LIBS = @AUDIOFILE_LIBS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +HAVE_ALSA = @HAVE_ALSA@ +HAVE_BITTYPES = @HAVE_BITTYPES@ +HAVE_DIRECTX = @HAVE_DIRECTX@ +HAVE_IFRNEWNAME = @HAVE_IFRNEWNAME@ +HAVE_MKISS = @HAVE_MKISS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTHREAD = @LIBTHREAD@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +M_PI = @M_PI@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USEMMX = @USEMMX@ +USEVIS = @USEVIS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WIN32 = @WIN32@ +WINDRES = @WINDRES@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CFLAGS = @XML_CFLAGS@ +XML_LIBS = @XML_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +DOC = main +SECTS = $(DOC).sgml intro.sgml +SRC = $(SECTS) builddate +EXTRA_DIST = $(SECTS) +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu doc/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am + + +builddate: + date "+%e %B %Y" > $@ + +$(DOC).dvi: $(SRC) + db2dvi $< + +$(DOC).ps: $(DOC).dvi + dvips $< -o $@ + +$(DOC).pdf: $(SRC) + db2pdf $< + +$(DOC): $(SRC) + -rm -rf $(DOC) + db2html $< + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/doc/intro.sgml b/doc/intro.sgml new file mode 100644 index 0000000..cd348dc --- /dev/null +++ b/doc/intro.sgml @@ -0,0 +1,16 @@ + + + + SoundModem Documentation + + + + Blah + + + + + + + + diff --git a/doc/main.sgml b/doc/main.sgml new file mode 100644 index 0000000..227fa83 --- /dev/null +++ b/doc/main.sgml @@ -0,0 +1,36 @@ + + --> + + + +]> + + + + SoundModem Documentation + + + Thomas + Sailer + +
sailer@ife.ee.ethz.ch
+
+
+
+ + + 2000 + Thomas Sailer + + +
+ + &intro; + +
+ + + + + diff --git a/flexdrv/Makefile.am b/flexdrv/Makefile.am new file mode 100644 index 0000000..0fd4f5b --- /dev/null +++ b/flexdrv/Makefile.am @@ -0,0 +1,35 @@ +EXTRA_DIST = soundmodem.c soundmodem.rc driver.c drv32.h driver.obj flexdriv.def flexdrv.h resource.h + +INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir) -I$(top_srcdir)/matlib -I$(top_srcdir)/libmisc \ + -I$(top_srcdir)/soundcard -I$(top_srcdir)/directx/include -I$(top_srcdir)/directx/include/directx6 \ + @PTHREAD_CFLAGS@ + + +MODEMLIBS = ../afsk/libafsk.a ../fsk/libfsk.a ../pammodem/libpam.a ../pskmodem/libpsk.a ../newqpsk/libnewqpsk.a ../p3dmodem/libp3d.a + +if WIN32 + +noinst_LIBRARIES = libflxdrv.a + +libflxdrv_a_SOURCES = driver.c soundmodem.c + +soundmodem.res: soundmodem.rc resource.h + $(WINDRES) $< -O coff -o $@ + +DLLNAME = soundmodem +DLLOBJ = driver.o soundmodem.o soundmodem.res $(MODEMLIBS) ../soundcard/libcommon.a ../soundcard/libaudioio.a ../soundcard/libpttio.a \ + ../matlib/libmat.a ../libmisc/libmisc.a +DLLLDARGS = @PTHREAD_LIBS@ @LIBTHREAD@ $(LIBS) +DLLDEF = --def $(srcdir)/flexdriv.def + +noinst_SCRIPTS = $(DLLNAME).dll + +$(DLLNAME).dll: $(DLLOBJ) + $(CC) -mdll -mno-cygwin -Wl,--base-file,$(DLLNAME).base -o $(DLLNAME).dll $(DLLOBJ) $(DLLLDARGS) + $(DLLTOOL) --as=$(AS) --dllname $(DLLNAME).dll $(DLLDEF) --base-file $(DLLNAME).base --output-exp $(DLLNAME).exp $(DLLOBJ) + $(CC) -mdll -mno-cygwin -Wl,--base-file,$(DLLNAME).base,$(DLLNAME).exp -o $(DLLNAME).dll $(DLLOBJ) $(DLLLDARGS) + $(DLLTOOL) --as=$(AS) --dllname $(DLLNAME).dll $(DLLDEF) --base-file $(DLLNAME).base --output-exp $(DLLNAME).exp $(DLLOBJ) + $(CC) -mdll -mno-cygwin -Wl,$(DLLNAME).exp -o $(DLLNAME).dll $(DLLOBJ) $(DLLLDARGS) + $(DLLTOOL) --as=$(AS) --dllname $(DLLNAME).dll $(DLLDEF) --output-lib lib$(DLLNAME).a $(DLLOBJ) + +endif diff --git a/flexdrv/Makefile.in b/flexdrv/Makefile.in new file mode 100644 index 0000000..57d6f86 --- /dev/null +++ b/flexdrv/Makefile.in @@ -0,0 +1,513 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = flexdrv +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +libflxdrv_a_AR = $(AR) $(ARFLAGS) +libflxdrv_a_LIBADD = +am__libflxdrv_a_SOURCES_DIST = driver.c soundmodem.c +@WIN32_TRUE@am_libflxdrv_a_OBJECTS = driver.$(OBJEXT) \ +@WIN32_TRUE@ soundmodem.$(OBJEXT) +libflxdrv_a_OBJECTS = $(am_libflxdrv_a_OBJECTS) +SCRIPTS = $(noinst_SCRIPTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libflxdrv_a_SOURCES) +DIST_SOURCES = $(am__libflxdrv_a_SOURCES_DIST) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUDIOFILE_CFLAGS = @AUDIOFILE_CFLAGS@ +AUDIOFILE_LIBS = @AUDIOFILE_LIBS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +HAVE_ALSA = @HAVE_ALSA@ +HAVE_BITTYPES = @HAVE_BITTYPES@ +HAVE_DIRECTX = @HAVE_DIRECTX@ +HAVE_IFRNEWNAME = @HAVE_IFRNEWNAME@ +HAVE_MKISS = @HAVE_MKISS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTHREAD = @LIBTHREAD@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +M_PI = @M_PI@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USEMMX = @USEMMX@ +USEVIS = @USEVIS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WIN32 = @WIN32@ +WINDRES = @WINDRES@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CFLAGS = @XML_CFLAGS@ +XML_LIBS = @XML_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = soundmodem.c soundmodem.rc driver.c drv32.h driver.obj flexdriv.def flexdrv.h resource.h +INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir) -I$(top_srcdir)/matlib -I$(top_srcdir)/libmisc \ + -I$(top_srcdir)/soundcard -I$(top_srcdir)/directx/include -I$(top_srcdir)/directx/include/directx6 \ + @PTHREAD_CFLAGS@ + +MODEMLIBS = ../afsk/libafsk.a ../fsk/libfsk.a ../pammodem/libpam.a ../pskmodem/libpsk.a ../newqpsk/libnewqpsk.a ../p3dmodem/libp3d.a +@WIN32_TRUE@noinst_LIBRARIES = libflxdrv.a +@WIN32_TRUE@libflxdrv_a_SOURCES = driver.c soundmodem.c +@WIN32_TRUE@DLLNAME = soundmodem +@WIN32_TRUE@DLLOBJ = driver.o soundmodem.o soundmodem.res $(MODEMLIBS) ../soundcard/libcommon.a ../soundcard/libaudioio.a ../soundcard/libpttio.a \ +@WIN32_TRUE@ ../matlib/libmat.a ../libmisc/libmisc.a + +@WIN32_TRUE@DLLLDARGS = @PTHREAD_LIBS@ @LIBTHREAD@ $(LIBS) +@WIN32_TRUE@DLLDEF = --def $(srcdir)/flexdriv.def +@WIN32_TRUE@noinst_SCRIPTS = $(DLLNAME).dll +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu flexdrv/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu flexdrv/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libflxdrv.a: $(libflxdrv_a_OBJECTS) $(libflxdrv_a_DEPENDENCIES) + -rm -f libflxdrv.a + $(libflxdrv_a_AR) libflxdrv.a $(libflxdrv_a_OBJECTS) $(libflxdrv_a_LIBADD) + $(RANLIB) libflxdrv.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/driver.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/soundmodem.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) $(SCRIPTS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am + + +@WIN32_TRUE@soundmodem.res: soundmodem.rc resource.h +@WIN32_TRUE@ $(WINDRES) $< -O coff -o $@ + +@WIN32_TRUE@$(DLLNAME).dll: $(DLLOBJ) +@WIN32_TRUE@ $(CC) -mdll -mno-cygwin -Wl,--base-file,$(DLLNAME).base -o $(DLLNAME).dll $(DLLOBJ) $(DLLLDARGS) +@WIN32_TRUE@ $(DLLTOOL) --as=$(AS) --dllname $(DLLNAME).dll $(DLLDEF) --base-file $(DLLNAME).base --output-exp $(DLLNAME).exp $(DLLOBJ) +@WIN32_TRUE@ $(CC) -mdll -mno-cygwin -Wl,--base-file,$(DLLNAME).base,$(DLLNAME).exp -o $(DLLNAME).dll $(DLLOBJ) $(DLLLDARGS) +@WIN32_TRUE@ $(DLLTOOL) --as=$(AS) --dllname $(DLLNAME).dll $(DLLDEF) --base-file $(DLLNAME).base --output-exp $(DLLNAME).exp $(DLLOBJ) +@WIN32_TRUE@ $(CC) -mdll -mno-cygwin -Wl,$(DLLNAME).exp -o $(DLLNAME).dll $(DLLOBJ) $(DLLLDARGS) +@WIN32_TRUE@ $(DLLTOOL) --as=$(AS) --dllname $(DLLNAME).dll $(DLLDEF) --output-lib lib$(DLLNAME).a $(DLLOBJ) + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/flexdrv/driver.c b/flexdrv/driver.c new file mode 100644 index 0000000..bfef886 --- /dev/null +++ b/flexdrv/driver.c @@ -0,0 +1,74 @@ +#define STRICT +#include +#pragma hdrstop + +#include +#include "flexdrv.h" // der offizielle Header +#include "drv32.h" + +HANDLE hInst; +//-------------------------------------------------------------------- +// Einziger Treiberaufruf +u32 flexnet_driver(int func, int kanal, int a, int b) + { + static byte base_kanal; + static byte tx_kanal; + static L1FRAME *l1f; + L1FRAME *rxf; + switch (func) + { + case drv_interfaceversion: + return DRIVER_INTERFACE_VERSION; + case drv_ident: return (u32)l1_ident((byte)(kanal-base_kanal)); + case drv_version: return (u32)l1_version((byte)(kanal - base_kanal)); + case drv_config: return config_device((byte)(kanal), (HWND)a, (byte)(b - base_kanal)); + case drv_confinfo: return (u32)config_info((byte)(kanal - base_kanal)); + case drv_init_device: + base_kanal = kanal; + return init_device((HKEY)b); + case drv_get_ch_cnt: return l1_get_ch_cnt(); + case drv_exit: l1_exit((HKEY)a); break; + case drv_ch_active: return l1_ch_active((byte)(kanal - base_kanal)); + case drv_init_kanal: return l1_init_kanal((byte)(kanal - base_kanal), (u16)a, (u16)b); + case drv_stat: return (u32)l1_stat((byte)(kanal - base_kanal), (byte)a); + case drv_ch_state: return l1_ch_state((byte)(kanal - base_kanal)); + case drv_scale: return l1_scale((byte)(kanal - base_kanal)); + case drv_tx_calib: l1_tx_calib((byte)(kanal - base_kanal), (byte)a); break; + case drv_set_led: set_led((byte)(kanal - base_kanal), (byte)a); break; + case drv_rx_frame: + if (rxf = l1_rx_frame()) + rxf->kanal += base_kanal; + return (u32)rxf; + case drv_get_framebuf: return (u32)(l1f = l1_get_framebuf(tx_kanal = (byte)(kanal - base_kanal))); + case drv_tx_frame: + if (l1f) l1f->kanal = tx_kanal; + return l1_tx_frame(); + case drv_get_txdelay: return get_txdelay((byte)(kanal - base_kanal)); + case drv_get_mode: return get_mode((byte)(kanal - base_kanal)); + case drv_get_baud: return get_baud((byte)(kanal - base_kanal)); + case drv_set_txdelay: set_txdelay((byte)(kanal - base_kanal), (byte)a); break; + default: + return 0; + } + return 0; + } +//-------------------------------------------------------------------- +BOOL WINAPI DllMain (HANDLE hModule, DWORD dwFunction, LPVOID lpNot) + { + switch(dwFunction) + { + case DLL_PROCESS_ATTACH: + // hier evtl. noch Test ob mehrfach geladen, dazu brauchts aber Handle (mutex oder sowas) + hInst = hModule; + // kein break, auch neuer Prozess istn Thread + case DLL_THREAD_ATTACH: + break; + case DLL_PROCESS_DETACH: + // vor allem wenn harter Abbruch: Alles deinitialisieren! + break; // kein Durchfall, Prozessende gibt eh alles frei und schliesst pipes + case DLL_THREAD_DETACH: + break; + } + return 1; // Indicate that the DLL was initialized successfully. + } +//-------------------------------------------------------------------- diff --git a/flexdrv/driver.obj b/flexdrv/driver.obj new file mode 100644 index 0000000000000000000000000000000000000000..4c2005c5a6904340c9387ccee93438ad3e81acae GIT binary patch literal 3239 zcmcJRU1%d!6vt1JHtnw2ZPso5T0c^ZTGuutePK zv6FfCiFW}uFI((5-at_)<ACrahi_kxZA6BLf9?{; zHG>OueYnd$K66gwvri_`ueQJ3`IJXw?(`g!JzHPX#+T-h_TkQd4{KXGl4`7e-$;6j z2Mx)xwsyOodl!q{KEg|;DYtcY+ikea<9nN@xFPMR?(i0OUYK%Atme9GNg~4oMw;o{ z9Gdb$slPPM^ZqY|@52}_F9lHFDRejLIIeCQGBvh|iIy_8MbM~dB~w#DBcfd}wN22l zXfLAXnBDXy>Zs5=sP%c@2Sr5t+SIOs!lM0RYQKR7MRVZ|(S18W_ltJI)OtZ7(MC<} z6lg%Sc~e^i^@~;j-6!;ZNVaNwK>K>J#k^lP;NdZ=2eCpnJq)7o_L> z1&Hr;H+^er--GTF?N?L#0~8eP2u?xW_c$mZS^#th$V)-c?LvK^+l2Z-w+an{P6!Qw zZV`%sZWej~#AltClAs%fCP6m{O@VrZQlM_3H0Zd{0_b|7MbI&!42aKIFD-$(go>b} zLMtGC^1P&id_qrvt`pKghlNlPpZr|f^hQqj4%&P=*y&n7g!82BG7rdE`I)Z~iz9R4 z6>;(C4JFWaP^eT^jStY@*NB!q6Jwb(s#32gTIR8GB~x50ZzyZEOrg5ES~a?%LL-RT zSifc1BJ#NSNwAmf%5T%eN(qG8eYBNGV zIFw=f#Gwq)6^9a~R~<@(b{tBWaI0-|4bqZb3CHDM#F9@qCZ~i|8I||Ls*K1}uPX>B zJ#P6e#GYFILikzpxc2)GA?n2#@2l9LB|0rNR~(1Stkhf?%Hu5xpSOB3Y>c0vX5?33 z(21+5e9-V|M&7e2*_xtdRi&tlM&xg7Hr)BHMfuUDWYuuCrsa4mP>eXg>s^cDaTyZZ zu$NLVJG_qBY}h`~q71YsV=c;bi}Hv~k+*3$MgeSszRT7>M%gnLpJ#@XoA{T^`nSk^ zkBd(n!=_2uhSW~HQfp*Br#!aE?GpJMJhCPIOv>u#5y}2&^`fHY&Ql_vt0~!Yxk^q= zCc=q?-8PwwC*zb|#)jr|>qVVbt3^d8BM9Gft)4Bd0, erfolgt Abbruch, es duerfen dann also keine + aktiven oder umgelegten Interrupts verbleiben! +*/ +/* This procedure is called from the driver stub at installation time. It + may be used to parse the command line + Return value: 0=OK; otherwise installation is cancelled and the value + returned as exit argument + WARNING: If return value >0 the installation is cancelled, active or + patched interrupt vectors must not be left! +*/ +void far l1_exit(void); +/* Wird bei Verlassen des Programms aufgerufen und kann zum Aufr„umen + verwendet werden (Interrupts und Schnittstellen abschalten) +*/ +/* Is called when the driver terminates and may be used to clean up everything + (switch off interrupts and interfaces) +*/ + +#endif + +u16 far l1_get_ch_cnt(void); +/* Aufruf aus Treiberkopf bei Programmstart; muss Anzahl der im Treiber + definierten Kanaele liefern +*/ +/* called from the driver stub at installation time; should return the number + of channels defined by the driver +*/ + + +byte far l1_ch_active(byte kanal); +/* Zurueckliefern, ob Kanal im Prinzip funktionstuechtig ist. + Also immer, ausser wenn Dummykanal, >0 liefern! +*/ +/* report if the channel could work in principle. Thus always return >0 if + not a dummy channel. +*/ + +byte far l1_init_kanal(byte kanal, u16 baud, u16 mode); +/* + Kanalnummer: 0-15 + Baud: Baudrate / 100, z.B. 115200 Baud wird als 1152 uebergeben + Mode: Kanalmodus, Bitflaggen, derzeit definiert: + 0x0080 d Vollduplex + 0x0040 r Externer RX-Takt + 0x0020 t Externer TX-Takt + 0x0010 z NRZ-Kodierung (Anstatt NRZI), nur f. HDLC + 0x0002 c Kanal macht immer CRC, nur f. KISS + Baycom: Soft-DCD aktivieren + 0x0001 - Kanal per Modebefehl deaktiviert + Es sind noch weitere Bits definiert, die sind aber im L1-Treiber nicht + relevant! + Um eventuelle Verklemmungen zu beseitigen, sollte in diesem Modul der + Treiber soweit als moeglich (re)initialisiert werden! + + Return: 1 wenn alles ok; + 0 wenn Parameterfehler, dann Anzeige von '---' in der Modeliste + + Aufruf erfolgt beim Programmstart sowie bei jeder Baud- oder Mode„nderung, + ausserdem wenn der Kanal seit 3 Minuten nichts mehr empfangen hat. +*/ +/* + kanal: channel number (0-15) + baud: the baud rate / 100, for example 115200 baud is specified as + baud = 1152 + mode: the channel mode, a bit field, currently the following bits are + defined: + 0x0080 d Full duplex + 0x0040 r External RX clock + 0x0020 t External TX clock + 0x0010 z NRZ coding (instead of NRZI) (only for HDLC) + 0x0002 c KISS: driver forces checksum + Baycom: activate software DCD + 0x0001 - channel inactivated + There are some additional bits defined which are not relevant to the + L1 driver. + + To recover from lockups, this function should (re)initialize as much of the + driver and the hardware as possible. + + Return value: 1 if everything is ok; + 0 if a parameter error; '---' is then displayed in the ports + list + + This procedure is called at program start, at every baud rate or mode + change, or if the driver has not received anything for 3 minutes. +*/ + +L1FRAME far * far l1_rx_frame(void); +/* + Wird zyklisch aufgerufen + + Return: *Frame oder 0 wenn nichts empfangen + Der Frame muá jeweils bis zum n„chsten Aufruf verfgbar bleiben, + d.h. jeder Aufruf l”scht den zuletzt gemeldeten Frame +*/ +/* + Is called periodically + + Return value: *Frame or null pointer if nothing was received + The frame has to be readable until the next call to this + function, i.e. every call removes the frame returned by the + last call. +*/ + + +L1FRAME far * far l1_get_framebuf(byte kanal); +/* L2 fordert hiermit einen Sendepuffer an. Er muá die Maximall„nge aufnehmen + k”nnen. Wenn erfolgreich, folgt vielleicht l1_tx_frame(), es kann aber + auch vorkommen dass ein weiterer Aufruf erfolgt! Also nicht dynamisch + allokieren, sondern nur einen Pointer liefern! + Return: *Frame, der Frame wird hier hineingebaut + 0 wenn kein Platz verfuegbar +*/ +/* L2 requests a transmitter buffer. The buffer must be able to store the + maximum length. If successful, a l1_tx_frame() probably follows, but + it may also happen that another call to l1_get_framebuf() follows! + Therefore, do not allocate dynamically, just return a pointer! + Return value: *Frame : the frame is stored here + 0 : no storage available +*/ + + +byte far l1_tx_frame(void); +/* Aussenden des Frames in vorher mit l1_get_framebuf angefordeten Buffers; + Return: 1 wenn ok, sonst 0 + Wenn der Sender aus ist, muss jetzt die Entscheidung fallen ob gesendet + werden kann!!! + ACHTUNG: Wenn die Sendung nicht moeglich ist, darf der Frame auf keinen + Fall gespeichert werden! Stattdessen den Frame verwerfen und 0 returnen. + DCD darf den Sender auch bei Halbduplex NICHT sperren! Dies ist Bedingung + fuer das Funktionieren des FlexNet-OPTIMA-Zugriffsverfahrens. Die DCD- + Verriegelung ist bereits in FlexNet enthalten! + Wenn der TX bereits an ist (PTT an) und es werden bereits Frames gesendet, + sollte der Frame zur Sendung zwischengespeichert werden, sofern der Puffer- + platz dafuer ausreicht. Wenn nicht, 0 returnen, dann erfolgt spaeter ein + neuer Versuch. In diesem Fall muss jedoch sichergestellt sein, dass der + Frame auf jeden Fall noch in DIESEM Durchgang gesendet wird! + Das Kanalzugriffstiming findet bereits im FlexNet-Kern statt! +*/ +/* Transmit the frame in the buffer that was returned by the last + l1_get_framebuf() + Return value: 1 if ok, 0 if not. + If the transmitter is off, then the decision must now be made if + transmission is possible!!! + WARNING: If transmission is not possible now, the frame MUST NOT be stored! + The frame should be thrown away and zero should be returned. DCD must not + inhibit the transmitter, not even in half duplex mode! This is a necessity + for the FlexNet-OPTIMA-Channel access algorithm. The Kernel already + contains the DCD transmitter inhibit. + If the transmitter is already on (PTT keyed) and frames are being sent, + then the frame should be stored if the buffer memory suffices. If not, + zero should be returned, the kernel will try again later. If the frame + is stored, it is important that it gets transmitted during the same + transmission! + The channel access timing is already handled by the FlexNet kernel! +*/ + +void far l1_tx_calib(byte kanal, byte minutes); +/* Sofern die Hardware es erlaubt, Sender in Calibrate-Modus schalten. + Minutes=0 stoppt den Calibrate-Mode sofort. +*/ +/* If the hardware allows it, switch the transmitter into the calibrate mode + (i.e. start transmitting a calibration pattern) + minutes=0 should immediately stop the calibration mode. +*/ + +byte far l1_ch_state(byte kanal); +/* Gibt verschiedene Kanalzust„nde zurck, Bits sind 1 wenn wahr: + 0x40 RxB RxBuffer ist nicht leer + 0x20 PTT Sender ist an + 0x10 DCD Empf„nger ist aktiv + 0x08 FDX Kanal ist Vollduplex, kann also immer empfangen + 0x04 TBY Sender ist nicht bereit, z.B. wegen Calibrate + +Anmerkung: Die korrekte Bedienung dieser Flags ist essentiell fuer das +Funktionieren des FlexNet-Kanalzugriffstimings incl. DAMA-Master und -Slave. + +Erlaeuterungen zu den Flags: + +RxB ist 1 wenn gueltige RX-Frames im Puffer liegen. Verriegelt u.a. den Sender + bei Halbduplex, da immer erst alle Frames verarbeitet werden sollen. + Waehrend des Empfangs muss dieses Flag mit DCD ueberlappend bedient werden, + d.h. sobald ein RX-Frame als gueltig erkannt wird, muss RxB spaetestens + 1 werden, wenn DCD 0 wird! +PTT 1 wenn der TX bereits an ist. Dann setzt FlexNet voraus dass uebergebene + Frames in diesem Durchgang noch gesendet werden koennen. Braucht nicht + bedient zu werden bei reinen Vollduplextreibern, also wenn FDX 1 ist. +DCD 1 wenn der Kanal belegt ist. Darf im Treiber den Sender nicht blockieren, + die Entscheidung ob gesendet werden kann faellt stets im FlexNet-Kern! +FDX Ist eine typabhaengige Konstante. Stets 0 bei Treibern die einen Halb- + duplexkanal bedienen koennen, also die PTT- und DCD-Flags korrekt + ansteuern. Treiber die kein Kanalzugriffstiming benoetigen (z.B. Ethernet, + SLIP, KISS f. reine Rechnerkopplung usw.), liefern hier 1. +TBY Dient nur zur Beschleunigung des Kernels. Wenn 1, wird nichts gesendet. + Kann also z.B. waehrend Calibrate oder bei abgeschaltetem Kanal gesetzt + werden +*/ +/* return different channel states. The following bits are one if true: + 0x40 RxB RxBuffer is not empty + 0x20 PTT Transmitter is keyed on + 0x10 DCD Receiver is active + 0x08 FDX Channel is full duplex, receiver can always receive + 0x04 TBY Transmitter not ready, for example because of ongoing + calibration + +Note: It is essential that these flags are services correctly. Otherwise, +the channel access timing including DAMA master and slave will not work +correctly. + +Explanation of the flags: + +RxB is 1 if valid RX frames are available in the buffer. Inhibits for example + the transmitter in half duplex mode, because all frames should be processed + before transmitting. During receipt this flag should overlap the DCD flag, + i.e. RxB should go to one before DCD transitions to zero! +PTT 1 if the transmitter is already keyed up. In this case, FlexNet assumes + that frames passed are sent during the same transmission. Needs not be + serviced by full duplex drivers (i.e. if FDX is one) +DCD 1 if the channel is busy. Must not inhibit the transmitter in the driver, + since the decision if one should transmit is made by the FlexNet kernel! +FDX is a driver dependent constant. Always 0 for drivers that may service a + half duplex channel, i.e. that serve the PTT and DCD flags correctly. + Drivers that do not need a channel access timing (for example Ethernet, + SLIP, KISS for connecting PCs and so on), should return 1. +TBY Speeds up the kernel. If 1, it will not try to send. May be set to one + for example during calibration or if the channel is switched off. +*/ + +u16 far l1_scale(byte kanal); +/* Baudratenabh„ngigen Faktor liefern, wird fr diverse adaptive Parms + gebraucht, u.a. T2-Steuerung. + + Return: 300 Baud: 2048 + 9600 Baud: 64 + + oder anders ausgedrckt: Return = 614400/[Baudrate] + + Sollte die real moegliche Geschwindigkeit des Kanals liefern. Bei Treibern, + die die in init_kanal() uebergebene Baudrate verwenden, berechnen. Treiber, + die diese nicht verwenden, sollten einen Schaetzwert liefern. Bei sehr + schnellen Kanaelen (z.B. Ethernet) immer 0 liefern! +*/ +/* Return a baud rate dependent factor. Is needed to calculate several adaptive + parameters, for example T2 control + + Return value: 300 baud: 2048 + 9600 baud: 64 + + or as a formula: Return value = 614400/[baud rate] + + Should return the real speed of the channel. Drivers that use the baud rate + specified in init_kanal() should calculate the return value. Drivers that do + not use this parameter should estimate the speed of the channel. Drivers for + very fast channels (for example Ethernet) should always return 0! +*/ + +char far * far l1_ident(byte kanal); +/* Kennung fr Kanalhardware bzw. Treibertyp zurckgeben. + Geliefert wird ein far-pointer auf einen null-terminierten String. + Der String fr die Kanalhardware ist maximal 8 Zeichen lang, + z.B. "SCC0" .. "SCC3", "RS232", "PAR96", "KISS", "IPX", usw. +*/ +/* Return an identifier for the channel hardware or the driver type. + The return value must be a far pointer to a zero terminated string. + The string should be at most 8 characters long. + Examples are "SCC0" .. "SCC3", "RS232", "PAR96", "KISS", "IPX", etc. +*/ + +char far * far l1_version(byte kanal); +/* Versionsnummernstring liefern. Maximal 5 Zeichen +*/ +/* Return a version number string. At most 5 characters. +*/ + +L1_STATISTICS far * far l1_stat(byte kanal, byte delete); +/* Statistikwerte liefern + Delete = 1: Werte auf 0 zuruecksetzen! + Wenn nicht implementiert, Nullpointer liefern! +*/ +/* Return the statistics. + Delete = 1: clear the statistics values! + If not implemented, return a null pointer! +*/ + +void set_led(byte kanal, byte ledcode); +/* Falls der Kanal Status-LEDs hat (z.B. TNC), kommen hier die Zustaende + bei jeder Aenderung an; kann sicherlich meistens Dummy sein: + Bitmasken dazu: */ +/* If the channel hardware has status LEDs (for example a TNC), this procedure + may be used to drive them; in most cases, this procedure may be a dummy. + Bitmasks used: */ +#define LED_CON 2 /* Mindestens 1 Connect - at least one connect */ +#define LED_STA 4 /* Sendeseitig ausstehende Frames - frames in the transmitter buffer */ + +/*---------------------------------------------------------------------------*/ +#ifndef _WIN32 +/* Pointer auf unsigned-Timertic, f. schnellen Zugriff wenn Zeitintervalle + geprueft werden muessen. Inkrementiert alle 100ms mit Phasenjitter */ +/* Pointer to an unsigned timer_tic, for fast access if timing intervals + need to be measured. Increments every 100ms with phase jitter */ +extern const volatile far u16 *timer_tic; + +/* Variable fuer externe Kommunikation zwischen Modulen + Koennen bei Bedarf besetzt werden */ +/* Variables for intermodule communications + May be used if needed */ +extern u16 device_type; /* Bitte vor Vergabe DK7WJ konsultieren! */ + /* Please consult DK7WJ prior to usage! */ +extern u16 device_version; /* Versionskennung - version identifier */ +extern void far *device_vector; /* Beliebiger Vektor, wird zurueckgeliefert */ + /* arbitrary vector returned by device_vec() */ +extern void far (*drv_cb)(void); +typedef struct + { + u16 ds; + u16 es; + u16 cs; + u16 dsize; + u16 esize; + u16 csize; + u16 offset; + u16 irq; + u16 revision; + u16 ioport1; + u16 ioextent1; + u16 ioport2; + u16 ioextent2; + } defint; +extern defint intsegs; + +#define DEFINT_REVISION 1 + +/*---------------------------------------------------------------------------*/ +/* Die folgenden Aufrufe werden durch den Treiberkern bereitgestellt */ +/* The following procedures are supplied by the driver library */ +/*---------------------------------------------------------------------------*/ +/* Einige einfache Ausgaberoutinen, die die Verwendung von printf() ersparen */ +/* Nur waehrend der Initialisierung in init_device() verwenden!! */ +/* Some simple console output routines, that make printf() unnecessary */ +/* May only be used during initialisation, inside init_device()!! */ +void far pch(byte character); +/* Gibt ein Zeichen auf die Konsole aus + Print a character onto the console +*/ +void far pstr(byte near *string); +/* Gibt einen C-String auf die Konsole aus + Print a C string onto the console +*/ +void far pnum(u16 num); +/* Gibt einen numerischen Wert dezimal aus + Print a decimal numerical value onto the console +*/ +void far phex(u16 hex); +/* Gibt einen numerischen Wert hexadezimal aus + Print a hexadecimal numerical value onto the console +*/ +#endif // _WIN32 diff --git a/flexdrv/resource.h b/flexdrv/resource.h new file mode 100644 index 0000000..b612b48 --- /dev/null +++ b/flexdrv/resource.h @@ -0,0 +1,4 @@ +#define IDD_DIALOG1 101 +#define IDC_CONFIG 1000 +#define IDC_MAXCHANNELSSPIN 1001 +#define IDC_MAXCHANNELS 1002 diff --git a/flexdrv/soundmodem.c b/flexdrv/soundmodem.c new file mode 100644 index 0000000..937c6ed --- /dev/null +++ b/flexdrv/soundmodem.c @@ -0,0 +1,1295 @@ +/*****************************************************************************/ + +/* + * soundmodem.c -- FlexNet driver for SoundModem. + * + * Copyright (C) 1999-2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + * History: + * 0.1 23.06.1999 Created + * 0.2 07.01.2000 Expanded to usbdevfs capabilities + * + */ + +/*****************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +#include "flexdrv.h" +#include "resource.h" + +#include "modem.h" +#include "pttio.h" +#include "audioio.h" + +/* ----------------------------------------------------------------------- */ + +/* note: no trailing slash! */ +#define REGISTRYPATH "SOFTWARE\\FlexNet\\SoundModem" +#define REGISTRYKEY HKEY_LOCAL_MACHINE + +#define DRIVER_NAME "SoundModem" +#define DRIVER_VERSION "0.1" + +#define MAXCHANNELS 4 +#define MAXPAR 10 + +#define RXBUFFER_SIZE ((MAXFLEN*6U/5U)+8U) +#define TXBUFFER_SIZE 4096U /* must be a power of 2 and >= MAXFLEN*6/5+8; NOTE: in words */ + +unsigned int log_verblevel; + +static struct state { + volatile unsigned int active; + + unsigned int nrchannels; + char cfgname[64]; + + unsigned int samplerate; + + L1FRAME txframe; + pthread_mutex_t txmutex; + pthread_cond_t txcond; + pthread_t txthread; + unsigned int txrunning; + L1FRAME rxframe; + pthread_mutex_t rxmutex; + pthread_cond_t rxcond; + byte pttstate; + byte txdelay; + byte fulldup; + + HANDLE hdevlife; + + struct modemchannel { + char devname[64]; + unsigned int regchnum; + + unsigned int rxrunning; + pthread_t rxthread; + struct modulator *modch; + struct demodulator *demodch; + void *modstate; + void *demodstate; + + byte dcd; + byte mode; + unsigned int bitrate; + unsigned int scale; + unsigned int calib; + + L1_STATISTICS stat; + + struct { + unsigned rd, wr; + unsigned char buf[TXBUFFER_SIZE]; + } htx; + + struct { + unsigned int bitbuf, bitstream, numbits, state; + unsigned char *bufptr; + int bufcnt; + unsigned char buf[RXBUFFER_SIZE]; + } hrx; + + } chan[MAXCHANNELS]; + struct pttio ptt; + struct audioio *audioio; +} state = { 10, 0, }; + +/* ---------------------------------------------------------------------- */ + + + +/* ---------------------------------------------------------------------- */ + +int lprintf(unsigned vl, const char *format, ...) +{ + va_list ap; + char buf[512]; + int r; + + if (vl > log_verblevel) + return 0; + va_start(ap, format); + r = vsnprintf(buf, sizeof(buf), format, ap); + va_end(ap); + OutputDebugString(buf); + return r; +} + +void logvprintf(unsigned int level, const char *fmt, va_list args) +{ + char buf[512]; + + if (level > log_verblevel) + return; + vsnprintf(buf, sizeof(buf), fmt, args); + OutputDebugString(buf); + if (!level) + exit(1); +} + +void logprintf(unsigned int level, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + logvprintf(level, fmt, args); + va_end(args); +} + +/* ---------------------------------------------------------------------- */ +/* + * the CRC routines are stolen from WAMPES + * by Dieter Deyke + */ + +const u_int16_t crc_ccitt_table[0x100] = { + 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, + 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, + 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, + 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, + 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, + 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, + 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, + 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, + 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, + 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, + 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, + 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, + 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, + 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, + 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, + 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, + 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, + 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, + 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, + 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, + 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, + 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, + 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, + 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, + 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, + 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, + 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, + 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, + 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, + 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, + 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, + 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78 +}; + +/* ---------------------------------------------------------------------- */ + +static inline u_int16_t calc_crc_ccitt(const u_int8_t *buffer, int len) +{ + u_int16_t crc = 0xffff; + + for (;len>0;len--) + crc = (crc >> 8) ^ crc_ccitt_table[(crc ^ *buffer++) & 0xff]; + crc ^= 0xffff; + return crc; +} + +static inline void append_crc_ccitt(u_int8_t *buffer, int len) +{ + u_int16_t crc = calc_crc_ccitt(buffer, len); + buffer[len] = crc; + buffer[len+1] = crc >> 8; +} + +static inline int check_crc_ccitt(const u_int8_t *buffer, int len) +{ + u_int16_t crc = calc_crc_ccitt(buffer, len); + return (crc & 0xffff) == 0x0f47; +} + +/* ---------------------------------------------------------------------- */ + +/* + * high performance HDLC encoder + * yes, it's ugly, but generates pretty good code + */ + +#define ENCODEITERA(j) \ +({ \ + if (!(notbitstream & (0x1f0 << j))) \ + goto stuff##j; \ + encodeend##j: \ +}) + +#define ENCODEITERB(j) \ +({ \ + stuff##j: \ + bitstream &= ~(0x100 << j); \ + bitbuf = (bitbuf & (((2 << j) << numbit) - 1)) | \ + ((bitbuf & ~(((2 << j) << numbit) - 1)) << 1); \ + numbit++; \ + notbitstream = ~bitstream; \ + goto encodeend##j; \ +}) + +static void hdlc_encode(struct modemchannel *chan, unsigned char *pkt, unsigned int len) +{ + unsigned bitstream, notbitstream, bitbuf, numbit; + unsigned wr = chan->htx.wr; + + append_crc_ccitt(pkt, len); + len += 2; + bitstream = 0; + bitbuf = 0x7e; + numbit = 8; /* opening flag */ + while (numbit >= 8) { + chan->htx.buf[wr] = bitbuf; + wr = (wr + 1) % TXBUFFER_SIZE; + if (wr == chan->htx.rd) + *(int *)0 = 0; /* must not happen! */ + bitbuf >>= 8; + numbit -= 8; + } + for (; len > 0; len--, pkt++) { + bitstream >>= 8; + bitstream |= ((unsigned int)*pkt) << 8; + bitbuf |= ((unsigned int)*pkt) << numbit; + notbitstream = ~bitstream; + ENCODEITERA(0); + ENCODEITERA(1); + ENCODEITERA(2); + ENCODEITERA(3); + ENCODEITERA(4); + ENCODEITERA(5); + ENCODEITERA(6); + ENCODEITERA(7); + goto enditer; + ENCODEITERB(0); + ENCODEITERB(1); + ENCODEITERB(2); + ENCODEITERB(3); + ENCODEITERB(4); + ENCODEITERB(5); + ENCODEITERB(6); + ENCODEITERB(7); + enditer: + numbit += 8; + while (numbit >= 8) { + chan->htx.buf[wr] = bitbuf; + wr = (wr + 1) % TXBUFFER_SIZE; + if (wr == chan->htx.rd) + *(int *)0 = 0; /* must not happen! */ + bitbuf >>= 8; + numbit -= 8; + } + } + bitbuf |= 0x7e7e << numbit; + numbit += 16; + while (numbit >= 8) { + chan->htx.buf[wr] = bitbuf; + wr = (wr + 1) % TXBUFFER_SIZE; + if (wr == chan->htx.rd) + *(int *)0 = 0; /* must not happen! */ + bitbuf >>= 8; + numbit -= 8; + } + chan->htx.wr = wr; +} + +/* ---------------------------------------------------------------------- */ + +static void rx_packet(struct modemchannel *chan, const unsigned char *pkt, unsigned int len) +{ + unsigned int kanal; + + for (kanal = 0; kanal < state.nrchannels && chan != &state.chan[kanal]; kanal++); + chan->stat.rx_frames++; + pthread_mutex_lock(&state.rxmutex); + for (;;) { + if (!state.active) { + pthread_mutex_unlock(&state.rxmutex); + pthread_exit(NULL); + } + if (!state.rxframe.len) + break; + pthread_cond_wait(&state.rxcond, &state.rxmutex); + } + memcpy(state.rxframe.frame, pkt, len); + state.rxframe.len = len; + state.rxframe.txdelay = 0; + state.rxframe.kanal = kanal; + pthread_mutex_unlock(&state.rxmutex); + pthread_cond_broadcast(&state.rxcond); +} + +static void do_rxpacket(struct modemchannel *chan) +{ + if (chan->hrx.bufcnt < 3 || chan->hrx.bufcnt > MAXFLEN) + return; + if (!check_crc_ccitt(chan->hrx.buf, chan->hrx.bufcnt)) + return; + rx_packet(chan, chan->hrx.buf, chan->hrx.bufcnt-2); +} + +#define DECODEITERA(j) \ +({ \ + if (!(notbitstream & (0x0fc << j))) /* flag or abort */ \ + goto flgabrt##j; \ + if ((bitstream & (0x1f8 << j)) == (0xf8 << j)) /* stuffed bit */ \ + goto stuff##j; \ + enditer##j: \ +}) + +#define DECODEITERB(j) \ +({ \ + flgabrt##j: \ + if (!(notbitstream & (0x1fc << j))) { /* abort received */ \ + state = 0; \ + goto enditer##j; \ + } \ + if ((bitstream & (0x1fe << j)) != (0x0fc << j)) /* flag received */ \ + goto enditer##j; \ + if (state) \ + do_rxpacket(chan); \ + chan->hrx.bufcnt = 0; \ + chan->hrx.bufptr = chan->hrx.buf; \ + state = 1; \ + numbits = 7-j; \ + goto enditer##j; \ + stuff##j: \ + numbits--; \ + bitbuf = (bitbuf & ((~0xff) << j)) | ((bitbuf & ~((~0xff) << j)) << 1); \ + goto enditer##j; \ +}) + +static inline void hdlc_receive(struct modemchannel *chan, const unsigned char *data, unsigned nrbytes) +{ + unsigned bits, bitbuf, notbitstream, bitstream, numbits, state; + + /* start of HDLC decoder */ + numbits = chan->hrx.numbits; + state = chan->hrx.state; + bitstream = chan->hrx.bitstream; + bitbuf = chan->hrx.bitbuf; + while (nrbytes > 0) { + bits = *data++; + nrbytes--; + bitstream >>= 8; + bitstream |= ((unsigned int)bits) << 8; + bitbuf >>= 8; + bitbuf |= ((unsigned int)bits) << 8; + numbits += 8; + notbitstream = ~bitstream; + DECODEITERA(0); + DECODEITERA(1); + DECODEITERA(2); + DECODEITERA(3); + DECODEITERA(4); + DECODEITERA(5); + DECODEITERA(6); + DECODEITERA(7); + goto enddec; + DECODEITERB(0); + DECODEITERB(1); + DECODEITERB(2); + DECODEITERB(3); + DECODEITERB(4); + DECODEITERB(5); + DECODEITERB(6); + DECODEITERB(7); + enddec: + while (state && numbits >= 8) { + if (chan->hrx.bufcnt >= RXBUFFER_SIZE) { + state = 0; + } else { + *(chan->hrx.bufptr)++ = bitbuf >> (16-numbits); + chan->hrx.bufcnt++; + numbits -= 8; + } + } + } + chan->hrx.numbits = numbits; + chan->hrx.state = state; + chan->hrx.bitstream = bitstream; + chan->hrx.bitbuf = bitbuf; +} + +/* ---------------------------------------------------------------------- */ + +void p3dreceive(struct modemchannel *chan, const unsigned char *pkt, u_int16_t crc) +{ + unsigned char buf[256+16]; + unsigned int i; + + if (crc) + return; + buf[0] = 'Q' << 1; + buf[1] = 'S' << 1; + buf[2] = 'T' << 1; + buf[3] = ' ' << 1; + buf[4] = ' ' << 1; + buf[5] = ' ' << 1; + buf[6] = (0 << 1) | 0x80; + buf[7] = 'A' << 1; + buf[8] = 'O' << 1; + buf[9] = '4' << 1; + buf[10] = '0' << 1; + buf[11] = ' ' << 1; + buf[12] = ' ' << 1; + buf[13] = (1 << 1) | 1; + buf[14] = 0x03; /* UI */ + buf[15] = 0xf0; /* PID */ + memcpy(&buf[16], &pkt[0], 256); + rx_packet(chan, buf, 256+16); + buf[13] = (2 << 1) | 1; + memcpy(&buf[16], &pkt[256], 256); + rx_packet(chan, buf, 256+16); +} + +void p3drxstate(struct modemchannel *chan, unsigned int synced, unsigned int carrierfreq) +{ + pktsetdcd(chan, !!synced); +} + +/* ---------------------------------------------------------------------- */ + +static void countchannels(const char *cfgname, unsigned int maxch) +{ + char name[256]; + HKEY regkey; + LONG err; + DWORD len; + DWORD index = 0; + unsigned int chcnt = 0, tmp; + unsigned int chan[MAXCHANNELS]; + + memset(chan, 0, sizeof(chan)); + if (cfgname && cfgname[0]) { + snprintf(name, sizeof(name), "%s\\%s", REGISTRYPATH, cfgname); + if ((err = RegOpenKeyEx(REGISTRYKEY, name, 0, KEY_READ, ®key)) != ERROR_SUCCESS) { + lprintf(10, "RegOpenKeyEx(%s) returned 0x%lx\n", name, err); + } else { + while (chcnt < MAXCHANNELS && chcnt < maxch) { + len = sizeof(name); + if ((RegEnumKeyEx(regkey, index, name, &len, NULL, NULL, NULL, NULL)) != ERROR_SUCCESS) + break; + lprintf(9, "soundmodem: cfg %s: index %u name %s len %u\n", cfgname, index, name, len); + index++; + if (!len) + continue; + if (name[0] >= '0' && name[0] <= '9') + chan[chcnt++] = strtoul(name, NULL, 0); + } + RegCloseKey(regkey); + } + } + if (!chcnt) + chcnt = 1; + state.nrchannels = chcnt; + /* bubble sort */ + do { + for (len = index = 0; index < chcnt-1; index++) { + if (chan[index] > chan[index+1]) { + tmp = chan[index]; + chan[index] = chan[index+1]; + chan[index+1] = tmp; + len = 1; + } + } + } while (len); + /* do actual store */ + for (index = 0; index < chcnt; index++) + state.chan[index].regchnum = chan[index]; +} + +static int getprop(int ch, const char *typname, const char *propname, char *result, unsigned int reslen) +{ + HKEY key; + DWORD err, vtype, len = reslen; + char name[256]; + + if (!state.cfgname || !state.cfgname[0]) + return -1; + if (ch >= 0 && ch < MAXCHANNELS) + snprintf(name, sizeof(name), "%s\\%s\\%u\\%s", REGISTRYPATH, state.cfgname, state.chan[ch].regchnum, typname); + else + snprintf(name, sizeof(name), "%s\\%s\\%s", REGISTRYPATH, state.cfgname, typname); + result[0] = 0; + if ((err = RegCreateKeyEx(REGISTRYKEY, name, 0, "", REG_OPTION_NON_VOLATILE, KEY_READ, NULL, &key, NULL)) != ERROR_SUCCESS) { + lprintf(10, "RegCreateKeyEx(%s) returned 0x%lx\n", name, err); + return -1; + } + err = RegQueryValueEx(key, propname, NULL, &vtype, result, &len); + RegCloseKey(key); + if (err != ERROR_SUCCESS) { + lprintf(10, "RegQueryValueEx(%s) returned 0x%lx\n", propname, err); + result[0] = 0; + return -1; + } + if (vtype != REG_SZ) { + result[0] = 0; + return -1; + } + if (len >= reslen) + len = reslen-1; + result[len] = 0; + return len; +} + +/* ---------------------------------------------------------------------- */ + +void audiowrite(struct modemchannel *chan, const int16_t *samples, unsigned int nr) +{ + if (!state.audioio->write) + return; + state.audioio->write(state.audioio, samples, nr); +} + +void audioread(struct modemchannel *chan, int16_t *samples, unsigned int nr, u_int16_t tim) +{ + if (!state.audioio->read) { + pthread_exit(NULL); + return; + } + state.audioio->read(state.audioio, samples, nr, tim); +} + +u_int16_t audiocurtime(struct modemchannel *chan) +{ + if (!state.audioio->curtime) + return 0; + return state.audioio->curtime(state.audioio); +} + +/* --------------------------------------------------------------------- */ + +int pktget(struct modemchannel *chan, unsigned char *data, unsigned int len) +{ + unsigned int j, n = len; + + pthread_mutex_lock(&state.txmutex); + if (!state.active) { + pthread_mutex_unlock(&state.txmutex); + state.pttstate = 0; + pttsetptt(&state.ptt, 0); + lprintf(10, "soundmodem: tx terminate (pktget)\n"); + pthread_exit(NULL); + } + if (chan->htx.rd == chan->htx.wr) { + if (!chan->calib) { + pthread_mutex_unlock(&state.txmutex); + return 0; + } + /* check first if anyone else has a real packet to send */ + for (j = 0; j < state.nrchannels; j++) + if (state.chan[j].htx.rd != state.chan[j].htx.wr) { + pthread_mutex_unlock(&state.txmutex); + return 0; + } + /* fill calib */ + if (chan->calib < n) { + n = chan->calib; + chan->calib = 0; + } else + chan->calib -= n; + memset(data, 0, n); + pthread_mutex_unlock(&state.txmutex); + return n; + } + while (n > 0) { + if (chan->htx.wr >= chan->htx.rd) + j = chan->htx.wr - chan->htx.rd; + else + j = TXBUFFER_SIZE - chan->htx.rd; + if (j > n) + j = n; + if (!j) + break; + memcpy(data, &chan->htx.buf[chan->htx.rd], j); + data += j; + n -= j; + chan->htx.rd = (chan->htx.rd + j) % TXBUFFER_SIZE; + } + if (n > 0) + memset(data, 0, n); + pthread_mutex_unlock(&state.txmutex); + return (len - n); +} + +void pktput(struct modemchannel *chan, const unsigned char *data, unsigned int len) +{ + hdlc_receive(chan, data, len); +} + +void pktsetdcd(struct modemchannel *chan, int dcd) +{ + chan->dcd = !!dcd; +} + +/* --------------------------------------------------------------------- */ + +/* search for next channel with something to transmit; prefer channels with real packets over channels calibrating */ +static int searchnextch(int ch) +{ + unsigned int i; + int calibch = -1; + + if (!state.audioio->write) + return -1; + if (ch < 0 || ch >= state.nrchannels) + ch = state.nrchannels-1; + i = ch; + do { + i++; + if (i >= state.nrchannels) + i = 0; + if (!state.chan[i].modch || !state.chan[i].modch->modulate) + continue; + if (state.chan[i].htx.rd != state.chan[i].htx.wr) + return i; + if (state.chan[i].calib > 0 && calibch == -1) + calibch = i; + } while (i != ch); + return calibch; +} + +static void *transmitter(void *dummy) +{ + int curch; + + lprintf(10, "soundmodem: tx start\n"); + state.pttstate = 0; + pttsetptt(&state.ptt, 0); + lprintf(10, "soundmodem: acq mutex\n"); + pthread_mutex_lock(&state.txmutex); + lprintf(10, "soundmodem: have mutex\n"); + for (;;) { + if (!state.active) { + pthread_mutex_unlock(&state.txmutex); + lprintf(10, "soundmodem: tx terminate\n"); + return NULL; + } + curch = searchnextch(-1); + if (curch < 0) { + lprintf(10, "soundmodem: tx wait\n"); + pthread_cond_wait(&state.txcond, &state.txmutex); + lprintf(10, "soundmodem: tx wakeup\n"); + continue; + } + pthread_mutex_unlock(&state.txmutex); + lprintf(10, "soundmodem: tx keying up\n"); + pttsetptt(&state.ptt, 1); + if (state.audioio->transmitstart) + state.audioio->transmitstart(state.audioio); + state.pttstate = CH_PTT; + lprintf(10, "soundmodem: tx channel %u (txdelay)\n", curch); + state.chan[curch].modch->modulate(state.chan[curch].modstate, state.txdelay * 10); + while (state.active) { + pthread_mutex_lock(&state.txmutex); + if (!state.active) + break; + curch = searchnextch(curch); + if (curch < 0) + break; + pthread_mutex_unlock(&state.txmutex); + lprintf(10, "soundmodem: tx channel %u\n", curch); + state.chan[curch].modch->modulate(state.chan[curch].modstate, 0); + } + pthread_mutex_unlock(&state.txmutex); + if (state.audioio->transmitstop) + state.audioio->transmitstop(state.audioio); + state.pttstate = 0; + pttsetptt(&state.ptt, 0); + pthread_mutex_lock(&state.txmutex); + lprintf(10, "soundmodem: tx switching off\n"); + } +} + +static void *receiver(void *__chan) +{ + struct modemchannel *chan = __chan; + + chan->demodch->demodulate(chan->demodstate); + return NULL; +} + +/* --------------------------------------------------------------------- */ + +static void start(void) +{ + struct modulator *modch; + struct demodulator *demodch; + char params[MAXPAR][64]; + const char *parptr[MAXPAR]; + const struct modemparams *par; + struct modemchannel *chan; + char buf[128]; + unsigned int i, j, mode = 0; + unsigned int samplerate = 5000; /* minimum sampling rate */ + + if (state.active) + return; + lprintf(5, "soundmodem: start\n"); + pthread_mutex_init(&state.rxmutex, NULL); + pthread_cond_init(&state.rxcond, NULL); + state.rxframe.len = 0; + pthread_mutex_init(&state.txmutex, NULL); + pthread_cond_init(&state.txcond, NULL); + /* initialize txdelay and fullduplex */ + state.txdelay = 10; + state.fulldup = 0; + if (getprop(-1, "chaccess", "fulldup", params[0], sizeof(params[0])) >= 1 && params[0][0] == '1') + state.fulldup = 1; + if (getprop(-1, "chaccess", "txdelay", params[0], sizeof(params[0])) >= 1) + state.txdelay = strtoul(params[0], NULL, 0) / 10; + /* initialize channel variables */ + for (i = 0; i < state.nrchannels; i++) { + chan = &state.chan[i]; + chan->dcd = 0; + chan->calib = 0; + } + for (i = 0; i < state.nrchannels; i++) { + state.chan[i].modch = NULL; + if (getprop(i, "mod", "mode", buf, sizeof(buf)) < 1) + continue; + for (modch = &afskmodulator; modch && strcmp(modch->name, buf); modch = modch->next); + state.chan[i].modch = modch; + } + for (i = 0; i < state.nrchannels; i++) { + state.chan[i].demodch = NULL; + if (getprop(i, "demod", "mode", buf, sizeof(buf)) < 1) + continue; + for (demodch = &afskdemodulator; demodch && strcmp(demodch->name, buf); demodch = demodch->next); + state.chan[i].demodch = demodch; + } + /* configure modems */ + for (i = 0; i < state.nrchannels; i++) { + chan = &state.chan[i]; + lprintf(5, "Channel: %u Modulator %s Demodulator %s\n", i, + (chan->modch && chan->modch->name) ? chan->modch->name : "-", + (chan->demodch && chan->demodch->name) ? chan->demodch->name : "-"); + /* modulator */ + if (chan->modch && chan->modch->config) { + memset(parptr, 0, sizeof(parptr)); + if ((par = chan->modch->params)) + for (j = 0; j < MAXPAR && par->name; j++, par++) { + if (getprop(i, "mod", par->name, params[j], sizeof(params[j])) < 1) + params[j][0] = 0; + else + parptr[j] = params[j]; + lprintf(6, "Modulator Parameter %s: %s\n", par->name, params[j]); + } + j = samplerate; + chan->modstate = chan->modch->config(chan, &j, parptr); + if (j > samplerate) + samplerate = j; + if (chan->modch->modulate) + mode |= IO_WRONLY; + } + /* demodulator */ + if (chan->demodch && chan->demodch->config) { + memset(parptr, 0, sizeof(parptr)); + if ((par = chan->demodch->params)) + for (j = 0; j < MAXPAR && par->name; j++, par++) { + if (getprop(i, "demod", par->name, params[j], sizeof(params[j])) < 1) + params[j][0] = 0; + else + parptr[j] = params[j]; + lprintf(6, "Demodulator Parameter %s: %s\n", par->name, params[j]); + } + j = samplerate; + chan->demodstate = chan->demodch->config(chan, &j, parptr); + if (j > samplerate) + samplerate = j; + if (chan->demodch->demodulate) + mode |= IO_RDONLY; + } + snprintf(chan->devname, sizeof(chan->devname), "SoundModem (%s,%s)", + (chan->modch && chan->modch->name) ? chan->modch->name : "-", + (chan->demodch && chan->demodch->name) ? chan->demodch->name : "-"); + } + lprintf(5, "Minimum Samplingrate: %u\n", samplerate); + /* start audio */ + memset(parptr, 0, sizeof(parptr)); + par = ioparams_soundcard; + for (j = 0; j < MAXPAR && par->name; j++, par++) { + if (getprop(-1, "audio", par->name, params[j], sizeof(params[j])) < 1) + params[j][0] = 0; + else + parptr[j] = params[j]; + lprintf(6, "Audio Parameter %s: %s\n", par->name, params[j]); + } + if (!(state.audioio = ioopen_soundcard(&samplerate, mode, parptr))) { + lprintf(3, "Cannot start DirectX IO\n"); + goto err; + } + /* start modems */ + lprintf(5, "Real Samplingrate: %u\n", samplerate); + for (i = 0; i < state.nrchannels; i++) { + chan = &state.chan[i]; + if (chan->modch && chan->modch->init) + chan->modch->init(chan->modstate, samplerate); + chan->bitrate = 0; + if (chan->demodch && chan->demodch->init) + chan->demodch->init(chan->demodstate, samplerate, &chan->bitrate); + if (chan->bitrate) + chan->scale = 614400/chan->bitrate; + else + chan->scale = 0; + } + /* start PTT */ + memset(parptr, 0, sizeof(parptr)); + par = pttparams; + for (j = 0; j < MAXPAR && par->name; j++, par++) { + if (getprop(-1, "ptt", par->name, params[j], sizeof(params[j])) < 1) + params[j][0] = 0; + else + parptr[j] = params[j]; + lprintf(6, "PTT Parameter %s: %s\n", par->name, params[j]); + } + if (pttinit(&state.ptt, parptr)) + lprintf(1, "cannot start PTT output\n"); + /* start receiver threads */ + for (i = 0; i < state.nrchannels; i++) { + chan = &state.chan[i]; + chan->rxrunning = 0; + if (!chan->demodch || !chan->demodch->demodulate) + continue; + if (pthread_create(&chan->rxthread, NULL, receiver, chan)) { + lprintf(1, "Cannot start receiver thread\n"); + continue; + } + chan->rxrunning = 1; + } + if (pthread_create(&state.txthread, NULL, transmitter, NULL)) + lprintf(1, "Cannot start receiver thread\n"); + else + state.txrunning = 1; + state.active = 1; + SetEvent(state.hdevlife); + lprintf(5, "soundmodem: running\n"); + return; + + err: + for (i = 0; i < state.nrchannels; i++) { + chan = &state.chan[i]; + if (chan->modch && chan->modch->free) + chan->modch->free(chan->modstate); + if (chan->demodch && chan->demodch->free) + chan->demodch->free(chan->demodstate); + } +} + +static void stop(void) +{ + struct modemchannel *chan; + unsigned int i; + + if (!state.active) + return; + lprintf(5, "soundmodem: stop\n"); + state.active = 0; + if (state.audioio->terminateread) + state.audioio->terminateread(state.audioio); + pthread_cond_broadcast(&state.txcond); + pthread_cond_broadcast(&state.rxcond); + if (state.txrunning) { + lprintf(9, "Joining TX Thread\n"); + pthread_join(state.txthread, NULL); + state.txrunning = 0; + } + for (i = 0; i < state.nrchannels; i++) { + chan = &state.chan[i]; + if (!chan->rxrunning) + continue; + lprintf(9, "Joining RX Thread %u\n", i); + pthread_join(chan->rxthread, NULL); + chan->rxrunning = 0; + } + for (i = 0; i < state.nrchannels; i++) { + chan = &state.chan[i]; + if (chan->modch && chan->modch->free) + chan->modch->free(chan->modstate); + if (chan->demodch && chan->demodch->free) + chan->demodch->free(chan->demodstate); + } + if (state.audioio) + state.audioio->release(state.audioio); + pttsetptt(&state.ptt, 0); + pttrelease(&state.ptt); + SetEvent(state.hdevlife); +} + +/* --------------------------------------------------------------------- */ + +/* + * Treiber-Init. Sofern mehrfach aufgerufen, kommt vorher jeweils l1_exit() + * Hier also alle Ressourcen allokieren, aber noch nicht starten sofern + * dazu die Parameter gebraucht werden. Die kommen spaeter per l1_init_kanal() + */ + +int init_device(HKEY hKey) +{ + DWORD regtype, reglen, regval; + struct modemchannel *chan; + unsigned int i; + + afskmodulator.next = &fskmodulator; + afskdemodulator.next = &fskdemodulator; + fskmodulator.next = &pammodulator; + fskdemodulator.next = &fskpspdemodulator; + fskpspdemodulator.next = &pamdemodulator; + pammodulator.next = &pskmodulator; + pamdemodulator.next = &pskdemodulator; + pskmodulator.next = &newqpskmodulator; + pskdemodulator.next = &newqpskdemodulator; + newqpskdemodulator.next= &p3ddemodulator; + pthread_mutex_init(&state.rxmutex, NULL); + pthread_cond_init(&state.rxcond, NULL); + state.rxframe.len = 0; + pthread_mutex_init(&state.txmutex, NULL); + pthread_cond_init(&state.txcond, NULL); + reglen = sizeof(regval); + if (RegQueryValueEx(hKey, "VerboseLevel", NULL, ®type, (void *)®val, ®len) != ERROR_SUCCESS || regtype != REG_DWORD) + regval = 10; + log_verblevel = regval; + reglen = sizeof(state.cfgname); + if (RegQueryValueEx(hKey, "ConfigName", NULL, ®type, state.cfgname, ®len) != ERROR_SUCCESS || regtype != REG_SZ) + state.cfgname[0] = 0; + state.cfgname[sizeof(state.cfgname)-1] = 0; + reglen = sizeof(regval); + if (RegQueryValueEx(hKey, "NrChannels", NULL, ®type, (void *)®val, ®len) != ERROR_SUCCESS || regtype != REG_DWORD) + regval = 15; + if (regval < 1) + regval = 1; + countchannels(state.cfgname, regval); + state.active = 0; + ioinit_soundcard(); + state.hdevlife = CreateEvent(NULL, FALSE, FALSE, "FlexNet Device State"); + /* initialize channel variables */ + for (i = 0; i < state.nrchannels; i++) { + chan = &state.chan[i]; + chan->mode = MODE_off; + } + lprintf(5, "soundmodem: init_device: vl %u CfgName %s\n", log_verblevel, state.cfgname); + return 1; +} + +/* ------------------------------------------------------------------------- */ + +void l1_exit(HKEY hKey) +{ + DWORD vl = log_verblevel, nrchan = state.nrchannels; + + stop(); + RegSetValueEx(hKey, "ConfigName", 0, REG_SZ, state.cfgname, strlen(state.cfgname)+1); + RegSetValueEx(hKey, "VerboseLevel", 0, REG_DWORD, (void *)&vl, sizeof(vl)); + RegSetValueEx(hKey, "NrChannels", 0, REG_DWORD, (void *)&nrchan, sizeof(nrchan)); + CloseHandle(state.hdevlife); + lprintf(5, "soundmodem: l1_exit: vl %u CfgName %s\n", log_verblevel, state.cfgname); +} + +/* ------------------------------------------------------------------------- */ + +byte *config_info(byte kanal) +{ + if (kanal >= state.nrchannels) + return "invalid channel"; + return state.chan[kanal].devname; +} + +/* ------------------------------------------------------------------------- */ + +static BOOL CALLBACK EdParmDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + HWND hcombo; + HKEY regkey; + LONG err; + DWORD index; + DWORD len; + char buf[32]; + unsigned int restart, i; + int cursel; + + switch (uMsg) { + case WM_INITDIALOG: + hcombo = GetDlgItem(hDlg, IDC_CONFIG); + err = RegOpenKeyEx(REGISTRYKEY, REGISTRYPATH, 0, KEY_READ, ®key); + if (err == ERROR_SUCCESS) { + cursel = -1; + for (i = index = 0;; index++) { + len = sizeof(buf); + if ((RegEnumKeyEx(regkey, index, buf, &len, NULL, NULL, NULL, NULL)) != ERROR_SUCCESS) + break; + SendMessage(hcombo, CB_ADDSTRING, 0, (LPARAM)buf); + if (!strcmp(buf, state.cfgname)) + cursel = i; + i++; + } + ComboBox_SetCurSel(hcombo, cursel); + RegCloseKey(regkey); + } + SetWindowText(hDlg, DRIVER_NAME" Configuration"); + break; + + case WM_COMMAND: + switch (GET_WM_COMMAND_ID(wParam, lParam)) { + case IDCANCEL: + EndDialog(hDlg, 0); + break; + + case IDOK: + GetDlgItemText(hDlg, IDC_CONFIG, buf, sizeof(buf)); + restart = strcmp(buf, state.cfgname); + strncpy(state.cfgname, buf, sizeof(state.cfgname)); + EndDialog(hDlg, restart); + break; + + default: + break; + } + break; + + default: + return FALSE; + } + return TRUE; +} + +/* ------------------------------------------------------------------------- */ + +int config_device(byte max_channels, HWND hDlg, byte channel) +{ + int restart; + + restart = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DIALOG1), hDlg, EdParmDlgProc, 0); + if (restart) + countchannels(state.cfgname, max_channels); + return restart; +} + +/* ------------------------------------------------------------------------- */ + +u16 l1_get_ch_cnt(void) +{ + return state.nrchannels; +} + +/* ------------------------------------------------------------------------- */ + +byte get_txdelay(byte kanal) +{ + return state.txdelay; +} + +void set_txdelay(byte kanal, byte delay) +{ +} + +u16 get_mode(byte kanal) +{ + if (kanal >= state.nrchannels) + return 0; + return (state.chan[kanal].mode & ~(MODE_d|MODE_off)) | (state.fulldup ? MODE_d : 0); +} + +u16 get_baud(byte kanal) +{ + if (kanal >= state.nrchannels) + return 0; + return state.chan[kanal].bitrate / 100; +} + +/* ------------------------------------------------------------------------- */ + +byte l1_init_kanal(byte kanal, u16 chbaud, u16 chmode) +{ + unsigned int i, j; + + lprintf(5, "l1_init_kanal(%u,%u,0x%x)\n", kanal, chbaud, chmode); + if (kanal >= state.nrchannels) + return 0; + if (chmode & MODE_off) + state.chan[kanal].mode |= MODE_off; + else + state.chan[kanal].mode = chmode; + j = MODE_off; + for (i = 0; i < state.nrchannels; i++) + j &= state.chan[i].mode; + if (j & MODE_off) + stop(); + else + start(); + return state.active; +} + +/* ------------------------------------------------------------------------- */ + +byte l1_ch_active(byte kanal) +{ + if (kanal >= state.nrchannels) + return 0; + return state.active; +} + +/* ------------------------------------------------------------------------- */ + +char far *l1_ident(byte kanal) +{ + return DRIVER_NAME; +} + +/* ------------------------------------------------------------------------- */ + +char far *l1_version(byte kanal) +{ + return DRIVER_VERSION; +} + +/* ------------------------------------------------------------------------- */ + +L1_STATISTICS far *l1_stat(byte kanal, byte delete) +{ + L1_STATISTICS *p; + + if (kanal >= state.nrchannels) + return NULL; + p = &state.chan[kanal].stat; + if (delete) + p->tx_error = p->rx_overrun = p->rx_bufferoverflow = + p->tx_frames = p->rx_frames = p->io_error = 0; + return p; +} + +/* ------------------------------------------------------------------------- */ + +void set_led(byte kanal, byte ledcode) +{ +#if 0 + if (state.active) + pkt_setled(state.pkt, ledcode); +#endif +} + +/* ------------------------------------------------------------------------- */ + +byte l1_ch_state(byte kanal) +{ + unsigned int i; + byte st = state.pttstate; + + if (kanal >= state.nrchannels) + return CH_DEAD; + if (!state.active || !state.txrunning) + return CH_DEAD; + for (i = 0; i < state.nrchannels; i++) + if (state.chan[i].dcd) { + st |= CH_DCD; + break; + } + if (state.rxframe.len) + st |= CH_RXB; + return st; +} + +/* ------------------------------------------------------------------------- */ + +u16 l1_scale(byte kanal) +{ + if (kanal >= state.nrchannels) + return 0; + return state.chan[kanal].scale; +} + +/* ------------------------------------------------------------------------- */ + +void l1_tx_calib(byte kanal, byte minutes) +{ + if (kanal >= state.nrchannels || !state.active) + return; + state.chan[kanal].calib = minutes * state.chan[kanal].bitrate * 60 / 8; +} + +/* ------------------------------------------------------------------------- */ + +L1FRAME far *l1_get_framebuf(byte kanal) +{ + return &state.txframe; +} + +byte l1_tx_frame(void) +{ + struct modemchannel *chan; + unsigned int i; + + if (state.txframe.kanal >= state.nrchannels || !state.active) + return 1; + chan = &state.chan[state.txframe.kanal]; + if (!chan->modch || !chan->modch->modulate) + return 1; + pthread_mutex_lock(&state.txmutex); + i = (TXBUFFER_SIZE - 1 + chan->htx.rd - chan->htx.wr) % TXBUFFER_SIZE; + if (i < state.txframe.len*6/5+32) { + pthread_mutex_unlock(&state.txmutex); + return 0; + } + hdlc_encode(chan, state.txframe.frame, state.txframe.len); + pthread_mutex_unlock(&state.txmutex); + pthread_cond_broadcast(&state.txcond); + chan->stat.tx_frames++; + return 1; +} + +/* ------------------------------------------------------------------------- */ + +/* + * RX-Thread. Wartet auf RX-Bytes, verarbeitet sie und returned wenn + * Handle zu oder Paket komplett + */ + +L1FRAME far *l1_rx_frame(void) +{ + pthread_mutex_lock(&state.rxmutex); + if (!state.active) { + pthread_mutex_unlock(&state.rxmutex); + return NULL; + } + for (;;) { + state.rxframe.len = 0; + pthread_cond_broadcast(&state.rxcond); + pthread_cond_wait(&state.rxcond, &state.rxmutex); + if (!state.active) { + pthread_mutex_unlock(&state.rxmutex); + return NULL; + } + if (state.rxframe.len) { + pthread_mutex_unlock(&state.rxmutex); + return &state.rxframe; + } + } +} + +/* ------------------------------------------------------------------------- */ diff --git a/flexdrv/soundmodem.rc b/flexdrv/soundmodem.rc new file mode 100644 index 0000000..a8abde0 --- /dev/null +++ b/flexdrv/soundmodem.rc @@ -0,0 +1,58 @@ +#include "resource.h" + +#include "windows.h" + +#define IDC_STATIC -1 + +IDD_DIALOG1 DIALOGEX 0, 0, 232, 70 +STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Dialog" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,175,12,50,14 + PUSHBUTTON "Cancel",IDCANCEL,175,37,50,14 + RTEXT "Configuration",IDC_STATIC,15,16,55,8,0,WS_EX_RIGHT + COMBOBOX IDC_CONFIG,73,13,50,145,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + CONTROL "Author: Thomas Sailer, HB9JNX/AE4WA",IDC_STATIC,"Static", + SS_LEFTNOWORDWRAP | WS_GROUP,3,60,130,8 +END + + +LANGUAGE LANG_GERMAN, SUBLANG_GERMAN + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x0L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "080704b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "HB9JNX\0" + VALUE "FileDescription", "SoundModem\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "SoundModem FlexNet driver\0" + VALUE "LegalCopyright", "Copyright © 1999-2000\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "soundmodem.dll\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "SoundModem\0" + VALUE "ProductVersion", "1.00a\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/fsk/Makefile.am b/fsk/Makefile.am new file mode 100644 index 0000000..339a20f --- /dev/null +++ b/fsk/Makefile.am @@ -0,0 +1,25 @@ +INCLUDES = -I$(top_srcdir)/soundcard -I$(top_srcdir)/matlib -I$(top_srcdir)/libmisc -I. + + +noinst_LIBRARIES = libfsk.a +libfsk_a_SOURCES = fskic.c fskic.h modem.c modempsp.c psp.h modemeq.c + +genpsptbl_SOURCES = genpsptbl.c +genpsptbl_LDADD = ../matlib/libmat.a + +gendf9icfilt_SOURCES = gendf9icfilt.cc +gendf9icfilt_LDADD = ../matlib/libmat.a ../libmisc/libmisc.a + +if CROSSCOMP + +else + +noinst_PROGRAMS = genpsptbl gendf9icfilt + +$(srcdir)/psp.h: genpsptbl$(EXEEXT) + ./genpsptbl$(EXEEXT) > $@ + +$(srcdir)/fskic.h: gendf9icfilt$(EXEEXT) + ./gendf9icfilt$(EXEEXT) > $@ + +endif diff --git a/fsk/Makefile.in b/fsk/Makefile.in new file mode 100644 index 0000000..9c60dbd --- /dev/null +++ b/fsk/Makefile.in @@ -0,0 +1,542 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +@CROSSCOMP_FALSE@noinst_PROGRAMS = genpsptbl$(EXEEXT) \ +@CROSSCOMP_FALSE@ gendf9icfilt$(EXEEXT) +subdir = fsk +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +libfsk_a_AR = $(AR) $(ARFLAGS) +libfsk_a_LIBADD = +am_libfsk_a_OBJECTS = fskic.$(OBJEXT) modem.$(OBJEXT) \ + modempsp.$(OBJEXT) modemeq.$(OBJEXT) +libfsk_a_OBJECTS = $(am_libfsk_a_OBJECTS) +PROGRAMS = $(noinst_PROGRAMS) +am_gendf9icfilt_OBJECTS = gendf9icfilt.$(OBJEXT) +gendf9icfilt_OBJECTS = $(am_gendf9icfilt_OBJECTS) +gendf9icfilt_DEPENDENCIES = ../matlib/libmat.a ../libmisc/libmisc.a +am_genpsptbl_OBJECTS = genpsptbl.$(OBJEXT) +genpsptbl_OBJECTS = $(am_genpsptbl_OBJECTS) +genpsptbl_DEPENDENCIES = ../matlib/libmat.a +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +SOURCES = $(libfsk_a_SOURCES) $(gendf9icfilt_SOURCES) \ + $(genpsptbl_SOURCES) +DIST_SOURCES = $(libfsk_a_SOURCES) $(gendf9icfilt_SOURCES) \ + $(genpsptbl_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUDIOFILE_CFLAGS = @AUDIOFILE_CFLAGS@ +AUDIOFILE_LIBS = @AUDIOFILE_LIBS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +HAVE_ALSA = @HAVE_ALSA@ +HAVE_BITTYPES = @HAVE_BITTYPES@ +HAVE_DIRECTX = @HAVE_DIRECTX@ +HAVE_IFRNEWNAME = @HAVE_IFRNEWNAME@ +HAVE_MKISS = @HAVE_MKISS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTHREAD = @LIBTHREAD@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +M_PI = @M_PI@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USEMMX = @USEMMX@ +USEVIS = @USEVIS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WIN32 = @WIN32@ +WINDRES = @WINDRES@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CFLAGS = @XML_CFLAGS@ +XML_LIBS = @XML_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +INCLUDES = -I$(top_srcdir)/soundcard -I$(top_srcdir)/matlib -I$(top_srcdir)/libmisc -I. +noinst_LIBRARIES = libfsk.a +libfsk_a_SOURCES = fskic.c fskic.h modem.c modempsp.c psp.h modemeq.c +genpsptbl_SOURCES = genpsptbl.c +genpsptbl_LDADD = ../matlib/libmat.a +gendf9icfilt_SOURCES = gendf9icfilt.cc +gendf9icfilt_LDADD = ../matlib/libmat.a ../libmisc/libmisc.a +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .cc .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu fsk/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu fsk/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libfsk.a: $(libfsk_a_OBJECTS) $(libfsk_a_DEPENDENCIES) + -rm -f libfsk.a + $(libfsk_a_AR) libfsk.a $(libfsk_a_OBJECTS) $(libfsk_a_LIBADD) + $(RANLIB) libfsk.a + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) +gendf9icfilt$(EXEEXT): $(gendf9icfilt_OBJECTS) $(gendf9icfilt_DEPENDENCIES) + @rm -f gendf9icfilt$(EXEEXT) + $(CXXLINK) $(gendf9icfilt_OBJECTS) $(gendf9icfilt_LDADD) $(LIBS) +genpsptbl$(EXEEXT): $(genpsptbl_OBJECTS) $(genpsptbl_DEPENDENCIES) + @rm -f genpsptbl$(EXEEXT) + $(LINK) $(genpsptbl_OBJECTS) $(genpsptbl_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fskic.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gendf9icfilt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genpsptbl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modem.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modemeq.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modempsp.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.cc.o: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) $(PROGRAMS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES clean-noinstPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am + + +@CROSSCOMP_FALSE@$(srcdir)/psp.h: genpsptbl$(EXEEXT) +@CROSSCOMP_FALSE@ ./genpsptbl$(EXEEXT) > $@ + +@CROSSCOMP_FALSE@$(srcdir)/fskic.h: gendf9icfilt$(EXEEXT) +@CROSSCOMP_FALSE@ ./gendf9icfilt$(EXEEXT) > $@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/fsk/fskic.c b/fsk/fskic.c new file mode 100644 index 0000000..ab1183e --- /dev/null +++ b/fsk/fskic.c @@ -0,0 +1,56 @@ +/*****************************************************************************/ + +/* + * fskic.c -- DF9IC FSK Modem filter curves. + * + * Copyright (C) 2003 + * Thomas Sailer (t.sailer@alumni.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + */ + +/*****************************************************************************/ + +#include "modem.h" +#include "raisedcosine.h" +#include "fskic.h" + +/* --------------------------------------------------------------------- */ + +double df9ic_rxfilter(double t) +{ + unsigned int i; + double sum = 0; + + t *= FSKIC_RXOVER; + t += 0.5 * sizeof(fskic_rxpulse) / sizeof(fskic_rxpulse[0]); + for (i = 0; i < sizeof(fskic_rxpulse) / sizeof(fskic_rxpulse[0]); i++) + sum += fskic_rxpulse[i] * sinc(i - t); + return sum; +} + +double df9ic_txfilter(double t) +{ + unsigned int i; + double sum = 0; + + t *= FSKIC_TXOVER; + t += 0.5 * sizeof(fskic_txpulse) / sizeof(fskic_txpulse[0]); + for (i = 0; i < sizeof(fskic_txpulse) / sizeof(fskic_txpulse[0]); i++) + sum += fskic_txpulse[i] * sinc(i - t); + return sum; +} diff --git a/fsk/fskic.h b/fsk/fskic.h new file mode 100644 index 0000000..3fa3fdd --- /dev/null +++ b/fsk/fskic.h @@ -0,0 +1,48 @@ +/* this file is automatically generated, do not edit!! */ + +#define FSKIC_RXOVER 16 + +static float fskic_rxpulse[64] = { + 0.000890478, 0.0974088, 0.332671, 0.621645, + 0.916502, 1.17425, 1.37626, 1.50776, + 1.56942, 1.56285, 1.49889, 1.38671, + 1.24045, 1.07079, 0.890749, 0.709024, + 0.535291, 0.374779, 0.233216, 0.112303, + 0.0142867, -0.061933, -0.116605, -0.152585, + -0.17152, -0.177011, -0.171155, -0.157503, + -0.137937, -0.115461, -0.0913712, -0.0679072, + -0.0456628, -0.0261097, -0.00920401, 0.0042194, + 0.0146807, 0.0217903, 0.0263536, 0.0282322, + 0.028343, 0.026639, 0.0240178, 0.0204135, + 0.0166248, 0.012507, 0.00872616, 0.00504081, + 0.00198556, -0.000767996, -0.00279431, -0.00448333, + -0.00548732, -0.00622814, -0.00640473, -0.00644437, + -0.00606727, -0.00568666, -0.00502671, -0.0044752, + -0.00375098, -0.00321219, -0.0025696, -0.00215283 +}; + +#define FSKIC_TXOVER 8 + +static float fskic_txpulse[96] = { + -8.89964e-05, 5.0355e-05, 0.000234463, 0.000420846, + 0.000557468, 0.000596838, 0.000509613, 0.000296303, + -1.30278e-05, -0.0003514, -0.000651903, -0.000824791, + -0.000841548, -0.000668018, -0.000363734, -7.03831e-06, + 0.000346464, 0.000444599, 0.00046553, 0.000119019, + -0.000277057, -0.00075427, -0.00101198, -0.000925374, + -0.000310504, 0.000817119, 0.00239079, 0.00406327, + 0.00551389, 0.00617868, 0.0057039, 0.00374024, + 0.000299999, -0.00436966, -0.00953453, -0.014307, + -0.0174382, -0.0177176, -0.0140972, -0.00583524, + 0.00715598, 0.0245933, 0.0448985, 0.0672416, + 0.0881474, 0.107226, 0.120641, 0.128038, + 0.128276, 0.120497, 0.106941, 0.0872594, + 0.0652762, 0.0417601, 0.019935, 0.00120331, + -0.0129246, -0.021837, -0.0254833, -0.0246909, + -0.0203538, -0.0140835, -0.00705189, -0.00062926, + 0.00442428, 0.00753531, 0.00872837, 0.00818526, + 0.00646528, 0.00412531, 0.00174425, -0.000228692, + -0.00155499, -0.00212582, -0.00208806, -0.00156349, + -0.000932976, -0.000208682, 0.000149419, 0.000401453 +}; + diff --git a/fsk/gendf9icfilt.cc b/fsk/gendf9icfilt.cc new file mode 100644 index 0000000..957703c --- /dev/null +++ b/fsk/gendf9icfilt.cc @@ -0,0 +1,316 @@ +/*****************************************************************************/ + +/* + * gendf9icfilt.cc -- Compute DF9IC Hardware Modem Filter Curves. + * + * Copyright (C) 2003 + * Thomas Sailer (t.sailer@alumni.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +/*****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +#include "fft.hh" +#include "mat.hh" +#include "raisedcosine.h" + +#include "getopt.h" + +/* --------------------------------------------------------------------- */ + +template complex rxfilter(T freq) +{ + complex g1(T(1)/100e3,0); + complex g2(T(1)/82e3,0); + complex g3(T(1)/39e3,0); + complex g4(T(1)/27e3,0); + freq *= 2 * M_PI * 9600; + complex y1(0,freq*470e-9); + complex y2(0,freq*1e-9); + complex y3(0,freq*220e-12); + complex y4(0,freq*1e-9); + + return y1 * g2 * g3 * g4 / + (((g3 + y3) * g2 * (y1 + g1) + y3 * (y2 + g3) * (y1 + g1 + g2)) * (g4 + y4)); +} + +template complex txfilter(T freq) +{ + complex g1(T(1)/100,0); + complex g2(T(1)/10e3,0); + complex g3(T(1)/100e3,0); + complex g4(T(1)/100e3,0); + complex g5(T(1)/56e3,0); + complex g6(T(1)/8.2e3,0); + complex g7(T(1)/12e3,0); + freq *= 2 * M_PI * 9600; + complex y1(0,freq*3.3e-9); + complex y2(0,freq*470e-12); + complex y3(0,freq*100e-12); + complex y4(0,freq*1e-9); + + return g1 * g4 * g5 * g6 / + (((g1 + g2 + g3 + y1) * (g5 + y3) * g4 + + (g1 + g2 + g3 + y1 + g4) * y3 * (y2 + g5)) * (y4 + g7)); +} + +/* ---------------------------------------------------------------------- */ + +static void printtransferfunc(ostream& os, unsigned int nr, double over) +{ + over /= nr; + os << "# name: rxf\n" + "# type: complex matrix\n" + "# rows: " << nr << "\n" + "# columns: 1\n"; + for (unsigned int i = 0; i < nr; i++) { + complex tf = rxfilter(i * over); + os << "(" << tf.real() << "," << tf.imag() << ")\n"; + } + os << "# name: txf\n" + "# type: complex matrix\n" + "# rows: " << nr << "\n" + "# columns: 1\n"; + for (unsigned int i = 0; i < nr; i++) { + complex tf = txfilter(i * over); + os << "(" << tf.real() << "," << tf.imag() << ")\n"; + } + os.flush(); +} + +/* ---------------------------------------------------------------------- */ + +template static void matprintf(ostream& os, const char *name, + unsigned int size1, unsigned int stride1, + unsigned int size2, unsigned int stride2, const T *m) +{ + os << "# name: " << name << "\n# type: matrix\n# rows: " << size1 << "\n# columns: " << size2 << "\n"; + for (unsigned int i = 0; i < size1; i++) { + for (unsigned int j = 0; j < size2; j++) + os << " " << m[i*stride1 + j*stride2]; + os << "\n"; + } +} + +/* ---------------------------------------------------------------------- */ + +static double comptx(ostream& os, double *filt, const double *pulse, unsigned int filtlen, unsigned int pulselen, + unsigned int over, unsigned int odiv, double shift, unsigned int oct) +{ + unsigned int rlen = 2 * filtlen + pulselen; + double C[rlen * filtlen]; + double CT[rlen * filtlen]; + double CTC[filtlen * filtlen]; + double CTr[filtlen]; + double Cf[rlen]; + double r[rlen]; + double e, e1; + double rcosalpha = 3.0 / 8; + int pidx; + unsigned int i, j; + + for (i = 0; i < rlen; i++) { + pidx = i - 2 * filtlen + 1; + if (pidx >= (signed int)pulselen) { + rlen = i; + break; + } + for (j = 0; j < filtlen; j++, pidx += odiv) { + if (pidx < 0 || pidx >= (int)pulselen) + C[i*filtlen+j] = 0; + else + C[i*filtlen+j] = pulse[pidx]; + } + } + for (i = 0; i < rlen; i++) + r[i] = raised_cosine_time((i - 0.5 * (rlen-1)) / (double)over + shift, rcosalpha); + if (oct) { + matprintf(os, "C", rlen, filtlen, filtlen, 1, C); + matprintf(os, "r", rlen, 1, 1, 1, r); + } + mtranspose(CT, C, rlen, filtlen); + mmul(CTC, CT, C, filtlen, rlen, filtlen); + mmul(CTr, CT, r, filtlen, rlen, 1); + mchol(CTC, CTr, filt, filtlen); + if (oct) + matprintf(os, "filt", filtlen, 1, 1, 1, filt); + mmul(Cf, C, filt, rlen, filtlen, 1); + for (i = 0, e = 0; i < rlen; i++) { + e1 = Cf[i] - r[i]; + e += e1 * e1; + } + return e; +} + +static void printfcoeff(ostream& os, unsigned int fftsz, unsigned int over, unsigned int oct) +{ + if (oct) + printtransferfunc(os, fftsz, over); + else + os << "/* this file is automatically generated, do not edit!! */\n\n"; + complex fftb[fftsz]; + double rpulse[fftsz], tpulse[fftsz]; + double dover = double(over) / fftsz; + double sum; + + /* compute rx pulse */ + for (unsigned int i = 1; i < fftsz/2; i++) + fftb[i] = rxfilter(i * dover); + fftb[0] = complex(fftb[1].real(), 0); + fftb[fftsz/2] = 0; + for (unsigned int i = 1; i < fftsz/2; i++) + fftb[fftsz-i] = conj(fftb[i]); + if (oct) { + os << "# name: rxs\n" + "# type: complex matrix\n" + "# rows: " << fftsz << "\n" + "# columns: 1\n"; + for (unsigned int i = 0; i < fftsz; i++) + os << "(" << fftb[i].real() << "," << fftb[i].imag() << ")\n"; + } + fft_rif(fftb, fftsz, -1); + sum = 0; + for (unsigned int i = fftsz/2; i < fftsz; i++) + sum -= fftb[i].real(); + sum *= double(2) / fftsz; + for (unsigned int i = 0; i < fftsz; i++) + rpulse[i] = dover * (fftb[i].real() + sum); + if (oct) { + os << "# name: rx\n" + "# type: matrix\n" + "# rows: " << fftsz << "\n" + "# columns: 1\n"; + for (unsigned int i = 0; i < fftsz; i++) + os << rpulse[i] << "\n"; + } else { + os << "#define FSKIC_RXOVER " << over << "\n"; + os << "\nstatic float fskic_rxpulse[" << 4 * over << "] = {"; + for (unsigned int i = 0;;) { + if (!(i & 3)) + os << "\n\t"; + os << " " << rpulse[i]; + i++; + if (i >= 4 * over) + break; + os << ","; + } + os << "\n};\n\n"; + } + /* compute tx pulse */ + for (unsigned int i = 1; i < fftsz/2; i++) + fftb[i] = txfilter(i * dover); + fftb[0] = complex(fftb[1].real(), 0); + fftb[fftsz/2] = 0; + for (unsigned int i = 1; i < fftsz/2; i++) + fftb[fftsz-i] = conj(fftb[i]); + if (oct) { + os << "# name: txs\n" + "# type: complex matrix\n" + "# rows: " << fftsz << "\n" + "# columns: 1\n"; + for (unsigned int i = 0; i < fftsz; i++) + os << "(" << fftb[i].real() << "," << fftb[i].imag() << ")\n"; + } + fft_rif(fftb, fftsz, -1); + sum = 0; + for (unsigned int i = fftsz/2; i < fftsz; i++) + sum -= fftb[i].real(); + sum *= double(2) / fftsz; + for (unsigned int i = 0; i < fftsz; i++) + tpulse[i] = dover * (fftb[i].real() + sum); + if (oct) { + os << "# name: tx\n" + "# type: matrix\n" + "# rows: " << fftsz << "\n" + "# columns: 1\n"; + for (unsigned int i = 0; i < fftsz; i++) + os << tpulse[i] << "\n"; + } + /* compute tx compensation filter */ + double filt[8 * over]; + double shift = 0; + ostringstream oss; + double err = comptx(oss, filt, rpulse, sizeof(filt) / sizeof(filt[0]), 4 * over, over, 2, shift, oct); + double maxf = 0; + for (unsigned int i = 0; i < sizeof(filt) / sizeof(filt[0]); i++) + if (filt[i] > maxf) { + maxf = filt[i]; + shift = i; + } + shift -= sizeof(filt) / sizeof(filt[0]) / double(2); + shift *= double(2) / over; + shift = -shift; + err = comptx(os, filt, rpulse, sizeof(filt) / sizeof(filt[0]), 4 * over, over, 2, shift, oct); + if (oct) { + os << "# name: err\n" + << "# type: scalar\n" + << err << "\n"; + } else { + os << "#define FSKIC_TXOVER " << over / 2 << "\n"; + os << "\nstatic float fskic_txpulse[" << sizeof(filt) / sizeof(filt[0]) - 2 * over << "] = {"; + for (unsigned int i = over;;) { + if (!(i & 3)) + os << "\n\t"; + os << " " << filt[i]; + i++; + if (i >= sizeof(filt) / sizeof(filt[0]) - 2 * over) + break; + os << ","; + } + os << "\n};\n\n"; + } +} + +/* ---------------------------------------------------------------------- */ + +int main(int argc, char *argv[]) +{ + static const struct option long_options[] = { + { 0, 0, 0, 0 } + }; + int c, err = 0; + unsigned int oct = 0; + + while ((c = getopt_long(argc, argv, "o", long_options, NULL)) != EOF) { + switch (c) { + case 'o': + oct = 1; + break; + + default: + err++; + break; + } + } + if (err) { + cerr << "usage: [-o]\n"; + exit(1); + } + printfcoeff(cout, 2048, 16, oct); + return 0; +} diff --git a/fsk/genpsptbl.c b/fsk/genpsptbl.c new file mode 100644 index 0000000..149d389 --- /dev/null +++ b/fsk/genpsptbl.c @@ -0,0 +1,149 @@ +/*****************************************************************************/ + +/* + * genpsptbl.c -- Per Survivor Processing Table Generator. + * + * Copyright (C) 2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +/*****************************************************************************/ + +#include +#include +#include +#include +#include + +#include "mat.h" + +/* --------------------------------------------------------------------- */ + +#define DEBUG + +#define VECLENGTH 3 + +#define ESTDATASYMS 8 +#define ESTPARAMS (VECLENGTH+1) +#define ESTSYMBOLS (ESTDATASYMS-VECLENGTH+1) +#define ESTSHIFT 8 + +/* ---------------------------------------------------------------------- */ + +static int fcmatprintf(FILE *f, const char *name, unsigned int size1, unsigned int stride1, + unsigned int size2, unsigned int stride2, const cplxfloat_t *m) +{ + unsigned int i, j; + int ret = 0; + + fprintf(f, "%s = [", name); + for (i = 0; i < size1; i++) { + for (j = 0; j < size2; j++) { + ret += fprintf(f, " %g", real(m[i*stride1 + j*stride2])); + if (imag(m[i*stride1 + j*stride2]) != 0) + ret += fprintf(f, "%+gi", imag(m[i*stride1 + j*stride2])); + } + if (i+1 < size1) + ret += fprintf(f, " ; ...\n "); + } + ret += fprintf(f, " ];\n"); + return ret; +} + +/* --------------------------------------------------------------------- */ + +static void gentrainmats(FILE *f) +{ + cplxfloat_t ma[ESTSYMBOLS*ESTPARAMS], mah[ESTPARAMS*ESTSYMBOLS], maha[ESTPARAMS*ESTPARAMS]; + cplxfloat_t mahainv[ESTPARAMS*ESTPARAMS], mahainvah[ESTPARAMS*ESTSYMBOLS]; + cplxfloat_t det; + unsigned int i, j, k; + unsigned long singular[1<<(ESTDATASYMS-5)]; + + fprintf(f, "/* this file is automatically generated, do not edit!! */\n\n" + "#define VECLENGTH %u\n" + "#define ESTDATAMASK %u\n" + "#define ESTDATASYMS %u\n" + "#define ESTPARAMS %u\n" + "#define ESTSYMBOLS %u\n" + "#define ESTSHIFT %u\n" + "\n\nstatic const int16_t estmat[%u][ESTPARAMS*ESTSYMBOLS] = {", + VECLENGTH, (1<> 5] |= 1 << (i & 31); + for (j = 0; j < ESTPARAMS*ESTSYMBOLS; j++) + cplx(mahainvah[j], 0, 0); +#ifdef DEBUG + fprintf(f, " singular\n"); +#endif + } else { + fcinv(mahainv, maha, ESTPARAMS); + fcmul(mahainvah, mahainv, mah, ESTPARAMS, ESTPARAMS, ESTSYMBOLS); +#ifdef DEBUG + fcmatprintf(f, "ahainvah", ESTPARAMS, ESTSYMBOLS, ESTSYMBOLS, 1, mahainvah); +#endif + } +#ifdef DEBUG + fprintf(f, "*/\n\t"); +#endif + fprintf(f, "{ "); + for (j = 0;; j++) { + fprintf(f, "%d", (int)(mahainvah[j].re * (double)(1<= (ESTPARAMS*ESTSYMBOLS-1)) + break; + fprintf(f, ", "); + } + fprintf(f, " }"); + } + fprintf(f, "\n};\n\nstatic const unsigned long estsingular[%u] = {\n\t", + 1<<(ESTDATASYMS-5)); + for (i = 0; ; i++) { + fprintf(f, "0x%08lx", singular[i]); + if (i >= (1<<(ESTDATASYMS-5))-1) + break; + fprintf(f, ", "); + } + fprintf(f, "\n};\n\n"); +} + +/* ---------------------------------------------------------------------- */ + +int main(int argc, char *argv[]) +{ + gentrainmats(stdout); + return 0; +} diff --git a/fsk/modem.c b/fsk/modem.c new file mode 100644 index 0000000..3112aeb --- /dev/null +++ b/fsk/modem.c @@ -0,0 +1,634 @@ +/*****************************************************************************/ + +/* + * modem.c -- Linux Userland Soundmodem FSK modulator. + * + * Copyright (C) 1999-2000, 2003 + * Thomas Sailer (t.sailer@alumni.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + */ + +/*****************************************************************************/ + +#include +#include +#include +#include +#include +#include "modem.h" + +#include + +#include "raisedcosine.h" + +/* --------------------------------------------------------------------- */ + +extern double df9ic_rxfilter(double t); +extern double df9ic_txfilter(double t); + +/* --------------------------------------------------------------------- */ + +#define DESCRAM17_TAPSH1 0 +#define DESCRAM17_TAPSH2 5 +#define DESCRAM17_TAPSH3 17 + +#define SCRAM17_TAP1 (1<> 11U) & 31U) + +#define RCOSALPHA (3.0/8) + +#define FILTERRELAX 1.4 + +struct modstate { + struct modemchannel *chan; + unsigned int filtermode; + unsigned int phase, phaseinc, bps; + unsigned int shreg, txbits, scram; + int16_t filter[NUMFILTER][FILTERLEN]; +}; + +/* --------------------------------------------------------------------- */ + +#if defined(__i386__) && 0 + +static inline int mfilter(unsigned txbits, const int16_t *coeff, int len) +{ + int sum, temp1; + + __asm__("\n1:\n\t" + "shrl $1,%1\n\t" + "sbbl %4,%4\n\t" + "subl %4,%0\n\t" + "xorl (%2),%4\n\t" + "addl $2,%2\n\t" + "addl %4,%0\n\t" + "decl %3\n\t" + "jnz 1b\n\t" + : "=r" (sum), "=r" (txbits), "=r" (coeff), "=r" (len), "=r" (temp1) + : "0" (0), "1" (txbits), "2" (coeff), "3" (len)); + return sum; +} + +#else /* __i386__ */ + +static inline int32_t mfilter(unsigned txbits, const int16_t *coeff, int len) +{ + int32_t sum = 0; + + for (; len > 0; len--, coeff++, txbits >>= 1) + if (txbits & 1) + sum += *coeff; + else + sum -= *coeff; + return sum; +} + +#endif /* __i386__ */ + +/* --------------------------------------------------------------------- */ + +static const struct modemparams modparams[] = { + { "bps", "Bits/s", "Bits per second", "9600", MODEMPAR_NUMERIC, { n: { 4800, 38400, 100, 1200 } } }, + { "filter", "Filter Curve", "Filter Curve", "df9ic/g3ruh", MODEMPAR_COMBO, + { c: { { "df9ic/g3ruh", "rootraisedcosine", "raisedcosine", "hamming" } } } }, + { NULL } + +}; + +static void *modconfig(struct modemchannel *chan, unsigned int *samplerate, const char *params[]) +{ + struct modstate *s; + unsigned int i; + + if (!(s = calloc(1, sizeof(struct modstate)))) + logprintf(MLOG_FATAL, "out of memory\n"); + s->chan = chan; + if (params[0]) { + s->bps = strtoul(params[0], NULL, 0); + if (s->bps < 4800) + s->bps = 4800; + if (s->bps > 38400) + s->bps= 38400; + } else + s->bps = 9600; + s->filtermode = 0; + if (params[1]) { + for (i = 1; i < 4; i++) + if (!strcmp(params[1], modparams[1].u.c.combostr[i])) { + s->filtermode = i; + break; + } + } + *samplerate = s->bps + s->bps / 2; + return s; +} + +static void modinit(void *state, unsigned int samplerate) +{ + struct modstate *s = (struct modstate *)state; + int i, j; + float f1, f2, time, alphatime; + float c[NUMFILTER * FILTERLEN]; + + s->phaseinc = (s->bps << 16) / samplerate; + switch (s->filtermode) { + case 1: /* root raised cosine */ + for (i = 0; i < NUMFILTER * FILTERLEN; i++) { + time = i - (NUMFILTER * FILTERLEN - 1.0) / 2.0; + time *= (1.0 / NUMFILTER); + c[i] = root_raised_cosine_time(time, RCOSALPHA); + } + break; + + case 2: /* raised cosine */ + for (i = 0; i < NUMFILTER * FILTERLEN; i++) { + time = i - (NUMFILTER * FILTERLEN - 1.0) / 2.0; + time *= (1.0 / NUMFILTER); + c[i] = raised_cosine_time(time, RCOSALPHA); + } + break; + + case 3: /* hamming */ + for (i = 0; i < NUMFILTER * FILTERLEN; i++) { + f1 = i - (NUMFILTER * FILTERLEN - 1.0) / 2.0; + f1 *= (FILTERRELAX / NUMFILTER); + f2 = i * (1.0 / (NUMFILTER * FILTERLEN - 1.0)); + c[i] = sinc(f1) * hamming(f2); + } + break; + + default: /* DF9IC */ + for (i = 0; i < NUMFILTER * FILTERLEN; i++) { + time = i - (NUMFILTER * FILTERLEN - 1.0) / 2.0; + time *= (1.0 / NUMFILTER); + c[i] = df9ic_txfilter(time); + } + break; + } + f1 = 0; + for (i = 0; i < NUMFILTER; i++) { + for (f2 = 0, j = i; j < NUMFILTER * FILTERLEN; j += NUMFILTER) + f2 += fabs(c[j]); + if (f2 > f1) + f1 = f2; + } + f1 = 32767.0 / f1; + for (i = 0; i < NUMFILTER; i++) + for (j = 0; j < FILTERLEN; j++) + s->filter[i][j] = f1 * c[j * NUMFILTER + i]; +#if 1 + if (logcheck(258)) { + char buf[4096]; + char *cp = buf; + for (i = 0; i < NUMFILTER * FILTERLEN; i++) + cp += snprintf(cp, buf + sizeof(buf) - cp, " %f", f1 * c[i]); + logprintf(258, "fsk: txp = [%s];\n", buf+1); + for (i = 0; i < NUMFILTER; i++) { + cp = buf; + for (j = 0; j < FILTERLEN; j++) + cp += snprintf(cp, buf + sizeof(buf) - cp, " %d", s->filter[i][j]); + logprintf(258, "fsk: txp%u = [%s];\n", i, buf+1); + } + } +#endif +} + +static void modsendbits(struct modstate *s, unsigned char *data, unsigned int nrbits) +{ + int16_t sbuf[512]; + int16_t *sptr = sbuf, *eptr = sbuf + sizeof(sbuf)/sizeof(sbuf[0]); + unsigned int bitcnt, bits; + + bits = *data++; + bitcnt = 0; + while (bitcnt < nrbits) { + s->phase += s->phaseinc; + if (s->phase >= 0x10000) { + s->phase &= 0xffff; + bitcnt++; + s->scram = (s->scram << 1) | ((s->scram ^ bits ^ 1) & 1); + bits >>= 1; + if (s->scram & (SCRAM17_TAP1 << 1)) + s->scram ^= SCRAM17_TAPN << 1; + s->txbits = (s->txbits << 1) | ((s->scram >> DESCRAM17_TAPSH3) & 1); + if (!(bitcnt & 7)) + bits = *data++; + } + *sptr++ = mfilter(s->txbits, s->filter[FILTERIDX(s->phase)], FILTERLEN); + if (sptr >= eptr) { + audiowrite(s->chan, sbuf, sptr - sbuf); + sptr = sbuf; + } + } + audiowrite(s->chan, sbuf, sptr - sbuf); +} + +static void modmodulate(void *state, unsigned int txdelay) +{ + struct modstate *s = (struct modstate *)state; + unsigned char ch[8]; + unsigned int i, j; + + i = txdelay * s->bps / 1000; + if (i < 24) + i = 24; + memset(ch, 0x7e, sizeof(ch)); + while (i > 0) { + j = i; + if (j > 8*sizeof(ch)) + j = 8*sizeof(ch); + modsendbits(s, ch, j); + i -= j; + } + while (pktget(s->chan, ch, sizeof(ch))) + modsendbits(s, ch, 8*sizeof(ch)); + ch[0] = ch[1] = 0x7e; + modsendbits(s, ch, 16); +} + +struct modulator fskmodulator = { + NULL, + "fsk", + modparams, + modconfig, + modinit, + modmodulate, + free +}; + +/* --------------------------------------------------------------------- */ + +#ifdef __i386__ + +static inline int16_t fir(const int32_t *p1, const int16_t *p2, int len) +{ + int32_t sum, temp; + + __asm__("\n0:\n\t" + "movswl (%4),%1\n\t" + "imull (%3),%1\n\t" + "addl $-2,%4\n\t" + "addl $4,%3\n\t" + "addl %1,%0\n\t" + "decl %2\n\t" + "jnz 0b\n\t" + : "=r" (sum), "=r" (temp), "=r" (len), "=S" (p1), "=D" (p2) + : "0" (0), "2" (len), "3" (p1), "4" (p2)); + return sum >> 16; +} + +#else + +static inline int16_t fir(const int32_t *p1, const int16_t *p2, int len) +{ + int32_t sum = 0; + + for(; len > 0; len--, p1++, p2--) + sum += ((int32_t)*p1) * ((int32_t)*p2); + return sum >> 16; +} + +#endif + +/* --------------------------------------------------------------------- */ + +#define max(a, b) (((a) > (b)) ? (a) : (b)) + +#define MAXFIRLEN 64U +#define FILTEROVER 16U +#define FILTERSPANBITS 8U + +#define WHICHFILTER(x) (((x)>>12)&0xFU) /* must correspond to FILTEROVER */ +#define WHICHSAMPLE(x) ((x)>>16) + +#define EQLENGTH 5 +#define EQGAIN 100 + +struct demodstate { + struct modemchannel *chan; + unsigned int filtermode; + unsigned int bps, firlen; + unsigned int pllinc, pllcorr; + int pll; + u_int16_t stime; + + unsigned int div, divcnt; + unsigned int shreg, descram; + int dcd_sum0, dcd_sum1, dcd_sum2; + unsigned int dcd_time, dcd; + u_int32_t mean, meansq; + int32_t dcoffsp; + unsigned int dcoffscnt; + int16_t dcoffs; + + unsigned int eqbits; + int16_t eqs[EQLENGTH], eqf[EQLENGTH]; + + int32_t filter[FILTEROVER][MAXFIRLEN]; +}; + +#define DCD_TIME_SHIFT 7 +#define DCD_TIME (1<filter[WHICHFILTER(ph)], samples + WHICHSAMPLE(ph), s->firlen); +} + +static int16_t equalizer(struct demodstate *s, int16_t s1, int16_t s2) +{ + int16_t target; + int32_t sum, corr; + int i; + + memmove(s->eqs + 2, s->eqs, sizeof(s->eqs) - 2 * sizeof(s->eqs[0])); + s->eqs[1] = s1; + s->eqs[0] = s2; + s->eqbits = (s->eqbits << 1) | (s2 > 0); + target = (s->eqbits & (1 << ((EQLENGTH-1)/4))) ? 0x4000 : -0x4000; + for (sum = i = 0; i < EQLENGTH; i++) + sum += ((int32_t)s->eqs[i]) * ((int32_t)s->eqf[i]); + sum >>= 14; + corr = ((target - sum) * EQGAIN) >> 15; + for (i = 0; i < EQLENGTH; i++) + s->eqf[i] += (s->eqs[i] * corr) >> 15; + printf("%5d %5d %5d %5d %5d\n", s->eqf[0], s->eqf[1], s->eqf[2], s->eqf[3], s->eqf[4]); + return sum; +} + +static const struct modemparams demodparams[] = { + { "bps", "Bits/s", "Bits per second", "9600", MODEMPAR_NUMERIC, { n: { 4800, 38400, 100, 1200 } } }, + { "filter", "Filter Curve", "Filter Curve", "df9ic/g3ruh", MODEMPAR_COMBO, + { c: { { "df9ic/g3ruh", "rootraisedcosine", "raisedcosine", "hamming" } } } }, + { NULL } + +}; + +static void *demodconfig(struct modemchannel *chan, unsigned int *samplerate, const char *params[]) +{ + struct demodstate *s; + unsigned int i; + + if (!(s = calloc(1, sizeof(struct demodstate)))) + logprintf(MLOG_FATAL, "out of memory\n"); + s->chan = chan; + if (params[0]) { + s->bps = strtoul(params[0], NULL, 0); + if (s->bps < 4800) + s->bps = 4800; + if (s->bps > 38400) + s->bps= 38400; + } else + s->bps = 9600; + s->filtermode = 0; + if (params[1]) { + for (i = 1; i < 4; i++) + if (!strcmp(params[1], demodparams[1].u.c.combostr[i])) { + s->filtermode = i; + break; + } + } + *samplerate = s->bps + s->bps / 2; + return s; +} + +static void demodrx(struct demodstate *s, unsigned nsamples) +{ + int16_t *samples; + int16_t curs, nexts, mids, xs, eq; + int32_t gardner; + unsigned int d, descx; + unsigned char ch[3]; + int corr, dcd; + + samples = alloca((nsamples + s->firlen) * sizeof(samples[0])); + audioread(s->chan, samples, nsamples + s->firlen, s->stime); + s->stime += nsamples; + samples += s->firlen; + while (WHICHSAMPLE(s->pll + s->pllinc) < nsamples) { +#if 0 + for (corr = 0; corr < 16; corr++) + printf("%d\n", filter(s, samples, s->pll+corr*s->pllinc/16)); +#endif + curs = filter(s, samples, s->pll); + mids = filter(s, samples, s->pll+s->pllinc/2); + nexts = filter(s, samples, s->pll+s->pllinc); + /* dc offset prediction */ + s->dcoffsp += curs; + s->dcoffscnt++; + if (s->dcoffscnt >= 4096) { + s->dcoffs = -(s->dcoffsp >> 12); + logprintf(257, "fskrx: DC offset %d\n", -s->dcoffs); + s->dcoffscnt = 0; + s->dcoffsp = 0; + } + /* dc offset compensation */ + curs += s->dcoffs; + mids += s->dcoffs; + nexts += s->dcoffs; + /* sample clock recovery */ + gardner = ((nexts > 0 ? 1 : -1) - (curs > 0 ? 1 : -1)) * mids; +#if 0 + eq = equalizer(s, mids, nexts); +#endif + s->pll += s->pllinc; +#if 0 + corr = (gardner * s->pllinc) >> 20; + s->pll -= corr; +#elif 0 + if (gardner < 0) + s->pll += s->pllinc >> 4; + else + s->pll -= s->pllinc >> 4; +#else + if ((curs > 0) ^ (nexts > 0)) { + if ((curs > 0) ^ (mids > 0)) + s->pll -= s->pllinc >> 5; + if ((nexts > 0) ^ (mids > 0)) + s->pll += s->pllinc >> 5; + } +#endif + + /* accumulate values for DCD */ + s->mean += abs(curs); + s->meansq += (((int32_t)curs) * ((int32_t)curs)) >> DCD_TIME_SHIFT; + /* process sample */ + s->descram <<= 1; + s->descram |= (curs >> 15) & 1; + descx = ~(s->descram ^ (s->descram >> 1)); + descx ^= (descx >> DESCRAM17_TAPSH3) ^ (descx >> (DESCRAM17_TAPSH3-DESCRAM17_TAPSH2)); + s->shreg >>= 1; + s->shreg |= (descx & 1) << 24; + if (s->shreg & 1) { + ch[0] = s->shreg >> 1; + ch[1] = s->shreg >> 9; + ch[2] = s->shreg >> 17; + pktput(s->chan, ch, 3); + if (logcheck(257)) { + char buf2[25]; + unsigned int i; + for (i = 0; i < 24; i++) + buf2[i] = '0' + ((s->shreg >> (i+1)) & 1); + buf2[24] = 0; + logprintf(257, "fskrx: %s\n", buf2); + } + s->shreg = 0x1000000; + } + /* DCD */ + s->dcd_time++; + if (s->dcd_time < DCD_TIME) + continue; + s->mean >>= DCD_TIME_SHIFT; + s->mean *= s->mean; + if (s->meansq < 512) + dcd = 0; + else + dcd = (s->mean + (s->mean >> 2)) > s->meansq; + logprintf(256, "DCD: mean: %8u meansq: %8u diff: %8d DCD: %u\n", s->mean, s->meansq, s->meansq-s->mean, dcd); + s->dcd_time = 0; + pktsetdcd(s->chan, /*(s->dcd_sum0 + s->dcd_sum1 + s->dcd_sum2) < 0*/ dcd); + s->dcd_sum2 = s->dcd_sum1; + s->dcd_sum1 = s->dcd_sum0; + s->dcd_sum0 = 2; /* slight bias */ + s->meansq = s->mean = 0; + } + s->pll -= (nsamples << 16); +} + +static void demoddemodulate(void *state) +{ + struct demodstate *s = (struct demodstate *)state; + + s->stime = audiocurtime(s->chan); + for (;;) + demodrx(s, 256); +} + +static void demodinit(void *state, unsigned int samplerate, unsigned int *bitrate) +{ + struct demodstate *s = (struct demodstate *)state; + float coeff[FILTEROVER][MAXFIRLEN]; + float pulseen[FILTEROVER]; + double tmul; + float max1, max2, t, at, f1, f2; + int i, j; + + s->firlen = (samplerate * FILTERSPANBITS + s->bps - 1) / s->bps; + if (s->firlen > MAXFIRLEN) { + logprintf(MLOG_WARNING, "demodfsk: input filter length too long\n"); + s->firlen = MAXFIRLEN; + } + tmul = ((double)s->bps) / FILTEROVER / ((double)samplerate); + switch (s->filtermode) { + case 1: /* root raised cosine */ + for (i = 0; i < FILTEROVER*s->firlen; i++) { + t = (signed)(i - s->firlen*FILTEROVER/2) * tmul; + coeff[((unsigned)i) % FILTEROVER][((unsigned)i) / FILTEROVER] = root_raised_cosine_time(t, RCOSALPHA); + } + break; + + case 2: /* raised cosine */ + for (i = 0; i < FILTEROVER*s->firlen; i++) { + t = (signed)(i - s->firlen*FILTEROVER/2) * tmul; + coeff[((unsigned)i) % FILTEROVER][((unsigned)i) / FILTEROVER] = raised_cosine_time(t, RCOSALPHA); + } + break; + + case 3: /* hamming */ + tmul *= FILTERRELAX; + for (i = 0; i < FILTEROVER*s->firlen; i++) + coeff[((unsigned)i) % FILTEROVER][((unsigned)i) / FILTEROVER] = + sinc((i - (signed)s->firlen*FILTEROVER/2)*tmul) + * hamming((double)i / (double)(FILTEROVER*s->firlen-1)); + break; + + default: /* DF9IC */ + for (i = 0; i < FILTEROVER*s->firlen; i++) { + t = (signed)(i - s->firlen*FILTEROVER/2) * tmul; + coeff[((unsigned)i) % FILTEROVER][((unsigned)i) / FILTEROVER] = df9ic_rxfilter(t); + } + break; + } + max1 = 0; + for (i = 0; i < FILTEROVER; i++) { + max2 = 0; + for (j = 0; j < s->firlen; j++) + max2 += fabs(coeff[i][j]); + if (max2 > max1) + max1 = max2; + } + max2 = ((float)0x3fffffff / (float)0x7fff) / max1; + for (i = 0; i < FILTEROVER; i++) { + f1 = 0; + for (j = 0; j < s->firlen; j++) { + s->filter[i][j] = max2 * coeff[i][j]; + f1 += s->filter[i][j] * s->filter[i][j]; + } + pulseen[i] = f1; + } +#if 1 + if (logcheck(258)) { + char buf[4096]; + char *cp = buf; + for (i = 0; i < FILTEROVER*s->firlen; i++) + cp += snprintf(cp, buf + sizeof(buf) - cp, " %f", coeff[((unsigned)i) % FILTEROVER][((unsigned)i) / FILTEROVER]); + logprintf(258, "fsk: rxp = [%s];\n", buf+1); + for (i = 0; i < FILTEROVER; i++) { + cp = buf; + for (j = 0; j < s->firlen; j++) + cp += snprintf(cp, buf + sizeof(buf) - cp, " %d", s->filter[i][j]); + logprintf(258, "fsk: rxp%u = [%s];\n", i, buf+1); + } + } +#endif + if (logcheck(257)) { + char buf[512]; + char *cp = buf; + for (i = 0; i < FILTEROVER; i++) + cp += sprintf(cp, ", %6.2gdB", 10*M_LOG10E*log(pulseen[i]) - 10*M_LOG10E*log(32768.0 * (1<<16))); + logprintf(257, "fsk: rxpulse energies: %s\n", buf+2); + } + s->pllinc = (0x10000 * samplerate + s->bps/2) / s->bps; + s->pll = 0; + s->pllcorr = s->pllinc / 8; + s->eqbits = 0; + memset(s->eqs, 0, sizeof(s->eqs)); + memset(s->eqf, 0, sizeof(s->eqf)); + s->shreg = 0x1000000; + *bitrate = s->bps; +} + +/* --------------------------------------------------------------------- */ + +struct demodulator fskdemodulator = { + NULL, + "fsk", + demodparams, + demodconfig, + demodinit, + demoddemodulate, + free +}; + +/* --------------------------------------------------------------------- */ diff --git a/fsk/modemeq.c b/fsk/modemeq.c new file mode 100644 index 0000000..b91fad8 --- /dev/null +++ b/fsk/modemeq.c @@ -0,0 +1,488 @@ +/*****************************************************************************/ + +/* + * modemeq.c -- Linux Userland Soundmodem FSK demodulator with equalizer. + * + * Copyright (C) 1999-2000, 2003 + * Thomas Sailer (t.sailer@alumni.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + */ + +/*****************************************************************************/ + +#include +#include +#include +#include +#include +#include "modem.h" + +#include + +#include "raisedcosine.h" +#include "mat.h" + +/* --------------------------------------------------------------------- */ + +extern double df9ic_rxfilter(double t); +extern double df9ic_txfilter(double t); + +/* --------------------------------------------------------------------- */ + +#define DESCRAM17_TAPSH1 0 +#define DESCRAM17_TAPSH2 5 +#define DESCRAM17_TAPSH3 17 + +/* --------------------------------------------------------------------- */ + +#define RCOSALPHA (3.0/8) + +#define FILTERRELAX 1.4 + +/* --------------------------------------------------------------------- */ + +#ifdef __i386__ + +static inline int16_t fir(const int32_t *p1, const int16_t *p2, int len) +{ + int32_t sum, temp; + + __asm__("\n0:\n\t" + "movswl (%4),%1\n\t" + "imull (%3),%1\n\t" + "addl $-2,%4\n\t" + "addl $4,%3\n\t" + "addl %1,%0\n\t" + "decl %2\n\t" + "jnz 0b\n\t" + : "=r" (sum), "=r" (temp), "=r" (len), "=S" (p1), "=D" (p2) + : "0" (0), "2" (len), "3" (p1), "4" (p2)); + return sum >> 16; +} + +#else + +static inline int16_t fir(const int32_t *p1, const int16_t *p2, int len) +{ + int32_t sum = 0; + + for(; len > 0; len--, p1++, p2--) + sum += ((int32_t)*p1) * ((int32_t)*p2); + return sum >> 16; +} + +#endif + +/* --------------------------------------------------------------------- */ + +#define max(a, b) (((a) > (b)) ? (a) : (b)) + +#define MAXFIRLEN 64U +#define FILTEROVER 16U +#define FILTERSPANBITS 8U + +#define WHICHFILTER(x) (((x)>>12)&0xFU) /* must correspond to FILTEROVER */ +#define WHICHSAMPLE(x) ((x)>>16) + +#define EQFLENGTH 8 /* last is DC-offset */ +#define TRAINBITS 40 +#define RHSLENGTH ((TRAINBITS+2-EQFLENGTH)/2) + + + + +#define EQLENGTH 5 +#define EQGAIN 100 + +struct demodstate { + struct modemchannel *chan; + unsigned int filtermode; + unsigned int bps, firlen; + unsigned int pllinc, pllcorr; + int pll; + u_int16_t stime; + + unsigned int div, divcnt; + unsigned int shreg, descram, shregeq, descrameq; + int dcd_sum0, dcd_sum1, dcd_sum2; + unsigned int dcd_time, dcd; + u_int32_t mean, meansq; + + int32_t eqfilt[EQFLENGTH]; + int16_t eqsamp[EQFLENGTH & ~1]; + + unsigned int eqbits; + int16_t eqs[EQLENGTH], eqf[EQLENGTH]; + + int32_t filter[FILTEROVER][MAXFIRLEN]; +}; + +#define DCD_TIME_SHIFT 7 +#define DCD_TIME (1<filter[WHICHFILTER(ph)], samples + WHICHSAMPLE(ph), s->firlen); +} + +static int16_t equalizer(struct demodstate *s, int16_t s1, int16_t s2) +{ + int16_t target; + int32_t sum, corr; + int i; + + memmove(s->eqs + 2, s->eqs, sizeof(s->eqs) - 2 * sizeof(s->eqs[0])); + s->eqs[1] = s1; + s->eqs[0] = s2; + s->eqbits = (s->eqbits << 1) | (s2 > 0); + target = (s->eqbits & (1 << ((EQLENGTH-1)/4))) ? 0x4000 : -0x4000; + for (sum = i = 0; i < EQLENGTH; i++) + sum += ((int32_t)s->eqs[i]) * ((int32_t)s->eqf[i]); + sum >>= 14; + corr = ((target - sum) * EQGAIN) >> 15; + for (i = 0; i < EQLENGTH; i++) + s->eqf[i] += (s->eqs[i] * corr) >> 15; + printf("%5d %5d %5d %5d %5d\n", s->eqf[0], s->eqf[1], s->eqf[2], s->eqf[3], s->eqf[4]); + return sum; +} + +static const struct modemparams demodparams[] = { + { "bps", "Bits/s", "Bits per second", "9600", MODEMPAR_NUMERIC, { n: { 4800, 38400, 100, 1200 } } }, + { "filter", "Filter Curve", "Filter Curve", "df9ic/g3ruh", MODEMPAR_COMBO, + { c: { { "df9ic/g3ruh", "rootraisedcosine", "raisedcosine", "hamming" } } } }, + { NULL } + +}; + +static void *demodconfig(struct modemchannel *chan, unsigned int *samplerate, const char *params[]) +{ + struct demodstate *s; + unsigned int i; + + if (!(s = calloc(1, sizeof(struct demodstate)))) + logprintf(MLOG_FATAL, "out of memory\n"); + s->chan = chan; + if (params[0]) { + s->bps = strtoul(params[0], NULL, 0); + if (s->bps < 4800) + s->bps = 4800; + if (s->bps > 38400) + s->bps= 38400; + } else + s->bps = 9600; + s->filtermode = 0; + if (params[1]) { + for (i = 1; i < 4; i++) + if (!strcmp(params[1], demodparams[1].u.c.combostr[i])) { + s->filtermode = i; + break; + } + } + *samplerate = s->bps + s->bps / 2; + return s; +} + +static void compute_eq(struct demodstate *s, u_int32_t time) +{ + int16_t *samples; + u_int32_t etime = time + TRAINBITS * s->pllinc; + unsigned int nsamples = ((etime - time) >> 16) + s->firlen; + unsigned int i, j; + int16_t es[2*TRAINBITS]; + float f[EQFLENGTH]; + float C[RHSLENGTH * EQFLENGTH]; + float CT[RHSLENGTH * EQFLENGTH]; + float CTC[EQFLENGTH * EQFLENGTH]; + float CTr[EQFLENGTH]; + float Cf[RHSLENGTH]; + float r[RHSLENGTH]; + float e, e1; + + logprintf(257, "fskeq: txstart 0x%08x\n", time); + samples = alloca(nsamples * sizeof(samples[0])); + audioread(s->chan, samples, nsamples, time >> 16); + for (i = 0; i < 2*TRAINBITS; i++) + es[i] = filter(s, samples, (time & 0xffff) + i * s->pllinc / 2); + if (logcheck(258)) { + char buf[16*2*TRAINBITS]; + char *cp = buf; + for (i = 0; i < 2*TRAINBITS; i++) + cp += snprintf(cp, buf + sizeof(buf) - cp, " %d", es[i]); + logprintf(258, "fskeq: es = [%s];\n", buf+1); + } + for (i = 0; i < RHSLENGTH; i++) { + for (j = 0; j < EQFLENGTH-1; j++) + C[i*EQFLENGTH+j] = es[2*i+j]; + C[i*EQFLENGTH+EQFLENGTH-1] = 1; /* DC component */ + r[i] = (es[2*i+(((EQFLENGTH-2)/2) & ~1)] > 0) ? 16384 : -16384; + } + frtranspose(CT, C, RHSLENGTH, EQFLENGTH); + frmul(CTC, CT, C, EQFLENGTH, RHSLENGTH, EQFLENGTH); + frmul(CTr, CT, r, EQFLENGTH, RHSLENGTH, 1); + frchol(CTC, CTr, f, EQFLENGTH); + frmul(Cf, C, f, RHSLENGTH, EQFLENGTH, 1); + for (i = 0, e = 0; i < RHSLENGTH; i++) { + e1 = Cf[i] - r[i]; + e += e1 * e1; + } + e *= (1.0 / 16384 / 16384 / EQFLENGTH); + if (logcheck(258)) { + char buf[16*EQFLENGTH]; + char *cp = buf; + for (i = 0; i < EQFLENGTH; i++) + cp += snprintf(cp, buf + sizeof(buf) - cp, " %f", f[i]); + logprintf(258, "fskeq: e = %f; f = [%s];\n", e, buf+1); + } + if (e > 0.2) + return; + for (i = 0; i < EQFLENGTH; i++) + s->eqfilt[i] = 32768 * f[i]; +} + +static int16_t filter_eq(struct demodstate *s, int16_t samp0, int16_t samp1) +{ + int32_t sum = s->eqfilt[EQFLENGTH-1]; + unsigned int i; + + memmove(&s->eqsamp[0], &s->eqsamp[2], sizeof(s->eqsamp) - 2 * sizeof(s->eqsamp[0])); + s->eqsamp[(EQFLENGTH-1) & ~1] = samp0; + s->eqsamp[(EQFLENGTH-1) | 1] = samp1; + for (i = 0; i < EQFLENGTH-1; i++) + sum += s->eqsamp[i] * s->eqfilt[i]; + return sum >> 15; +} + +static void demodrx(struct demodstate *s, unsigned nsamples) +{ + int16_t *samples; + int16_t curs, nexts, mids, xs, eqs; + int32_t gardner; + unsigned int d, descx; + unsigned char ch[3]; + int corr, dcd; + + samples = alloca((nsamples + s->firlen) * sizeof(samples[0])); + audioread(s->chan, samples, nsamples + s->firlen, s->stime); + s->stime += nsamples; + samples += s->firlen; + while (WHICHSAMPLE(s->pll + s->pllinc) < nsamples) { +#if 0 + for (corr = 0; corr < 16; corr++) + printf("%d\n", filter(s, samples, s->pll+corr*s->pllinc/16)); +#endif + curs = filter(s, samples, s->pll); + mids = filter(s, samples, s->pll+s->pllinc/2); + nexts = filter(s, samples, s->pll+s->pllinc); + gardner = ((nexts > 0 ? 1 : -1) - (curs > 0 ? 1 : -1)) * mids; +#if 0 + eqs = equalizer(s, mids, nexts); +#endif + eqs = filter_eq(s, curs, mids); + + s->pll += s->pllinc; +#if 0 + corr = (gardner * s->pllinc) >> 20; + s->pll -= corr; +#elif 0 + if (gardner < 0) + s->pll += s->pllinc >> 4; + else + s->pll -= s->pllinc >> 4; +#else + if ((curs > 0) ^ (nexts > 0)) { + if ((curs > 0) ^ (mids > 0)) + s->pll -= s->pllinc >> 5; + if ((nexts > 0) ^ (mids > 0)) + s->pll += s->pllinc >> 5; + } +#endif + + /* accumulate values for DCD */ + s->mean += abs(eqs); + s->meansq += (((int32_t)eqs) * ((int32_t)eqs)) >> DCD_TIME_SHIFT; + /* process sample */ + s->descram <<= 1; + s->descram |= (eqs >> 15) & 1; + descx = ~(s->descram ^ (s->descram >> 1)); + descx ^= (descx >> DESCRAM17_TAPSH3) ^ (descx >> (DESCRAM17_TAPSH3-DESCRAM17_TAPSH2)); + s->shreg >>= 1; + s->shreg |= (descx & 1) << 24; + s->descrameq <<= 1; + s->descrameq |= (curs >> 15) & 1; + descx = ~(s->descram ^ (s->descram >> 1)); + descx ^= (descx >> DESCRAM17_TAPSH3) ^ (descx >> (DESCRAM17_TAPSH3-DESCRAM17_TAPSH2)); + s->shregeq <<= 1; + s->shregeq |= descx & 1; + if (s->shreg & 1) { + ch[0] = s->shreg >> 1; + ch[1] = s->shreg >> 9; + ch[2] = s->shreg >> 17; + pktput(s->chan, ch, 3); + if (logcheck(257)) { + char buf2[25]; + unsigned int i; + for (i = 0; i < 24; i++) + buf2[i] = '0' + ((s->shreg >> (i+1)) & 1); + buf2[24] = 0; + logprintf(257, "fskrx: %s\n", buf2); + } + s->shreg = 0x1000000; + } + if ((((s->shregeq & 0xffffff00) == 0x7e7e7e00) || ((s->shregeq & 0xffffff00) == 0x00007e00)) && + (s->shregeq & 0xff) != 0x7e) { + /* start of transmission detected */ + compute_eq(s, (s->stime << 16) + s->pll - (TRAINBITS + 8 - 1) * s->pllinc); + } + /* DCD */ + s->dcd_time++; + if (s->dcd_time < DCD_TIME) + continue; + s->mean >>= DCD_TIME_SHIFT; + s->mean *= s->mean; + if (s->meansq < 512) + dcd = 0; + else + dcd = (s->mean + (s->mean >> 2)) > s->meansq; + logprintf(256, "DCD: mean: %8u meansq: %8u diff: %8d DCD: %u\n", s->mean, s->meansq, s->meansq-s->mean, dcd); + s->dcd_time = 0; + pktsetdcd(s->chan, /*(s->dcd_sum0 + s->dcd_sum1 + s->dcd_sum2) < 0*/ dcd); + s->dcd_sum2 = s->dcd_sum1; + s->dcd_sum1 = s->dcd_sum0; + s->dcd_sum0 = 2; /* slight bias */ + s->meansq = s->mean = 0; + } + s->pll -= (nsamples << 16); +} + +static void demoddemodulate(void *state) +{ + struct demodstate *s = (struct demodstate *)state; + + s->stime = audiocurtime(s->chan); + for (;;) + demodrx(s, 256); +} + +static void demodinit(void *state, unsigned int samplerate, unsigned int *bitrate) +{ + struct demodstate *s = (struct demodstate *)state; + float coeff[FILTEROVER][MAXFIRLEN]; + float pulseen[FILTEROVER]; + double tmul; + float max1, max2, t, at, f1, f2; + int i, j; + + s->firlen = (samplerate * FILTERSPANBITS + s->bps - 1) / s->bps; + if (s->firlen > MAXFIRLEN) { + logprintf(MLOG_WARNING, "demodfsk: input filter length too long\n"); + s->firlen = MAXFIRLEN; + } + tmul = ((double)s->bps) / FILTEROVER / ((double)samplerate); + switch (s->filtermode) { + case 1: /* root raised cosine */ + for (i = 0; i < FILTEROVER*s->firlen; i++) { + t = (signed)(i - s->firlen*FILTEROVER/2) * tmul; + coeff[((unsigned)i) % FILTEROVER][((unsigned)i) / FILTEROVER] = root_raised_cosine_time(t, RCOSALPHA); + } + break; + + case 2: /* raised cosine */ + for (i = 0; i < FILTEROVER*s->firlen; i++) { + t = (signed)(i - s->firlen*FILTEROVER/2) * tmul; + coeff[((unsigned)i) % FILTEROVER][((unsigned)i) / FILTEROVER] = raised_cosine_time(t, RCOSALPHA); + } + break; + + case 3: /* hamming */ + tmul *= FILTERRELAX; + for (i = 0; i < FILTEROVER*s->firlen; i++) + coeff[((unsigned)i) % FILTEROVER][((unsigned)i) / FILTEROVER] = + sinc((i - (signed)s->firlen*FILTEROVER/2)*tmul) + * hamming((double)i / (double)(FILTEROVER*s->firlen-1)); + break; + + default: /* DF9IC */ + for (i = 0; i < FILTEROVER*s->firlen; i++) { + t = (signed)(i - s->firlen*FILTEROVER/2) * tmul; + coeff[((unsigned)i) % FILTEROVER][((unsigned)i) / FILTEROVER] = df9ic_rxfilter(t); + } + break; + } + max1 = 0; + for (i = 0; i < FILTEROVER; i++) { + max2 = 0; + for (j = 0; j < s->firlen; j++) + max2 += fabs(coeff[i][j]); + if (max2 > max1) + max1 = max2; + } + max2 = ((float)0x3fffffff / (float)0x7fff) / max1; + for (i = 0; i < FILTEROVER; i++) { + f1 = 0; + for (j = 0; j < s->firlen; j++) { + s->filter[i][j] = max2 * coeff[i][j]; + f1 += s->filter[i][j] * s->filter[i][j]; + } + pulseen[i] = f1; + } +#if 1 + if (logcheck(258)) { + char buf[4096]; + char *cp = buf; + for (i = 0; i < FILTEROVER*s->firlen; i++) + cp += snprintf(cp, buf + sizeof(buf) - cp, " %f", coeff[((unsigned)i) % FILTEROVER][((unsigned)i) / FILTEROVER]); + logprintf(258, "fsk: rxp = [%s];\n", buf+1); + for (i = 0; i < FILTEROVER; i++) { + cp = buf; + for (j = 0; j < s->firlen; j++) + cp += snprintf(cp, buf + sizeof(buf) - cp, " %d", s->filter[i][j]); + logprintf(258, "fsk: rxp%u = [%s];\n", i, buf+1); + } + } +#endif + if (logcheck(257)) { + char buf[512]; + char *cp = buf; + for (i = 0; i < FILTEROVER; i++) + cp += sprintf(cp, ", %6.2gdB", 10*M_LOG10E*log(pulseen[i]) - 10*M_LOG10E*log(32768.0 * (1<<16))); + logprintf(257, "fsk: rxpulse energies: %s\n", buf+2); + } + s->pllinc = (0x10000 * samplerate + s->bps/2) / s->bps; + s->pll = 0; + s->pllcorr = s->pllinc / 8; + s->eqbits = 0; + memset(s->eqs, 0, sizeof(s->eqs)); + memset(s->eqf, 0, sizeof(s->eqf)); + s->shreg = 0x1000000; + *bitrate = s->bps; + s->eqfilt[((EQFLENGTH-2)/2) & ~1] = 32768; +} + +/* --------------------------------------------------------------------- */ + +struct demodulator fskeqdemodulator = { + NULL, + "fskeq", + demodparams, + demodconfig, + demodinit, + demoddemodulate, + free +}; + +/* --------------------------------------------------------------------- */ diff --git a/fsk/modempsp.c b/fsk/modempsp.c new file mode 100644 index 0000000..24f6d27 --- /dev/null +++ b/fsk/modempsp.c @@ -0,0 +1,476 @@ +/*****************************************************************************/ + +/* + * modempsp.c -- Linux Userland Soundmodem FSK PSP VE enhanced demodulator. + * + * Copyright (C) 1999-2000, 2003 + * Thomas Sailer (t.sailer@alumni.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + */ + +/*****************************************************************************/ + +#include +#include +#include +#include +#include "modem.h" + +#include + +#include "raisedcosine.h" + +/* --------------------------------------------------------------------- */ + +extern double df9ic_rxfilter(double t); +extern double df9ic_txfilter(double t); + +/* --------------------------------------------------------------------- */ + +#define RCOSALPHA (3.0/8) + +#define FILTERRELAX 1.4 + +#define DESCRAM17_TAPSH1 0 +#define DESCRAM17_TAPSH2 5 +#define DESCRAM17_TAPSH3 17 + +/* --------------------------------------------------------------------- */ + +#include "psp.h" + +/* --------------------------------------------------------------------- */ + +static inline int isqr(int x) +{ + return x * x; +} + +static inline u_int8_t rev_nibble(u_int8_t in) +{ + u_int8_t nibbletab[16] = {0x0,0x8,0x4,0xc,0x2,0xa,0x6,0xe,0x1,0x9,0x5,0xd,0x3,0xb,0x7,0xf}; + return nibbletab[in & 0xf]; +} + +static inline u_int8_t rev_byte(u_int8_t in) { + return (rev_nibble(in) << 4) | rev_nibble(in >> 4); +} + +#ifdef __i386__ + +static inline int16_t fir(const int32_t *p1, const int16_t *p2, int len) +{ + int32_t sum, temp; + + __asm__("\n0:\n\t" + "movswl (%4),%1\n\t" + "imull (%3),%1\n\t" + "addl $-2,%4\n\t" + "addl $4,%3\n\t" + "addl %1,%0\n\t" + "decl %2\n\t" + "jnz 0b\n\t" + : "=r" (sum), "=r" (temp), "=r" (len), "=S" (p1), "=D" (p2) + : "0" (0), "2" (len), "3" (p1), "4" (p2)); + return sum >> 16; +} + +#else + +static inline int16_t fir(const int32_t *p1, const int16_t *p2, int len) +{ + int32_t sum = 0; + + for(; len > 0; len--, p1++, p2--) + sum += ((int32_t)*p1) * ((int32_t)*p2); + return sum >> 16; +} + +#endif + +/* --------------------------------------------------------------------- */ + +#define max(a, b) (((a) > (b)) ? (a) : (b)) + +#define MAXFIRLEN 64U +#define FILTEROVER 16U +#define FILTERSPANBITS 8U + +#define WHICHFILTER(x) (((x)>>12)&0xFU) /* must correspond to FILTEROVER */ +#define WHICHSAMPLE(x) ((x)>>16) + +#define SNRESTSHIFT 7 + +#define PARAMSMOOTH 0.95 + +#define PARSMMUL1 ((int)(PARAMSMOOTH*(1<<16))) +#define PARSMMUL2 ((1<<16)-PARSMMUL1) + +struct venode { + unsigned int metric; + unsigned int data; +}; + +struct demodstate { + struct modemchannel *chan; + unsigned int filtermode; + unsigned int bps, firlen; + unsigned int pllinc, pllcorr; + int pll; + u_int16_t stime; + + unsigned int descram; + unsigned int shistcnt; + unsigned int snracc, snrcnt; + int16_t shist[16]; + + /* + * 0: DC level + * 1: postcursor of previous bit + * 2: bit amplitude + * 3: precursor of following bit + */ + int16_t params[4]; + + struct venode venodes[8]; + + int32_t filter[FILTEROVER][MAXFIRLEN]; +}; + +#define DCD_TIME_SHIFT 7 +#define DCD_TIME (1<filter[WHICHFILTER(ph)], samples + WHICHSAMPLE(ph), s->firlen); +} + +static const struct modemparams demodparams[] = { + { "bps", "Bits/s", "Bits per second", "9600", MODEMPAR_NUMERIC, { n: { 4800, 38400, 100, 1200 } } }, + { "filter", "Filter Curve", "Filter Curve", "df9ic/g3ruh", MODEMPAR_COMBO, + { c: { { "df9ic/g3ruh", "rootraisedcosine", "raisedcosine", "hamming" } } } }, + { NULL } + +}; + +static void *demodconfig(struct modemchannel *chan, unsigned int *samplerate, const char *params[]) +{ + struct demodstate *s; + unsigned int i; + + if (!(s = calloc(1, sizeof(struct demodstate)))) + logprintf(MLOG_FATAL, "out of memory\n"); + s->chan = chan; + if (params[0]) { + s->bps = strtoul(params[0], NULL, 0); + if (s->bps < 4800) + s->bps = 4800; + if (s->bps > 38400) + s->bps= 38400; + } else + s->bps = 9600; + s->filtermode = 0; + if (params[1]) { + for (i = 1; i < 4; i++) + if (!strcmp(params[1], demodparams[1].u.c.combostr[i])) { + s->filtermode = i; + break; + } + } + *samplerate = s->bps + s->bps / 2; + return s; +} + +static inline int estparams(struct demodstate *s, unsigned int deschist) +{ + int16_t params[ESTPARAMS]; + const int16_t *shist, *sptr, *cptr; + int sum; + unsigned int i, j; + + deschist &= ESTDATAMASK; + if (estsingular[deschist >> 5] & (1 << (deschist & 31))) { + logprintf(250, "singular pattern\n"); + return 0; + } + shist = s->shist + s->shistcnt + ESTSYMBOLS - 1; + cptr = estmat[deschist]; + for (i = 0; i < ESTPARAMS; i++) { + sptr = shist; + sum = 0; + for (j = 0; j < ESTSYMBOLS; j++, sptr--, cptr++) + sum += (int)(*sptr) * (int)(*cptr); + params[i] = sum >> ESTSHIFT; + sum = PARSMMUL1 * s->params[i] + PARSMMUL2 * params[i]; + s->params[i] = sum >> 16; + } + /* clamp params to sane values */ + if (s->params[2] < 250) + s->params[2] = 250; + sum = s->params[2] >> 1; + if (abs(s->params[1]) > sum) + s->params[1] = (s->params[1] > 0) ? sum : -sum; + if (abs(s->params[3]) > sum) + s->params[3] = (s->params[3] > 0) ? sum : -sum; + logprintf(250, "Par: est: %5d %5d %5d %5d sm: %5d %5d %5d %5d\n", + params[0], params[1], params[2], params[3], + s->params[0], s->params[1], s->params[2], s->params[3]); + return 1; +} + +static inline void viterbieq(struct demodstate *s, int16_t curs) +{ + int blevel = s->params[0] - s->params[1] - s->params[2] - s->params[3] - curs; + int ampl0 = 2 * s->params[1]; + int ampl1 = 2 * s->params[2]; + int ampl2 = 2 * s->params[3]; + unsigned int metric0, metric1; + struct venode *node1, *node2; + unsigned char ch; + unsigned int i; + float snr; + + if (s->shistcnt & 1) { + node1 = s->venodes+4; + node2 = s->venodes; + } else { + node1 = s->venodes; + node2 = s->venodes+4; + } + s->shist[s->shistcnt++] = curs; + s->shistcnt &= 15; + /* unrolled viterbi equalizer loop */ + metric0 = node1[0].metric + isqr(blevel); + metric1 = node1[2].metric + isqr(blevel + ampl2); + if (metric0 < metric1) { + node2[0].metric = metric0; + node2[0].data = node1[0].data << 1; + } else { + node2[0].metric = metric1; + node2[0].data = node1[2].data << 1; + } + metric0 = node1[0].metric + isqr(blevel + ampl0); + metric1 = node1[2].metric + isqr(blevel + ampl2 + ampl0); + if (metric0 < metric1) { + node2[1].metric = metric0; + node2[1].data = (node1[0].data << 1) | 1; + } else { + node2[1].metric = metric1; + node2[1].data = (node1[2].data << 1) | 1; + } + metric0 = node1[1].metric + isqr(blevel + ampl1); + metric1 = node1[3].metric + isqr(blevel + ampl2 + ampl1); + if (metric0 < metric1) { + node2[2].metric = metric0; + node2[2].data = node1[1].data << 1; + } else { + node2[2].metric = metric1; + node2[2].data = node1[3].data << 1; + } + metric0 = node1[1].metric + isqr(blevel + ampl1 + ampl0); + metric1 = node1[3].metric + isqr(blevel + ampl2 + ampl1 + ampl0); + if (metric0 < metric1) { + node2[3].metric = metric0; + node2[3].data = (node1[1].data << 1) | 1; + } else { + node2[3].metric = metric1; + node2[3].data = (node1[3].data << 1) | 1; + } + /* end of viterbi "loop"; special actions periodically */ + if (s->shistcnt & 7) + return; + /* find node with best metric */ + metric0 = ~0; + metric1 = 0; + for (i = 0; i < 4; i++) + if (node2[i].metric < metric0) { + metric0 = node2[i].metric; + metric1 = node2[i].data; + } + /* decide data, send to decoder */ + s->descram <<= 8; + s->descram |= (metric1 >> 16) & 0xff; /* 16 is about 5*constraint length */ + i = ~(s->descram ^ (s->descram >> 1)); + i ^= (i >> DESCRAM17_TAPSH3) ^ (i >> (DESCRAM17_TAPSH3-DESCRAM17_TAPSH2)); + ch = rev_byte(i); + pktput(s->chan, &ch, 1); + if (logcheck(257)) { + char buf2[9]; + for (i = 0; i < 8; i++) + buf2[i] = '0' + ((ch >> i) & 1); + buf2[8] = 0; + logprintf(257, "fskrx: %s\n", buf2); + } + /* subtract metric */ + s->snracc += metric0 >> SNRESTSHIFT; + for (i = 0; i < 4; i++) { + node2[i].metric -= metric0; + if (node2[i].metric > 0x7fffffff) + node2[i].metric = 0x7fffffff; /* prevent overflow */ + } + /* new parameter estimate */ + estparams(s, metric1 >> (16-ESTSYMBOLS)); + /* SNR estimate */ + s->snrcnt++; + if (s->snrcnt < (1<<(SNRESTSHIFT-3))) + return; + s->snrcnt = 0; + metric0 = isqr(s->params[1]) + isqr(s->params[2]) + isqr(s->params[3]); + metric1 = metric0; + if (!metric1) + metric1 = 1; + snr = -10*M_LOG10E*log(s->snracc / (float)metric1); + logprintf(128, "SNR: signal power %u noise+interference pwr %u S/(N+I) %6.2fdB\n", metric0, s->snracc, snr); + pktsetdcd(s->chan, s->snracc < (metric0 >> 2)); + s->snracc = 0; +} + +static void demodrx(struct demodstate *s, unsigned nsamples) +{ + int16_t *samples; + int16_t curs, nexts, mids; + int32_t gardner; + int corr; + + samples = alloca((nsamples + s->firlen) * sizeof(samples[0])); + audioread(s->chan, samples, nsamples + s->firlen, s->stime); + s->stime += nsamples; + samples += s->firlen; + while (WHICHSAMPLE(s->pll + s->pllinc) < nsamples) { +#if 0 + for (corr = 0; corr < 16; corr++) + printf("%d\n", filter(s, samples, s->pll+corr*s->pllinc/16)); +#endif + curs = filter(s, samples, s->pll); + mids = filter(s, samples, s->pll+s->pllinc/2); + nexts = filter(s, samples, s->pll+s->pllinc); + gardner = ((nexts > 0 ? 1 : -1) - (curs > 0 ? 1 : -1)) * mids; + s->pll += s->pllinc; +#if 0 + corr = (gardner * s->pllinc) >> 20; + s->pll -= corr; +#elif 0 + if (gardner < 0) + s->pll += s->pllinc >> 4; + else + s->pll -= s->pllinc >> 4; +#else + if ((curs > 0) ^ (nexts > 0)) { + if ((curs > 0) ^ (mids > 0)) + s->pll -= s->pllinc >> 5; + if ((nexts > 0) ^ (mids > 0)) + s->pll += s->pllinc >> 5; + } +#endif + viterbieq(s, curs); + } + s->pll -= (nsamples << 16); +} + +static void demoddemodulate(void *state) +{ + struct demodstate *s = (struct demodstate *)state; + + s->stime = audiocurtime(s->chan); + for (;;) + demodrx(s, 256); +} + +static void demodinit(void *state, unsigned int samplerate, unsigned int *bitrate) +{ + struct demodstate *s = (struct demodstate *)state; + float coeff[FILTEROVER][MAXFIRLEN]; + double tmul; + float max1, max2, t, at, f1, f2, f3; + int i, j; + + s->firlen = (samplerate * FILTERSPANBITS + s->bps - 1) / s->bps; + if (s->firlen > MAXFIRLEN) { + logprintf(MLOG_WARNING, "demodfsk: input filter length too long\n"); + s->firlen = MAXFIRLEN; + } + tmul = ((double)s->bps) / FILTEROVER / ((double)samplerate); + switch (s->filtermode) { + case 1: /* root raised cosine */ + for (i = 0; i < FILTEROVER*s->firlen; i++) { + t = (signed)(i - s->firlen*FILTEROVER/2) * tmul; + coeff[((unsigned)i) % FILTEROVER][((unsigned)i) / FILTEROVER] = root_raised_cosine_time(t, RCOSALPHA); + } + break; + + case 2: /* raised cosine */ + for (i = 0; i < FILTEROVER*s->firlen; i++) { + t = (signed)(i - s->firlen*FILTEROVER/2) * tmul; + coeff[((unsigned)i) % FILTEROVER][((unsigned)i) / FILTEROVER] = raised_cosine_time(t, RCOSALPHA); + } + break; + + case 3: /* hamming */ + tmul *= FILTERRELAX; + for (i = 0; i < FILTEROVER*s->firlen; i++) + coeff[((unsigned)i) % FILTEROVER][((unsigned)i) / FILTEROVER] = + sinc((i - (signed)s->firlen*FILTEROVER/2)*tmul) + * hamming((double)i / (double)(FILTEROVER*s->firlen-1)); + break; + + default: /* DF9IC */ + for (i = 0; i < FILTEROVER*s->firlen; i++) { + t = (signed)(i - s->firlen*FILTEROVER/2) * tmul; + coeff[((unsigned)i) % FILTEROVER][((unsigned)i) / FILTEROVER] = df9ic_rxfilter(t); + } + break; + } + max1 = 0; + for (i = 0; i < FILTEROVER; i++) { + max2 = 0; + for (j = 0; j < s->firlen; j++) + max2 += fabs(coeff[i][j]); + if (max2 > max1) + max1 = max2; + } + max2 = ((float)0x7fffffff / (float)0x7fff) / max1; + for (i = 0; i < FILTEROVER; i++) + for (j = 0; j < s->firlen; j++) + s->filter[i][j] = max2 * coeff[i][j]; + s->pllinc = (0x10000 * samplerate + s->bps/2) / s->bps; + s->pll = 0; + s->pllcorr = s->pllinc / 8; + + s->shistcnt = s->snracc = s->snrcnt = 0; + s->params[0] = 0; + s->params[1] = 300; + s->params[2] = 11000; + s->params[3] = 300; + for (i = 0; i < 8; i++) + s->venodes[i].metric = 0x7fffffff; + *bitrate = s->bps; +} + +/* --------------------------------------------------------------------- */ + +struct demodulator fskpspdemodulator = { + NULL, + "fskpsp", + demodparams, + demodconfig, + demodinit, + demoddemodulate, + free +}; + +/* --------------------------------------------------------------------- */ diff --git a/fsk/psp.h b/fsk/psp.h new file mode 100644 index 0000000..07f0a4c --- /dev/null +++ b/fsk/psp.h @@ -0,0 +1,3249 @@ +/* this file is automatically generated, do not edit!! */ + +#define VECLENGTH 3 +#define ESTDATAMASK 255 +#define ESTDATASYMS 8 +#define ESTPARAMS 4 +#define ESTSYMBOLS 6 +#define ESTSHIFT 8 + + +static const int16_t estmat[256][ESTPARAMS*ESTSYMBOLS] = { + /* +a = [ 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ 0.5 0.5 0.5 -0.166667 -0.166667 -0.166667 ; ... + 0.5 2.98023e-08 2.98023e-08 -0.166667 -0.166667 -0.166667 ; ... + 6.70552e-08 0.5 5.21541e-08 -0.166667 -0.166667 -0.166667 ; ... + 2.98023e-08 2.98023e-08 0.5 -0.166667 -0.166667 -0.166667 ]; +*/ + { 128, 128, 128, -42, -42, -42, 128, 0, 0, -42, -42, -42, 0, 128, 0, -42, -42, -42, 0, 0, 128, -42, -42, -42 }, + /* +a = [ 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ 0.5 0.5 1.98682e-08 -1.98682e-08 -1.98682e-08 -1.98682e-08 ; ... + 0.5 1.49012e-08 -0.5 -1.49012e-08 -1.49012e-08 -1.49012e-08 ; ... + 2.23517e-08 0.5 2.23517e-08 -0.166667 -0.166667 -0.166667 ; ... + 0 0 0.5 -0.166667 -0.166667 -0.166667 ]; +*/ + { 128, 128, 0, 0, 0, 0, 128, 0, -127, 0, 0, 0, 0, 128, 0, -42, -42, -42, 0, 0, 127, -42, -42, -42 }, + /* +a = [ 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ 0.5 7.45058e-08 0.5 -1.49012e-08 -1.49012e-08 -1.49012e-08 ; ... + 0.5 -0.5 0.5 -0.166667 -0.166667 -0.166667 ; ... + -1.49012e-08 0.5 -0.5 -1.49012e-08 -1.49012e-08 -1.49012e-08 ; ... + 2.98023e-08 8.9407e-08 0.5 -0.166667 -0.166667 -0.166667 ]; +*/ + { 128, 0, 127, 0, 0, 0, 128, -127, 127, -42, -42, -42, 0, 127, -127, 0, 0, 0, 0, 0, 127, -42, -42, -42 }, + /* +a = [ 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ 0.5 2.23517e-08 -2.23517e-08 0.166667 0.166667 0.166667 ; ... + 0.5 -0.5 -3.27826e-08 2.98023e-09 2.98023e-09 2.98023e-09 ; ... + -2.98023e-08 0.5 -0.5 2.98023e-08 2.98023e-08 2.98023e-08 ; ... + 0 2.98023e-08 0.5 -0.166667 -0.166667 -0.166667 ]; +*/ + { 128, 0, 0, 42, 42, 42, 128, -127, 0, 0, 0, 0, 0, 127, -127, 0, 0, 0, 0, 0, 127, -42, -42, -42 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ -0.166667 0.5 0.5 0.5 -0.166667 -0.166667 ; ... + -0.166667 0.5 2.98023e-08 2.98023e-08 -0.166667 -0.166667 ; ... + -0.166667 6.70552e-08 0.5 5.21541e-08 -0.166667 -0.166667 ; ... + -0.166667 2.98023e-08 2.98023e-08 0.5 -0.166667 -0.166667 ]; +*/ + { -42, 128, 128, 128, -42, -42, -42, 128, 0, 0, -42, -42, -42, 0, 128, 0, -42, -42, -42, 0, 0, 128, -42, -42 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ 0.25 0.5 0.5 0.25 -0.25 -0.25 ; ... + 0 0.5 5.96046e-08 0 -0.25 -0.25 ; ... + 2.98023e-08 2.98023e-08 0.5 2.98023e-08 -0.25 -0.25 ; ... + 0.25 2.98023e-08 5.96046e-08 0.25 -0.25 -0.25 ]; +*/ + { 64, 128, 128, 64, -64, -64, 0, 128, 0, 0, -64, -64, 0, 0, 128, 0, -64, -64, 63, 0, 0, 63, -64, -64 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ 0.25 0.5 0.25 -4.96705e-09 -2.48353e-08 -2.48353e-08 ; ... + 1.49012e-08 0.5 1.49012e-08 -0.5 -1.49012e-08 -1.49012e-08 ; ... + 0.25 7.45058e-09 0.25 -7.45058e-09 -0.25 -0.25 ; ... + 0 0 0 0.5 -0.25 -0.25 ]; +*/ + { 63, 128, 63, 0, 0, 0, 0, 128, 0, -127, 0, 0, 64, 0, 64, 0, -64, -64, 0, 0, 0, 127, -63, -63 }, + /* +a = [ 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ 0.142857 0.5 0.357143 -0.142857 0.0714285 0.0714285 ; ... + -0.142857 0.5 0.142857 -0.357143 -0.0714286 -0.0714286 ; ... + 0.214286 -3.72529e-09 0.285714 -0.214286 -0.142857 -0.142857 ; ... + 0.214286 -1.49012e-08 -0.214286 0.285714 -0.142857 -0.142857 ]; +*/ + { 36, 127, 91, -36, 18, 18, -36, 128, 36, -91, -18, -18, 54, 0, 73, -54, -36, -36, 54, 0, -54, 73, -36, -36 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ 0.25 0.25 0.25 0.25 0 0 ; ... + 0.375 0.125 -0.125 0.125 -0.25 -0.25 ; ... + -0.25 0.25 0.25 -0.25 -7.45058e-09 -7.45058e-09 ; ... + 0.125 -0.125 0.125 0.375 -0.25 -0.25 ]; +*/ + { 64, 64, 64, 64, 0, 0, 96, 32, -32, 31, -64, -64, -64, 64, 64, -64, 0, 0, 32, -32, 32, 96, -64, -64 }, + /* +a = [ 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ 0.2 0.3 0.2 0.1 0.1 0.1 ; ... + 0.3 0.2 -0.2 -0.1 -0.1 -0.1 ; ... + -0.2 0.2 0.3 -0.1 -0.1 -0.1 ; ... + 0.166667 -0.166667 0.166667 0.166667 -0.166667 -0.166667 ]; +*/ + { 51, 76, 51, 25, 25, 25, 76, 51, -51, -25, -25, -25, -51, 51, 76, -25, -25, -25, 42, -42, 42, 42, -42, -42 }, + /* +a = [ 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ 0.214286 0.285714 -1.49012e-08 0.214286 0.142857 0.142857 ; ... + 0.142857 0.357143 -0.5 0.142857 -0.0714286 -0.0714286 ; ... + 0.142857 -0.142857 0.5 -0.357143 -0.0714286 -0.0714286 ; ... + -0.214286 0.214286 0 0.285714 -0.142857 -0.142857 ]; +*/ + { 54, 73, 0, 54, 36, 36, 36, 91, -128, 36, -18, -18, 36, -36, 128, -91, -18, -18, -54, 54, 0, 73, -36, -36 }, + /* +a = [ 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ 0.25 0.25 0 -2.98023e-08 0.25 0.25 ; ... + 0.25 0.25 -0.5 -1.30385e-08 -1.67638e-08 -1.67638e-08 ; ... + -2.98023e-08 -2.98023e-08 0.5 -0.5 2.98023e-08 2.98023e-08 ; ... + 0 0 0 0.5 -0.25 -0.25 ]; +*/ + { 63, 63, 0, 0, 64, 64, 64, 64, -128, 0, 0, 0, 0, 0, 127, -128, 0, 0, 0, 0, 0, 128, -64, -64 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ -0.166667 -0.166667 0.5 0.5 0.5 -0.166667 ; ... + -0.166667 -0.166667 0.5 2.98023e-08 2.98023e-08 -0.166667 ; ... + -0.166667 -0.166667 6.70552e-08 0.5 5.21541e-08 -0.166667 ; ... + -0.166667 -0.166667 2.98023e-08 2.98023e-08 0.5 -0.166667 ]; +*/ + { -42, -42, 128, 128, 128, -42, -42, -42, 128, 0, 0, -42, -42, -42, 0, 128, 0, -42, -42, -42, 0, 0, 128, -42 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ 0.25 -0.25 0.5 0.5 0.25 -0.25 ; ... + 0 -0.25 0.5 5.96046e-08 0 -0.25 ; ... + 2.98023e-08 -0.25 2.98023e-08 0.5 2.98023e-08 -0.25 ; ... + 0.25 -0.25 2.98023e-08 5.96046e-08 0.25 -0.25 ]; +*/ + { 64, -64, 128, 128, 64, -64, 0, -64, 128, 0, 0, -64, 0, -64, 0, 128, 0, -64, 63, -64, 0, 0, 63, -64 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ 0.25 0.25 0.5 0.25 0.25 -0.5 ; ... + -2.98023e-08 2.98023e-08 0.5 -2.98023e-08 2.98023e-08 -0.5 ; ... + 0.25 0 2.98023e-08 0.25 0 -0.5 ; ... + -2.98023e-08 0.25 0 -2.98023e-08 0.25 -0.5 ]; +*/ + { 63, 63, 128, 63, 63, -128, 0, 0, 128, 0, 0, -128, 63, 0, 0, 63, 0, -128, 0, 63, 0, 0, 63, -128 }, + /* +a = [ 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ 0.357143 0.0714285 0.5 0.142857 0.0714285 -0.142857 ; ... + 0.142857 -0.0714286 0.5 -0.142857 -0.0714286 -0.357143 ; ... + 0.285714 -0.142857 -3.72529e-09 0.214286 -0.142857 -0.214286 ; ... + 0.214286 0.142857 1.49012e-08 -0.214286 0.142857 -0.285714 ]; +*/ + { 91, 18, 127, 36, 18, -36, 36, -18, 128, -36, -18, -91, 73, -36, 0, 54, -36, -54, 54, 36, 0, -54, 36, -73 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ 0.125 0.25 0.375 0.25 0.125 -0.125 ; ... + 0.25 2.42144e-08 0.25 2.42144e-08 -0.25 -0.25 ; ... + -0.125 0.25 0.125 0.25 -0.125 -0.375 ; ... + -0.25 0 0.25 0 0.25 -0.25 ]; +*/ + { 32, 64, 96, 64, 32, -32, 63, 0, 63, 0, -64, -64, -32, 64, 32, 64, -32, -96, -64, 0, 64, 0, 64, -64 }, + /* +a = [ 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ 0.25 0.25 0.25 0.25 4.96705e-09 -4.96705e-09 ; ... + 0.25 -1.49012e-08 0.25 -1.49012e-08 -0.5 -1.49012e-08 ; ... + 0 0.25 0 0.25 0 -0.5 ; ... + 0 0 0 0 0.5 -0.5 ]; +*/ + { 64, 64, 64, 64, 0, 0, 64, 0, 64, 0, -128, 0, 0, 64, 0, 64, 0, -128, 0, 0, 0, 0, 128, -128 }, + /* +a = [ 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ 0.25 0.125 0.25 0.125 0.125 0.125 ; ... + 0.25 -0.125 0.25 -0.125 -0.125 -0.125 ; ... + 0.125 0.25 -0.125 0.125 -0.125 -0.25 ; ... + -0.125 0.25 0.125 -0.125 0.125 -0.25 ]; +*/ + { 64, 32, 64, 32, 32, 32, 64, -32, 64, -32, -32, -32, 32, 64, -32, 32, -32, -64, -32, 64, 32, -32, 32, -64 }, + /* +a = [ 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ 0.25 0 0.25 0.25 0 0.25 ; ... + 0.25 -0.25 0.25 0 -0.25 0 ; ... + 0.166667 0.166667 -0.166667 0.166667 -0.166667 -0.166667 ; ... + 0 0.25 0 -0.25 0.25 -0.25 ]; +*/ + { 64, 0, 64, 64, 0, 64, 64, -64, 64, 0, -64, 0, 42, 42, -42, 42, -42, -42, 0, 64, 0, -64, 64, -64 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ 0 0.25 0.25 0.25 0.25 0 ; ... + -0.25 0.375 0.125 -0.125 0.125 -0.25 ; ... + -7.45058e-09 -0.25 0.25 0.25 -0.25 -7.45058e-09 ; ... + -0.25 0.125 -0.125 0.125 0.375 -0.25 ]; +*/ + { 0, 64, 64, 64, 64, 0, -64, 96, 32, -32, 31, -64, 0, -64, 64, 64, -64, 0, -64, 32, -32, 32, 96, -64 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ 0.142857 0.214286 0.285714 0.214286 0.142857 -2.23517e-08 ; ... + 0.0714286 0.357143 0.142857 -0.142857 0.0714286 -0.5 ; ... + -0.142857 -0.214286 0.214286 0.285714 -0.142857 0 ; ... + 0.214286 0.0714286 -0.0714286 0.0714286 0.214286 -0.5 ]; +*/ + { 36, 54, 73, 54, 36, 0, 18, 91, 36, -36, 18, -128, -36, -54, 54, 73, -36, 0, 54, 18, -18, 18, 54, -128 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ 0.125 0.25 0.25 0.125 0.125 0.125 ; ... + -0.125 0.25 0.25 -0.125 -0.125 -0.125 ; ... + 0.125 -0.125 0.125 0.25 -0.125 -0.25 ; ... + -0.125 0.125 -0.125 0.25 0.125 -0.25 ]; +*/ + { 32, 64, 64, 32, 32, 32, -32, 64, 64, -32, -32, -32, 32, -32, 32, 64, -32, -64, -32, 32, -32, 64, 32, -64 }, + /* +a = [ 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ 0.1 0.2 0.3 0.1 0.1 0.2 ; ... + -0.1 0.3 0.2 -0.1 -0.1 -0.2 ; ... + 0.166667 -0.166667 0.166667 0.166667 -0.166667 -0.166667 ; ... + 0.1 0.2 -0.2 0.1 0.1 -0.3 ]; +*/ + { 25, 51, 76, 25, 25, 51, -25, 76, 51, -25, -25, -51, 42, -42, 42, 42, -42, -42, 25, 51, -51, 25, 25, -76 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ 0.166667 0.166667 0.166667 0.166667 0.166667 0.166667 ; ... + 0.25 0 0.25 -0.25 0 -0.25 ; ... + -0.25 0.25 0 0.25 -0.25 0 ; ... + 0 -0.25 0.25 0 0.25 -0.25 ]; +*/ + { 42, 42, 42, 42, 42, 42, 64, 0, 64, -64, 0, -64, -64, 64, 0, 64, -64, 0, 0, -64, 64, 0, 64, -64 }, + /* +a = [ 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ 0.125 0.25 0.125 0.125 0.125 0.25 ; ... + 0.25 0.125 0.125 -0.25 -0.125 -0.125 ; ... + -0.25 0.125 0.125 0.25 -0.125 -0.125 ; ... + 0.125 -0.25 0.125 0.125 0.125 -0.25 ]; +*/ + { 32, 64, 32, 32, 32, 64, 64, 32, 32, -64, -32, -32, -64, 32, 32, 64, -32, -32, 32, -64, 32, 32, 32, -64 }, + /* +a = [ 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ 0.214286 0.142857 0.142857 -1.49012e-08 0.214286 0.285714 ; ... + 0.0714286 0.214286 0.214286 -0.5 0.0714286 -0.0714286 ; ... + 0.142857 -0.0714286 -0.0714286 0.5 -0.357143 -0.142857 ; ... + -0.285714 0.142857 0.142857 0 0.214286 -0.214286 ]; +*/ + { 54, 36, 36, 0, 54, 73, 18, 54, 54, -127, 18, -18, 36, -18, -18, 127, -91, -36, -73, 36, 36, 0, 54, -54 }, + /* +a = [ 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ]; +ahainvah = [ 0.166667 0.166667 0.166667 -1.49012e-08 0 0.5 ; ... + 0.166667 0.166667 0.166667 -0.5 -4.96705e-09 3.47694e-08 ; ... + 0 0 0 0.5 -0.5 -1.49012e-08 ; ... + 0 0 0 2.98023e-08 0.5 -0.5 ]; +*/ + { 42, 42, 42, 0, 0, 128, 42, 42, 42, -128, 0, 0, 0, 0, 0, 127, -127, 0, 0, 0, 0, 0, 127, -128 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ -0.166667 -0.166667 -0.166667 0.5 0.5 0.5 ; ... + -0.166667 -0.166667 -0.166667 0.5 2.98023e-08 2.98023e-08 ; ... + -0.166667 -0.166667 -0.166667 6.70552e-08 0.5 5.21541e-08 ; ... + -0.166667 -0.166667 -0.166667 2.98023e-08 2.98023e-08 0.5 ]; +*/ + { -42, -42, -42, 128, 128, 128, -42, -42, -42, 128, 0, 0, -42, -42, -42, 0, 128, 0, -42, -42, -42, 0, 0, 128 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ 0.25 -0.25 -0.25 0.5 0.5 0.25 ; ... + 0 -0.25 -0.25 0.5 5.96046e-08 0 ; ... + 2.98023e-08 -0.25 -0.25 2.98023e-08 0.5 2.98023e-08 ; ... + 0.25 -0.25 -0.25 2.98023e-08 5.96046e-08 0.25 ]; +*/ + { 64, -64, -64, 128, 128, 64, 0, -64, -64, 128, 0, 0, 0, -64, -64, 0, 128, 0, 63, -64, -64, 0, 0, 63 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ 0.25 0.25 -0.5 0.5 0.25 0.25 ; ... + -2.98023e-08 2.98023e-08 -0.5 0.5 -2.98023e-08 2.98023e-08 ; ... + 0.25 0 -0.5 2.98023e-08 0.25 0 ; ... + -2.98023e-08 0.25 -0.5 0 -2.98023e-08 0.25 ]; +*/ + { 63, 63, -128, 128, 63, 63, 0, 0, -128, 128, 0, 0, 63, 0, -128, 0, 63, 0, 0, 63, -128, 0, 0, 63 }, + /* +a = [ 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ 0.357143 0.0714285 -0.142857 0.5 0.142857 0.0714285 ; ... + 0.142857 -0.0714286 -0.357143 0.5 -0.142857 -0.0714286 ; ... + 0.285714 -0.142857 -0.214286 -3.72529e-09 0.214286 -0.142857 ; ... + 0.214286 0.142857 -0.285714 1.49012e-08 -0.214286 0.142857 ]; +*/ + { 91, 18, -36, 127, 36, 18, 36, -18, -91, 128, -36, -18, 73, -36, -54, 0, 54, -36, 54, 36, -73, 0, -54, 36 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ 0.5 0.25 0 0 0.25 0 ; ... + 0.5 0 -0.25 0 0 -0.25 ; ... + 0.5 0.25 -0.25 -0.5 0.25 -0.25 ; ... + 0.5 0 0 -0.5 0 0 ]; +*/ + { 128, 64, 0, 0, 64, 0, 128, 0, -64, 0, 0, -64, 128, 64, -64, -128, 64, -64, 128, 0, 0, -128, 0, 0 }, + /* +a = [ 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ 0.285714 0.214286 0.142857 0.214286 1.49012e-08 0.142857 ; ... + 0.357143 0.142857 -0.0714286 0.142857 -0.5 -0.0714286 ; ... + 0.214286 0.285714 -0.142857 -0.214286 0 -0.142857 ; ... + 0.142857 0.357143 0.0714286 -0.142857 -0.5 0.0714286 ]; +*/ + { 73, 54, 36, 54, 0, 36, 91, 36, -18, 36, -127, -18, 54, 73, -36, -54, 0, -36, 36, 91, 18, -36, -128, 18 }, + /* +a = [ 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ 0.2 0.1 0.1 0.3 0.2 0.1 ; ... + 0.3 -0.1 -0.1 0.2 -0.2 -0.1 ; ... + 0.166667 0.166667 -0.166667 -0.166667 0.166667 -0.166667 ; ... + 0.2 0.1 0.1 -0.2 -0.3 0.1 ]; +*/ + { 51, 25, 25, 76, 51, 25, 76, -25, -25, 51, -51, -25, 42, 42, -42, -42, 42, -42, 51, 25, 25, -51, -76, 25 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ -0.125 0.125 0.25 0.375 0.25 0.125 ; ... + -0.25 0.25 2.42144e-08 0.25 2.42144e-08 -0.25 ; ... + -0.375 -0.125 0.25 0.125 0.25 -0.125 ; ... + -0.25 -0.25 0 0.25 0 0.25 ]; +*/ + { -32, 32, 64, 96, 64, 32, -64, 63, 0, 63, 0, -64, -96, -32, 64, 32, 64, -32, -64, -64, 0, 64, 0, 64 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ 0 0 0.25 0.5 0.25 0 ; ... + -0.25 0 0 0.5 0 -0.25 ; ... + -0.25 -0.5 0.25 0.5 0.25 -0.25 ; ... + 0 -0.5 0 0.5 0 0 ]; +*/ + { 0, 0, 64, 128, 64, 0, -64, 0, 0, 128, 0, -64, -64, -128, 64, 128, 64, -64, 0, -128, 0, 128, 0, 0 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ -2.98023e-08 0.25 0.25 0.25 0.25 0 ; ... + -1.30385e-08 0.25 -1.67638e-08 0.25 -1.67638e-08 -0.5 ; ... + 0.5 2.98023e-08 -2.98023e-08 2.98023e-08 -2.98023e-08 -0.5 ; ... + 0.5 0 -0.25 0 -0.25 0 ]; +*/ + { 0, 63, 64, 63, 64, 0, 0, 64, 0, 64, 0, -128, 128, 0, 0, 0, 0, -127, 128, 0, -64, 0, -64, 0 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ 0.166667 0.166667 0.166667 0.166667 0.166667 0.166667 ; ... + 0 0.25 0 0.25 -0.25 -0.25 ; ... + -0.25 0.25 0.25 0 0 -0.25 ; ... + -0.25 0 0.25 0.25 -0.25 0 ]; +*/ + { 42, 42, 42, 42, 42, 42, 0, 64, 0, 64, -64, -64, -64, 64, 64, 0, 0, -64, -64, 0, 64, 64, -64, 0 }, + /* +a = [ 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ 0.142857 0.214286 1.49012e-08 0.142857 0.285714 0.214286 ; ... + 0.142857 0.214286 -1.49012e-08 0.142857 -0.214286 -0.285714 ; ... + -0.0714286 0.142857 0.5 -0.0714286 -0.142857 -0.357143 ; ... + 0.0714286 -0.142857 0.5 0.0714286 -0.357143 -0.142857 ]; +*/ + { 36, 54, 0, 36, 73, 54, 36, 54, 0, 36, -54, -73, -18, 36, 127, -18, -36, -91, 18, -36, 127, 18, -91, -36 }, + /* +a = [ 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ 0.25 0 0 0.25 0.25 0.25 ; ... + 0.166667 0.166667 -0.166667 0.166667 -0.166667 -0.166667 ; ... + 0 0.25 0.25 -0.25 0 -0.25 ; ... + -0.25 0.25 0.25 0 -0.25 0 ]; +*/ + { 64, 0, 0, 64, 64, 64, 42, 42, -42, 42, -42, -42, 0, 64, 64, -64, 0, -64, -64, 64, 64, 0, -64, 0 }, + /* +a = [ 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ 0.0714285 0.0714285 -0.142857 0.357143 0.5 0.142857 ; ... + 0.142857 0.142857 -0.285714 0.214286 0 -0.214286 ; ... + 0.142857 0.142857 0.214286 -0.285714 7.45058e-09 -0.214286 ; ... + 0.0714286 0.0714286 0.357143 -0.142857 -0.5 0.142857 ]; +*/ + { 18, 18, -36, 91, 128, 36, 36, 36, -73, 54, 0, -54, 36, 36, 54, -73, 0, -54, 18, 18, 91, -36, -128, 36 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ 0 0 0.25 0.25 0.25 0.25 ; ... + -0.25 -0.25 0.375 0.125 -0.125 0.125 ; ... + -7.45058e-09 -7.45058e-09 -0.25 0.25 0.25 -0.25 ; ... + -0.25 -0.25 0.125 -0.125 0.125 0.375 ]; +*/ + { 0, 0, 64, 64, 64, 64, -64, -64, 96, 32, -32, 31, 0, 0, -64, 64, 64, -64, -64, -64, 32, -32, 32, 96 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ 0.142857 -2.23517e-08 0.214286 0.285714 0.214286 0.142857 ; ... + 0.0714286 -0.5 0.357143 0.142857 -0.142857 0.0714286 ; ... + -0.142857 0 -0.214286 0.214286 0.285714 -0.142857 ; ... + 0.214286 -0.5 0.0714286 -0.0714286 0.0714286 0.214286 ]; +*/ + { 36, 0, 54, 73, 54, 36, 18, -128, 91, 36, -36, 18, -36, 0, -54, 54, 73, -36, 54, -128, 18, -18, 18, 54 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ 1.49012e-08 0.142857 0.214286 0.285714 0.214286 0.142857 ; ... + -0.5 -0.0714286 0.142857 0.357143 0.142857 -0.0714286 ; ... + 0 -0.142857 -0.214286 0.214286 0.285714 -0.142857 ; ... + -0.5 0.0714286 -0.142857 0.142857 0.357143 0.0714286 ]; +*/ + { 0, 36, 54, 73, 54, 36, -127, -18, 36, 91, 36, -18, 0, -36, -54, 54, 73, -36, -128, 18, -36, 36, 91, 18 }, + /* +a = [ 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ 0.166667 0.166667 0.166667 0.166667 0.166667 0.166667 ; ... + 0 -0.25 0.25 0.25 0 -0.25 ; ... + -0.25 0 0 0.25 0.25 -0.25 ; ... + -0.25 -0.25 0.25 0 0.25 0 ]; +*/ + { 42, 42, 42, 42, 42, 42, 0, -64, 64, 64, 0, -64, -64, 0, 0, 64, 64, -64, -64, -64, 64, 0, 64, 0 }, + /* +a = [ 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ 0.142857 0.285714 0.142857 0.214286 1.49012e-08 0.214286 ; ... + 0.142857 -0.214286 0.142857 0.214286 -1.49012e-08 -0.285714 ; ... + -0.0714286 -0.142857 -0.0714286 0.142857 0.5 -0.357143 ; ... + 0.0714286 -0.357143 0.0714286 -0.142857 0.5 -0.142857 ]; +*/ + { 36, 73, 36, 54, 0, 54, 36, -54, 36, 54, 0, -73, -18, -36, -18, 36, 127, -91, 18, -91, 18, -36, 127, -36 }, + /* +a = [ 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ 0.25 0 0 0.25 0 0.5 ; ... + 0 0 0.5 0 0 -0.5 ; ... + 0 0.25 0 0 0.25 -0.5 ; ... + -0.25 0.25 0.5 -0.25 0.25 -0.5 ]; +*/ + { 64, 0, 0, 64, 0, 128, 0, 0, 128, 0, 0, -128, 0, 64, 0, 0, 64, -128, -64, 64, 128, -64, 64, -128 }, + /* +a = [ 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ -0.142857 0.0714285 0.142857 0.5 0.0714285 0.357143 ; ... + 0.285714 -0.142857 0.214286 0 -0.142857 -0.214286 ; ... + 0.214286 0.142857 -0.214286 7.45058e-09 0.142857 -0.285714 ; ... + 0.357143 0.0714286 0.142857 -0.5 0.0714286 -0.142857 ]; +*/ + { -36, 18, 36, 128, 18, 91, 73, -36, 54, 0, -36, -54, 54, 36, -54, 0, 36, -73, 91, 18, 36, -128, 18, -36 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ 0.166667 0.166667 0.166667 0.166667 0.166667 0.166667 ; ... + -0.25 0.25 0 0.25 -0.25 0 ; ... + 0 -0.25 0.25 0 0.25 -0.25 ; ... + -0.25 0 -0.25 0.25 0 0.25 ]; +*/ + { 42, 42, 42, 42, 42, 42, -64, 64, 0, 64, -64, 0, 0, -64, 64, 0, 64, -64, -64, 0, -64, 64, 0, 64 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ 0.142857 0.214286 0.285714 1.49012e-08 0.214286 0.142857 ; ... + -0.0714286 0.142857 -0.142857 0.5 -0.357143 -0.0714286 ; ... + -0.142857 -0.214286 0.214286 2.98023e-08 0.285714 -0.142857 ; ... + 0.0714286 -0.142857 -0.357143 0.5 -0.142857 0.0714286 ]; +*/ + { 36, 54, 73, 0, 54, 36, -18, 36, -36, 127, -91, -18, -36, -54, 54, 0, 73, -36, 18, -36, -91, 127, -36, 18 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ 0.25 0.25 0.25 0 0 0.25 ; ... + -0.166667 0.166667 0.166667 0.166667 -0.166667 -0.166667 ; ... + 0 -0.25 0 0.25 0.25 -0.25 ; ... + -0.25 0 -0.25 0.25 0.25 0 ]; +*/ + { 64, 64, 64, 0, 0, 64, -42, 42, 42, 42, -42, -42, 0, -64, 0, 64, 64, -64, -64, 0, -64, 64, 64, 0 }, + /* +a = [ 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ 0.0714285 0.142857 0.5 -0.142857 0.0714285 0.357143 ; ... + -0.142857 0.214286 0 0.285714 -0.142857 -0.214286 ; ... + 0.142857 -0.214286 7.45058e-09 0.214286 0.142857 -0.285714 ; ... + 0.0714286 0.142857 -0.5 0.357143 0.0714286 -0.142857 ]; +*/ + { 18, 36, 128, -36, 18, 91, -36, 54, 0, 73, -36, -54, 36, -54, 0, 54, 36, -73, 18, 36, -128, 91, 18, -36 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ 0.25 0.25 0 0 0.25 0.25 ; ... + 0.125 -0.125 0.25 0.25 -0.375 -0.125 ; ... + -0.25 0.25 7.45058e-09 7.45058e-09 0.25 -0.25 ; ... + -0.125 -0.375 0.25 0.25 -0.125 0.125 ]; +*/ + { 64, 64, 0, 0, 64, 64, 32, -31, 64, 64, -96, -32, -64, 64, 0, 0, 64, -64, -32, -96, 64, 64, -32, 32 }, + /* +a = [ 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ 0.142857 0.5 -0.0714286 -0.0714286 0.142857 0.357143 ; ... + 0.214286 -2.98023e-08 0.142857 0.142857 -0.285714 -0.214286 ; ... + -0.285714 7.45058e-09 0.142857 0.142857 0.214286 -0.214286 ; ... + 0.0714286 -0.5 0.214286 0.214286 0.0714286 -0.0714286 ]; +*/ + { 36, 128, -18, -18, 36, 91, 54, 0, 36, 36, -73, -54, -73, 0, 36, 36, 54, -54, 18, -128, 54, 54, 18, -18 }, + /* +a = [ 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ]; +ahainvah = [ 0.5 -5.96046e-08 -5.96046e-08 -5.96046e-08 -5.96046e-08 0.5 ; ... + 2.98023e-08 0.166667 0.166667 0.166667 -0.5 -2.98023e-08 ; ... + -1.65568e-08 1.65568e-08 1.65568e-08 1.65568e-08 0.5 -0.5 ; ... + -0.5 0.166667 0.166667 0.166667 5.96046e-08 0 ]; +*/ + { 128, 0, 0, 0, 0, 127, 0, 42, 42, 42, -128, 0, 0, 0, 0, 0, 128, -127, -128, 42, 42, 42, 0, 0 }, + /* +a = [ 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ 0.5 -0.166667 -0.166667 -0.166667 0.5 0.5 ; ... + 2.98023e-08 -0.166667 -0.166667 -0.166667 0.5 2.98023e-08 ; ... + 5.21541e-08 -0.166667 -0.166667 -0.166667 6.70552e-08 0.5 ; ... + 0.5 -0.166667 -0.166667 -0.166667 2.98023e-08 2.98023e-08 ]; +*/ + { 128, -42, -42, -42, 128, 128, 0, -42, -42, -42, 128, 0, 0, -42, -42, -42, 0, 128, 128, -42, -42, -42, 0, 0 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ 0.25 0.5 -0.25 -0.25 0.5 0.25 ; ... + 1.49012e-08 4.47035e-08 -0.25 -0.25 0.5 1.49012e-08 ; ... + 0.25 2.98023e-08 -0.25 -0.25 4.47035e-08 0.25 ; ... + 2.98023e-08 0.5 -0.25 -0.25 8.9407e-08 2.98023e-08 ]; +*/ + { 64, 128, -63, -63, 128, 64, 0, 0, -64, -64, 128, 0, 63, 0, -64, -64, 0, 63, 0, 128, -63, -63, 0, 0 }, + /* +a = [ 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ 0.357143 0.142857 -0.0714286 -0.0714286 0.5 0.142857 ; ... + 0.0714286 -0.0714286 -0.214286 -0.214286 0.5 -0.0714286 ; ... + 0.214286 -0.214286 -0.142857 -0.142857 7.45058e-09 0.285714 ; ... + 0.214286 0.285714 -0.142857 -0.142857 0 -0.214286 ]; +*/ + { 91, 36, -18, -18, 128, 36, 18, -18, -54, -54, 128, -18, 54, -54, -36, -36, 0, 73, 54, 73, -36, -36, 0, -54 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ 0.25 0.25 0.5 -0.5 0.25 0.25 ; ... + 0.25 0 0 -0.5 0.25 0 ; ... + 0 0.25 0 -0.5 0 0.25 ; ... + 0 0 0.5 -0.5 0 0 ]; +*/ + { 64, 64, 128, -128, 64, 64, 64, 0, 0, -128, 64, 0, 0, 64, 0, -128, 0, 64, 0, 0, 128, -128, 0, 0 }, + /* +a = [ 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ 0.375 0.25 0.125 -0.125 0.125 0.25 ; ... + 0.25 2.42144e-08 -0.25 -0.25 0.25 2.42144e-08 ; ... + 0.125 0.25 -0.125 -0.375 -0.125 0.25 ; ... + 0.25 0 0.25 -0.25 -0.25 0 ]; +*/ + { 96, 64, 32, -32, 32, 64, 63, 0, -64, -64, 63, 0, 32, 64, -32, -96, -32, 64, 64, 0, 64, -64, -64, 0 }, + /* +a = [ 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ 0.25 0.25 0.25 0 0.25 0 ; ... + 0.25 0 0 -0.25 0.25 -0.25 ; ... + 0.166667 0.166667 -0.166667 -0.166667 -0.166667 0.166667 ; ... + 0 0.25 0.25 -0.25 0 -0.25 ]; +*/ + { 64, 64, 64, 0, 64, 0, 64, 0, 0, -64, 64, -64, 42, 42, -42, -42, -42, 42, 0, 64, 64, -64, 0, -64 }, + /* +a = [ 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ 0.25 0.125 0.125 0.125 0.25 0.125 ; ... + 0.25 -0.125 -0.125 -0.125 0.25 -0.125 ; ... + 0.125 0.125 -0.25 -0.125 -0.125 0.25 ; ... + 0.125 0.125 0.25 -0.125 -0.125 -0.25 ]; +*/ + { 64, 32, 32, 32, 64, 32, 64, -32, -32, -32, 64, -32, 32, 32, -64, -32, -32, 64, 32, 32, 64, -32, -32, -64 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ -0.5 0.25 0.25 0.5 0.25 0.25 ; ... + -0.5 0.25 0 0 0.25 0 ; ... + -0.5 0 0.25 0 0 0.25 ; ... + -0.5 0 0 0.5 0 0 ]; +*/ + { -128, 64, 64, 128, 64, 64, -128, 64, 0, 0, 64, 0, -128, 0, 64, 0, 0, 64, -128, 0, 0, 128, 0, 0 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ 0.166667 0.5 0.166667 0 2.98023e-08 0.166667 ; ... + 8.9407e-08 0.5 8.9407e-08 -0.5 -5.96046e-08 8.9407e-08 ; ... + 0.166667 0.5 0.166667 -0.5 -0.5 0.166667 ; ... + 0 0.5 0 0 -0.5 0 ]; +*/ + { 42, 128, 42, 0, 0, 42, 0, 127, 0, -128, 0, 0, 42, 128, 42, -128, -128, 42, 0, 128, 0, 0, -128, 0 }, + /* +a = [ 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ 0.214286 0.285714 0.142857 -1.49012e-08 0.214286 0.142857 ; ... + 0.142857 0.357143 -0.0714286 -0.5 0.142857 -0.0714286 ; ... + 0.357143 0.142857 0.0714286 -0.5 -0.142857 0.0714286 ; ... + 0.285714 0.214286 -0.142857 0 -0.214286 -0.142857 ]; +*/ + { 54, 73, 36, 0, 54, 36, 36, 91, -18, -128, 36, -18, 91, 36, 18, -128, -36, 18, 73, 54, -36, 0, -54, -36 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ 0.142857 0.214286 0.285714 0.214286 0.142857 1.49012e-08 ; ... + 0.0714286 0.357143 0.142857 -0.142857 0.0714286 -0.5 ; ... + -0.142857 0.285714 0.214286 -0.214286 -0.142857 2.98023e-08 ; ... + -0.0714286 0.142857 0.357143 0.142857 -0.0714286 -0.5 ]; +*/ + { 36, 54, 73, 54, 36, 0, 18, 91, 36, -36, 18, -127, -36, 73, 54, -54, -36, 0, -18, 36, 91, 36, -18, -127 }, + /* +a = [ 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ 0.166667 0.166667 0.166667 0.166667 0.166667 0.166667 ; ... + 0.25 0.25 0 -0.25 0 -0.25 ; ... + 0 0.25 0.25 -0.25 -0.25 0 ; ... + 0.25 0 0.25 0 -0.25 -0.25 ]; +*/ + { 42, 42, 42, 42, 42, 42, 64, 64, 0, -64, 0, -64, 0, 64, 64, -64, -64, 0, 64, 0, 64, 0, -64, -64 }, + /* +a = [ 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ 0.125 0.125 0.125 0.25 0.25 0.125 ; ... + 0.125 0.25 -0.125 -0.125 0.125 -0.25 ; ... + 0.125 0.125 0.125 -0.25 -0.25 0.125 ; ... + -0.125 0.25 0.125 0.125 -0.125 -0.25 ]; +*/ + { 32, 32, 32, 64, 64, 32, 32, 64, -32, -32, 32, -64, 32, 32, 32, -64, -64, 32, -32, 64, 32, 32, -32, -64 }, + /* +a = [ 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ 0.1 0.1 0.1 0.2 0.3 0.2 ; ... + 0.166667 0.166667 -0.166667 -0.166667 0.166667 -0.166667 ; ... + 0.1 0.1 0.1 -0.3 -0.2 0.2 ; ... + 0.1 0.1 0.1 0.2 -0.2 -0.3 ]; +*/ + { 25, 25, 25, 51, 76, 51, 42, 42, -42, -42, 42, -42, 25, 25, 25, -76, -51, 51, 25, 25, 25, 51, -51, -76 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ -1.49012e-08 -1.49012e-08 -1.49012e-08 0.25 0.5 0.25 ; ... + -0.25 -0.25 0.5 -1.49012e-08 1.49012e-08 -1.49012e-08 ; ... + -0.25 -0.25 -1.49012e-08 0.25 1.49012e-08 0.25 ; ... + 0 0 -0.5 0 0.5 0 ]; +*/ + { 0, 0, 0, 64, 128, 64, -64, -64, 128, 0, 0, 0, -64, -64, 0, 63, 0, 63, 0, 0, -128, 0, 128, 0 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ 0.125 -0.125 0.125 0.25 0.375 0.25 ; ... + -0.25 -0.25 0.25 2.42144e-08 0.25 2.42144e-08 ; ... + -0.125 -0.375 -0.125 0.25 0.125 0.25 ; ... + 0.25 -0.25 -0.25 0 0.25 0 ]; +*/ + { 32, -32, 32, 64, 96, 64, -64, -64, 63, 0, 63, 0, -32, -96, -32, 64, 32, 64, 64, -64, -64, 0, 64, 0 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ 0.166667 0 2.98023e-08 0.166667 0.5 0.166667 ; ... + 8.9407e-08 -0.5 -5.96046e-08 8.9407e-08 0.5 8.9407e-08 ; ... + 0.166667 -0.5 -0.5 0.166667 0.5 0.166667 ; ... + 0 0 -0.5 0 0.5 0 ]; +*/ + { 42, 0, 0, 42, 128, 42, 0, -128, 0, 0, 127, 0, 42, -128, -128, 42, 128, 42, 0, 0, -128, 0, 128, 0 }, + /* +a = [ 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ 0.214286 -1.49012e-08 0.214286 0.142857 0.285714 0.142857 ; ... + 0.142857 -0.5 0.142857 -0.0714286 0.357143 -0.0714286 ; ... + 0.357143 -0.5 -0.142857 0.0714286 0.142857 0.0714286 ; ... + 0.285714 0 -0.214286 -0.142857 0.214286 -0.142857 ]; +*/ + { 54, 0, 54, 36, 73, 36, 36, -128, 36, -18, 91, -18, 91, -128, -36, 18, 36, 18, 73, 0, -54, -36, 54, -36 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ 7.45058e-09 6.70552e-08 0.25 0.25 0.25 0.25 ; ... + 0.5 -4.47035e-08 -4.47035e-08 -0.25 -4.47035e-08 -0.25 ; ... + 0.5 0.5 -0.25 -0.25 -0.25 -0.25 ; ... + -2.98023e-08 0.5 2.98023e-08 -0.25 2.98023e-08 -0.25 ]; +*/ + { 0, 0, 64, 64, 64, 64, 128, 0, 0, -63, 0, -63, 128, 127, -64, -63, -64, -63, 0, 127, 0, -63, 0, -63 }, + /* +a = [ 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ 0 0 0.25 0.25 0.25 0.25 ; ... + 0.5 -0.5 0 0 0 0 ; ... + 0.5 0 -0.25 0 -0.25 0 ; ... + 0 0.5 0 -0.25 0 -0.25 ]; +*/ + { 0, 0, 64, 64, 64, 64, 128, -128, 0, 0, 0, 0, 128, 0, -64, 0, -64, 0, 0, 128, 0, -64, 0, -64 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ 0.125 0.125 0.125 0.25 0.25 0.125 ; ... + -0.25 0.125 0.25 -0.125 0.125 -0.125 ; ... + -0.25 -0.125 0.25 0.125 -0.125 0.125 ; ... + -0.125 -0.125 -0.125 0.25 0.25 -0.125 ]; +*/ + { 32, 32, 32, 64, 64, 32, -64, 32, 64, -32, 32, -32, -64, -32, 64, 32, -32, 32, -32, -32, -32, 64, 64, -32 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ 0.166667 0.166667 0.166667 0.166667 0.166667 0.166667 ; ... + -0.25 0 0.25 0 0.25 -0.25 ; ... + -0.25 -0.25 0.25 0.25 0 0 ; ... + 0 -0.25 0 0.25 0.25 -0.25 ]; +*/ + { 42, 42, 42, 42, 42, 42, -64, 0, 64, 0, 64, -64, -64, -64, 64, 64, 0, 0, 0, -64, 0, 64, 64, -64 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ 0.25 0.25 7.45058e-09 6.70552e-08 0.25 0.25 ; ... + -0.25 -4.47035e-08 0.5 -4.47035e-08 -4.47035e-08 -0.25 ; ... + -0.25 -0.25 0.5 0.5 -0.25 -0.25 ; ... + -0.25 2.98023e-08 -2.98023e-08 0.5 2.98023e-08 -0.25 ]; +*/ + { 64, 64, 0, 0, 64, 64, -63, 0, 128, 0, 0, -63, -63, -64, 128, 127, -64, -63, -63, 0, 0, 127, 0, -63 }, + /* +a = [ 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ 0 0.25 0 0 0.25 0.5 ; ... + 0 0 0.5 0 0 -0.5 ; ... + 0.25 -0.25 0.5 0.25 -0.25 -0.5 ; ... + 0.25 0 0 0.25 0 -0.5 ]; +*/ + { 0, 64, 0, 0, 64, 128, 0, 0, 128, 0, 0, -128, 64, -64, 128, 64, -64, -128, 64, 0, 0, 64, 0, -128 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ 0.25 0 0 0.25 0.25 0.25 ; ... + 0 0.25 0.25 -0.25 0 -0.25 ; ... + -0.25 0.25 0.25 0 -0.25 0 ; ... + -0.166667 -0.166667 0.166667 0.166667 0.166667 -0.166667 ]; +*/ + { 64, 0, 0, 64, 64, 64, 0, 64, 64, -64, 0, -64, -64, 64, 64, 0, -64, 0, -42, -42, 42, 42, 42, -42 }, + /* +a = [ 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ 0.25 0.125 -0.125 0.125 0.25 0.375 ; ... + -2.42144e-08 0.25 0.25 -0.25 -2.42144e-08 -0.25 ; ... + -0.25 0.125 0.375 0.125 -0.25 -0.125 ; ... + 0 -0.25 0.25 0.25 0 -0.25 ]; +*/ + { 64, 32, -32, 32, 64, 96, 0, 64, 64, -63, 0, -63, -64, 32, 96, 32, -64, -32, 0, -64, 64, 64, 0, -64 }, + /* +a = [ 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ 0.142857 -0.0714286 -0.0714286 0.142857 0.5 0.357143 ; ... + 0.214286 0.142857 0.142857 -0.285714 -2.6077e-08 -0.214286 ; ... + 0.0714286 0.214286 0.214286 0.0714286 -0.5 -0.0714286 ; ... + -0.285714 0.142857 0.142857 0.214286 1.49012e-08 -0.214286 ]; +*/ + { 36, -18, -18, 36, 128, 91, 54, 36, 36, -73, 0, -54, 18, 54, 54, 18, -128, -18, -73, 36, 36, 54, 0, -54 }, + /* +a = [ 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ]; +ahainvah = [ -5.96046e-08 -5.96046e-08 -5.96046e-08 -5.96046e-08 0.5 0.5 ; ... + 0.166667 0.166667 0.166667 -0.5 1.49012e-08 -1.49012e-08 ; ... + 0.166667 0.166667 0.166667 4.96705e-08 -0.5 9.93411e-09 ; ... + 2.98023e-08 2.98023e-08 2.98023e-08 0.5 0 -0.5 ]; +*/ + { 0, 0, 0, 0, 127, 128, 42, 42, 42, -128, 0, 0, 42, 42, 42, 0, -127, 0, 0, 0, 0, 128, 0, -128 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ]; +ahainvah = [ 5.96046e-08 5.96046e-08 5.96046e-08 0.5 5.96046e-08 0.5 ; ... + -0.166667 -0.166667 -0.166667 0.5 5.96046e-08 0 ; ... + -8.9407e-08 -8.9407e-08 -8.9407e-08 -0.5 0.5 2.98023e-08 ; ... + -0.166667 -0.166667 -0.166667 0.5 -0.5 0.5 ]; +*/ + { 0, 0, 0, 127, 0, 128, -42, -42, -42, 127, 0, 0, 0, 0, 0, -127, 127, 0, -42, -42, -42, 127, -127, 127 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ]; +ahainvah = [ 0.25 0 0 0.25 0.25 0.25 ; ... + 0.125 -0.25 -0.25 0.375 0.125 -0.125 ; ... + -0.25 -7.45058e-09 -7.45058e-09 -0.25 0.25 0.25 ; ... + 0.375 -0.25 -0.25 0.125 -0.125 0.125 ]; +*/ + { 64, 0, 0, 64, 64, 64, 31, -64, -64, 96, 32, -32, -64, 0, 0, -64, 64, 64, 96, -64, -64, 32, -32, 32 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ]; +ahainvah = [ 0 0.25 0 0.25 0.25 0.25 ; ... + -0.25 0 -0.25 0.25 0.25 0 ; ... + 0.166667 -0.166667 -0.166667 -0.166667 0.166667 0.166667 ; ... + -0.25 0.25 -0.25 0 0 0.25 ]; +*/ + { 0, 64, 0, 64, 64, 64, -64, 0, -64, 64, 64, 0, 42, -42, -42, -42, 42, 42, -64, 64, -64, 0, 0, 64 }, + /* +a = [ 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ]; +ahainvah = [ 0.142857 0.214286 1.49012e-08 0.285714 0.214286 0.142857 ; ... + -0.0714286 0.142857 -0.5 0.357143 0.142857 -0.0714286 ; ... + 0.142857 -0.285714 0 -0.214286 0.214286 0.142857 ; ... + 0.0714286 0.357143 -0.5 0.142857 -0.142857 0.0714286 ]; +*/ + { 36, 54, 0, 73, 54, 36, -18, 36, -127, 91, 36, -18, 36, -73, 0, -54, 54, 36, 18, 91, -128, 36, -36, 18 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ]; +ahainvah = [ 0.142857 1.49012e-08 0.214286 0.142857 0.214286 0.285714 ; ... + 0.0714286 -0.5 -0.142857 0.0714286 0.357143 0.142857 ; ... + -0.142857 2.98023e-08 -0.214286 -0.142857 0.285714 0.214286 ; ... + -0.0714286 -0.5 0.142857 -0.0714286 0.142857 0.357143 ]; +*/ + { 36, 0, 54, 36, 54, 73, 18, -127, -36, 18, 91, 36, -36, 0, -54, -36, 73, 54, -18, -127, 36, -18, 36, 91 }, + /* +a = [ 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ]; +ahainvah = [ 0.166667 0.166667 0.166667 0.166667 0.166667 0.166667 ; ... + 0.25 -0.25 -0.25 0 0.25 0 ; ... + 0 0 -0.25 -0.25 0.25 0.25 ; ... + 0.25 -0.25 0 -0.25 0 0.25 ]; +*/ + { 42, 42, 42, 42, 42, 42, 64, -64, -64, 0, 64, 0, 0, 0, -64, -64, 64, 64, 64, -64, 0, -64, 0, 64 }, + /* +a = [ 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ]; +ahainvah = [ 7.45058e-09 0.142857 0.214286 0.285714 0.214286 0.142857 ; ... + 0.5 -0.214286 -0.0714286 0.0714286 -0.0714285 -0.214286 ; ... + 1.49012e-08 0.142857 -0.285714 -0.214286 0.214286 0.142857 ; ... + 0.5 -0.0714286 0.142857 -0.142857 -0.357143 -0.0714286 ]; +*/ + { 0, 36, 54, 73, 54, 36, 128, -54, -18, 18, -18, -54, 0, 36, -73, -54, 54, 36, 127, -18, 36, -36, -91, -18 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ]; +ahainvah = [ 0.125 0.125 0.125 0.25 0.125 0.25 ; ... + -0.25 0.125 -0.125 0.125 0.25 -0.125 ; ... + -0.25 -0.125 0.125 -0.125 0.25 0.125 ; ... + -0.125 -0.125 -0.125 0.25 -0.125 0.25 ]; +*/ + { 32, 32, 32, 64, 32, 64, -64, 32, -32, 32, 64, -32, -64, -32, 32, -32, 64, 32, -32, -32, -32, 64, -32, 64 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ]; +ahainvah = [ 0.166667 0.166667 0.166667 0.166667 0.166667 0.166667 ; ... + -0.25 0 -0.25 0.25 0.25 0 ; ... + -0.25 -0.25 0 0 0.25 0.25 ; ... + 0 -0.25 -0.25 0.25 0 0.25 ]; +*/ + { 42, 42, 42, 42, 42, 42, -64, 0, -64, 64, 64, 0, -64, -64, 0, 0, 64, 64, 0, -64, -64, 64, 0, 64 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ]; +ahainvah = [ 0.25 0.25 0.25 0.25 7.45058e-09 6.70552e-08 ; ... + -0.25 -4.47035e-08 -0.25 -4.47035e-08 0.5 -4.47035e-08 ; ... + -0.25 -0.25 -0.25 -0.25 0.5 0.5 ; ... + -0.25 2.98023e-08 -0.25 2.98023e-08 -2.98023e-08 0.5 ]; +*/ + { 64, 64, 64, 64, 0, 0, -63, 0, -63, 0, 128, 0, -63, -64, -63, -64, 128, 127, -63, 0, -63, 0, 0, 127 }, + /* +a = [ 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ]; +ahainvah = [ 0 0.25 0.5 0.25 0 0 ; ... + 0 0 -0.5 0 0.5 0 ; ... + 0.25 -0.25 -0.5 -0.25 0.5 0.25 ; ... + 0.25 0 -0.5 0 0 0.25 ]; +*/ + { 0, 64, 128, 64, 0, 0, 0, 0, -128, 0, 128, 0, 64, -64, -128, -64, 128, 64, 64, 0, -128, 0, 0, 64 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ]; +ahainvah = [ 0.5 0 0.25 0 0 0.25 ; ... + -0.5 0.25 -0.25 0.5 0.25 -0.25 ; ... + -0.5 0.25 0 0 0.25 0 ; ... + -0.5 0 0 0.5 0 0 ]; +*/ + { 128, 0, 64, 0, 0, 64, -128, 64, -64, 128, 64, -64, -128, 64, 0, 0, 64, 0, -128, 0, 0, 128, 0, 0 }, + /* +a = [ 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ]; +ahainvah = [ 0.25 -0.5 0.25 0.5 0.25 0.25 ; ... + 5.96046e-08 0.5 -0.25 5.96046e-08 5.96046e-08 -0.25 ; ... + 0 0.5 2.98023e-08 -0.5 0 2.98023e-08 ; ... + -0.25 0.5 0 0 -0.25 0 ]; +*/ + { 64, -128, 63, 127, 64, 63, 0, 128, -63, 0, 0, -63, 0, 128, 0, -127, 0, 0, -64, 128, 0, 0, -64, 0 }, + /* +a = [ 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ]; +ahainvah = [ -0.25 -0.25 0.25 0.5 0.5 0.25 ; ... + 0.25 0.25 -0.25 1.49012e-08 -1.49012e-08 -0.25 ; ... + 0.25 0.25 -2.98023e-08 -0.5 -8.9407e-08 -2.98023e-08 ; ... + 0.25 0.25 0 0 -0.5 0 ]; +*/ + { -64, -64, 64, 128, 128, 64, 64, 64, -64, 0, 0, -64, 63, 63, 0, -128, 0, 0, 64, 64, 0, 0, -128, 0 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ]; +ahainvah = [ 0.142857 0.142857 0.214286 1.49012e-08 0.285714 0.214286 ; ... + -0.142857 -0.142857 0.285714 1.49012e-08 0.214286 -0.214286 ; ... + -0.0714286 -0.0714286 -0.357143 0.5 -0.142857 0.142857 ; ... + -0.0714286 -0.0714286 0.142857 -0.5 0.357143 0.142857 ]; +*/ + { 36, 36, 54, 0, 73, 54, -36, -36, 73, 0, 54, -54, -18, -18, -91, 127, -36, 36, -18, -18, 36, -127, 91, 36 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ]; +ahainvah = [ 0.166667 0.166667 0.166667 0.166667 0.166667 0.166667 ; ... + 0 -0.25 0.25 0 0.25 -0.25 ; ... + -0.25 0 -0.25 0.25 0 0.25 ; ... + 0.25 -0.25 0 -0.25 0.25 0 ]; +*/ + { 42, 42, 42, 42, 42, 42, 0, -64, 64, 0, 64, -64, -64, 0, -64, 64, 0, 64, 64, -64, 0, -64, 64, 0 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ]; +ahainvah = [ 0.125 0.25 0.25 0.125 0.125 0.125 ; ... + -0.25 -0.125 0.125 0.125 0.25 -0.125 ; ... + 0.125 -0.25 -0.25 0.125 0.125 0.125 ; ... + -0.25 0.125 -0.125 -0.125 0.25 0.125 ]; +*/ + { 32, 64, 64, 32, 32, 32, -64, -32, 32, 32, 64, -32, 32, -64, -64, 32, 32, 32, -64, 32, -32, -32, 64, 32 }, + /* +a = [ 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ]; +ahainvah = [ 0.142857 0.214286 0.285714 0.214286 7.45058e-09 0.142857 ; ... + -0.214286 -0.0714286 0.0714286 -0.0714285 0.5 -0.214286 ; ... + 0.142857 -0.285714 -0.214286 0.214286 1.49012e-08 0.142857 ; ... + -0.0714286 0.142857 -0.142857 -0.357143 0.5 -0.0714286 ]; +*/ + { 36, 54, 73, 54, 0, 36, -54, -18, 18, -18, 128, -54, 36, -73, -54, 54, 0, 36, -18, 36, -36, -91, 127, -18 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ]; +ahainvah = [ 0.25 0.25 0.25 0 0 0.25 ; ... + 0 -0.25 0 0.25 0.25 -0.25 ; ... + -0.25 0 -0.25 0.25 0.25 0 ; ... + -0.166667 -0.166667 0.166667 -0.166667 0.166667 0.166667 ]; +*/ + { 64, 64, 64, 0, 0, 64, 0, -64, 0, 64, 64, -64, -64, 0, -64, 64, 64, 0, -42, -42, 42, -42, 42, 42 }, + /* +a = [ 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ]; +ahainvah = [ 0.25 0.375 0.25 0.125 -0.125 0.125 ; ... + -2.42144e-08 -0.25 -2.42144e-08 0.25 0.25 -0.25 ; ... + -0.25 -0.125 -0.25 0.125 0.375 0.125 ; ... + 0 -0.25 0 -0.25 0.25 0.25 ]; +*/ + { 64, 96, 64, 32, -32, 32, 0, -63, 0, 64, 64, -63, -64, -32, -64, 32, 96, 32, 0, -64, 0, -64, 64, 64 }, + /* +a = [ 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ]; +ahainvah = [ 0.25 0.25 0.5 0.25 -0.5 0.25 ; ... + 5.96046e-08 -0.25 5.96046e-08 5.96046e-08 0.5 -0.25 ; ... + 0 2.98023e-08 -0.5 0 0.5 2.98023e-08 ; ... + -0.25 0 0 -0.25 0.5 0 ]; +*/ + { 64, 63, 127, 64, -128, 63, 0, -63, 0, 0, 128, -63, 0, 0, -127, 0, 128, 0, -64, 0, 0, -64, 128, 0 }, + /* +a = [ 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ]; +ahainvah = [ -0.25 0.25 0.5 0.5 -0.25 0.25 ; ... + 0.25 -0.25 1.49012e-08 -1.49012e-08 0.25 -0.25 ; ... + 0.25 -2.98023e-08 -0.5 -8.9407e-08 0.25 -2.98023e-08 ; ... + 0.25 0 0 -0.5 0.25 0 ]; +*/ + { -64, 64, 128, 128, -64, 64, 64, -64, 0, 0, 64, -64, 63, 0, -128, 0, 63, 0, 64, 0, 0, -128, 64, 0 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ]; +ahainvah = [ 0.285714 0.214286 -1.49012e-08 0.142857 0.142857 0.214286 ; ... + -0.214286 0.214286 7.45058e-09 0.142857 0.142857 -0.285714 ; ... + -0.142857 -0.357143 0.5 -0.0714286 -0.0714286 0.142857 ; ... + -0.0714286 0.0714286 -0.5 0.214286 0.214286 0.0714286 ]; +*/ + { 73, 54, 0, 36, 36, 54, -54, 54, 0, 36, 36, -73, -36, -91, 128, -18, -18, 36, -18, 18, -128, 54, 54, 18 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ]; +ahainvah = [ 0.25 0.25 0.25 0 0 0.25 ; ... + -0.125 0.125 -0.125 0.25 0.25 -0.375 ; ... + -0.25 -0.25 0.25 7.45058e-09 7.45058e-09 0.25 ; ... + 0.125 -0.125 -0.375 0.25 0.25 -0.125 ]; +*/ + { 64, 64, 64, 0, 0, 64, -32, 32, -31, 64, 64, -96, -64, -64, 64, 0, 0, 64, 32, -32, -96, 64, 64, -32 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ]; +ahainvah = [ 0.357143 0.5 0.142857 -0.0714286 -0.0714286 0.142857 ; ... + -0.214286 -2.6077e-08 0.214286 0.142857 0.142857 -0.285714 ; ... + -0.0714286 -0.5 0.0714286 0.214286 0.214286 0.0714286 ; ... + -0.214286 1.49012e-08 -0.285714 0.142857 0.142857 0.214286 ]; +*/ + { 91, 128, 36, -18, -18, 36, -54, 0, 54, 36, 36, -73, -18, -128, 18, 54, 54, 18, -54, 0, -73, 36, 36, 54 }, + /* +a = [ 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ]; +ahainvah = [ 0.25 0.5 0.5 -0.25 -0.25 0.25 ; ... + -0.25 1.49012e-08 -1.49012e-08 0.25 0.25 -0.25 ; ... + -2.98023e-08 -0.5 -8.9407e-08 0.25 0.25 -2.98023e-08 ; ... + 0 0 -0.5 0.25 0.25 0 ]; +*/ + { 64, 128, 128, -64, -64, 64, -64, 0, 0, 64, 64, -64, 0, -128, 0, 63, 63, 0, 0, 0, -128, 64, 64, 0 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ]; +ahainvah = [ 0.5 0 0 0 0 0.5 ; ... + 0 2.98023e-08 0.166667 0.166667 0.166667 -0.5 ; ... + -0.5 0.5 -1.49012e-08 -1.49012e-08 -1.49012e-08 -7.45058e-08 ; ... + 0 -0.5 0.166667 0.166667 0.166667 0 ]; +*/ + { 128, 0, 0, 0, 0, 128, 0, 0, 42, 42, 42, -128, -128, 127, 0, 0, 0, 0, 0, -127, 42, 42, 42, 0 }, + /* +a = [ 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ]; +ahainvah = [ 0.5 0.5 -0.166667 -0.166667 -0.166667 0.5 ; ... + -2.98023e-08 -2.98023e-08 0.166667 0.166667 0.166667 -0.5 ; ... + -0.5 -5.21541e-08 0.166667 0.166667 0.166667 -6.70552e-08 ; ... + -2.98023e-08 -0.5 0.166667 0.166667 0.166667 -2.98023e-08 ]; +*/ + { 128, 128, -42, -42, -42, 128, 0, 0, 42, 42, 42, -128, -128, 0, 42, 42, 42, 0, 0, -128, 42, 42, 42, 0 }, + /* +a = [ 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ 0.5 0.5 -0.166667 -0.166667 -0.166667 0.5 ; ... + 2.98023e-08 2.98023e-08 -0.166667 -0.166667 -0.166667 0.5 ; ... + 0.5 5.21541e-08 -0.166667 -0.166667 -0.166667 6.70552e-08 ; ... + 2.98023e-08 0.5 -0.166667 -0.166667 -0.166667 2.98023e-08 ]; +*/ + { 128, 128, -42, -42, -42, 128, 0, 0, -42, -42, -42, 128, 128, 0, -42, -42, -42, 0, 0, 128, -42, -42, -42, 0 }, + /* +a = [ 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ 0.5 0 0 0 0 0.5 ; ... + 0 -2.98023e-08 -0.166667 -0.166667 -0.166667 0.5 ; ... + 0.5 -0.5 1.49012e-08 1.49012e-08 1.49012e-08 7.45058e-08 ; ... + 0 0.5 -0.166667 -0.166667 -0.166667 0 ]; +*/ + { 128, 0, 0, 0, 0, 128, 0, 0, -42, -42, -42, 128, 128, -127, 0, 0, 0, 0, 0, 127, -42, -42, -42, 0 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ 0.25 0.5 0.5 -0.25 -0.25 0.25 ; ... + 0.25 -1.49012e-08 1.49012e-08 -0.25 -0.25 0.25 ; ... + 2.98023e-08 0.5 8.9407e-08 -0.25 -0.25 2.98023e-08 ; ... + 0 0 0.5 -0.25 -0.25 0 ]; +*/ + { 64, 128, 128, -64, -64, 64, 64, 0, 0, -64, -64, 64, 0, 128, 0, -63, -63, 0, 0, 0, 128, -64, -64, 0 }, + /* +a = [ 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ 0.357143 0.5 0.142857 -0.0714286 -0.0714286 0.142857 ; ... + 0.214286 2.6077e-08 -0.214286 -0.142857 -0.142857 0.285714 ; ... + 0.0714286 0.5 -0.0714286 -0.214286 -0.214286 -0.0714286 ; ... + 0.214286 -1.49012e-08 0.285714 -0.142857 -0.142857 -0.214286 ]; +*/ + { 91, 128, 36, -18, -18, 36, 54, 0, -54, -36, -36, 73, 18, 128, -18, -54, -54, -18, 54, 0, 73, -36, -36, -54 }, + /* +a = [ 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ 0.25 0.25 0.25 0 0 0.25 ; ... + 0.125 -0.125 0.125 -0.25 -0.25 0.375 ; ... + 0.25 0.25 -0.25 -7.45058e-09 -7.45058e-09 -0.25 ; ... + -0.125 0.125 0.375 -0.25 -0.25 0.125 ]; +*/ + { 64, 64, 64, 0, 0, 64, 32, -32, 31, -64, -64, 96, 64, 64, -64, 0, 0, -64, -32, 32, 96, -64, -64, 32 }, + /* +a = [ 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ 0.285714 0.214286 -1.49012e-08 0.142857 0.142857 0.214286 ; ... + 0.214286 -0.214286 -7.45058e-09 -0.142857 -0.142857 0.285714 ; ... + 0.142857 0.357143 -0.5 0.0714286 0.0714286 -0.142857 ; ... + 0.0714286 -0.0714286 0.5 -0.214286 -0.214286 -0.0714286 ]; +*/ + { 73, 54, 0, 36, 36, 54, 54, -54, 0, -36, -36, 73, 36, 91, -128, 18, 18, -36, 18, -18, 128, -54, -54, -18 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ -0.25 0.25 0.5 0.5 -0.25 0.25 ; ... + -0.25 0.25 -1.49012e-08 1.49012e-08 -0.25 0.25 ; ... + -0.25 2.98023e-08 0.5 8.9407e-08 -0.25 2.98023e-08 ; ... + -0.25 0 0 0.5 -0.25 0 ]; +*/ + { -64, 64, 128, 128, -64, 64, -64, 64, 0, 0, -64, 64, -63, 0, 128, 0, -63, 0, -64, 0, 0, 128, -64, 0 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ 0.25 0.25 0.5 0.25 -0.5 0.25 ; ... + -5.96046e-08 0.25 -5.96046e-08 -5.96046e-08 -0.5 0.25 ; ... + 0 -2.98023e-08 0.5 0 -0.5 -2.98023e-08 ; ... + 0.25 0 0 0.25 -0.5 0 ]; +*/ + { 64, 63, 127, 64, -128, 63, 0, 63, 0, 0, -128, 63, 0, 0, 127, 0, -128, 0, 64, 0, 0, 64, -128, 0 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ 0.25 0.375 0.25 0.125 -0.125 0.125 ; ... + 2.42144e-08 0.25 2.42144e-08 -0.25 -0.25 0.25 ; ... + 0.25 0.125 0.25 -0.125 -0.375 -0.125 ; ... + 0 0.25 0 0.25 -0.25 -0.25 ]; +*/ + { 64, 96, 64, 32, -32, 32, 0, 63, 0, -64, -64, 63, 64, 32, 64, -32, -96, -32, 0, 64, 0, 64, -64, -64 }, + /* +a = [ 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ 0.25 0.25 0.25 0 0 0.25 ; ... + 0 0.25 0 -0.25 -0.25 0.25 ; ... + 0.25 0 0.25 -0.25 -0.25 0 ; ... + 0.166667 0.166667 -0.166667 0.166667 -0.166667 -0.166667 ]; +*/ + { 64, 64, 64, 0, 0, 64, 0, 64, 0, -64, -64, 64, 64, 0, 64, -64, -64, 0, 42, 42, -42, 42, -42, -42 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ 0.142857 0.214286 0.285714 0.214286 7.45058e-09 0.142857 ; ... + 0.214286 0.0714286 -0.0714286 0.0714285 -0.5 0.214286 ; ... + -0.142857 0.285714 0.214286 -0.214286 -1.49012e-08 -0.142857 ; ... + 0.0714286 -0.142857 0.142857 0.357143 -0.5 0.0714286 ]; +*/ + { 36, 54, 73, 54, 0, 36, 54, 18, -18, 18, -128, 54, -36, 73, 54, -54, 0, -36, 18, -36, 36, 91, -127, 18 }, + /* +a = [ 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ 0.125 0.25 0.25 0.125 0.125 0.125 ; ... + 0.25 0.125 -0.125 -0.125 -0.25 0.125 ; ... + -0.125 0.25 0.25 -0.125 -0.125 -0.125 ; ... + 0.25 -0.125 0.125 0.125 -0.25 -0.125 ]; +*/ + { 32, 64, 64, 32, 32, 32, 64, 32, -32, -32, -64, 32, -32, 64, 64, -32, -32, -32, 64, -32, 32, 32, -64, -32 }, + /* +a = [ 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ 0.166667 0.166667 0.166667 0.166667 0.166667 0.166667 ; ... + 0 0.25 -0.25 0 -0.25 0.25 ; ... + 0.25 0 0.25 -0.25 0 -0.25 ; ... + -0.25 0.25 0 0.25 -0.25 0 ]; +*/ + { 42, 42, 42, 42, 42, 42, 0, 64, -64, 0, -64, 64, 64, 0, 64, -64, 0, -64, -64, 64, 0, 64, -64, 0 }, + /* +a = [ 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ 0.142857 0.142857 0.214286 1.49012e-08 0.285714 0.214286 ; ... + 0.142857 0.142857 -0.285714 -1.49012e-08 -0.214286 0.214286 ; ... + 0.0714286 0.0714286 0.357143 -0.5 0.142857 -0.142857 ; ... + 0.0714286 0.0714286 -0.142857 0.5 -0.357143 -0.142857 ]; +*/ + { 36, 36, 54, 0, 73, 54, 36, 36, -73, 0, -54, 54, 18, 18, 91, -127, 36, -36, 18, 18, -36, 127, -91, -36 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ -0.25 -0.25 0.25 0.5 0.5 0.25 ; ... + -0.25 -0.25 0.25 -1.49012e-08 1.49012e-08 0.25 ; ... + -0.25 -0.25 2.98023e-08 0.5 8.9407e-08 2.98023e-08 ; ... + -0.25 -0.25 0 0 0.5 0 ]; +*/ + { -64, -64, 64, 128, 128, 64, -64, -64, 64, 0, 0, 64, -63, -63, 0, 128, 0, 0, -64, -64, 0, 0, 128, 0 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ 0.25 -0.5 0.25 0.5 0.25 0.25 ; ... + -5.96046e-08 -0.5 0.25 -5.96046e-08 -5.96046e-08 0.25 ; ... + 0 -0.5 -2.98023e-08 0.5 0 -2.98023e-08 ; ... + 0.25 -0.5 0 0 0.25 0 ]; +*/ + { 64, -128, 63, 127, 64, 63, 0, -128, 63, 0, 0, 63, 0, -128, 0, 127, 0, 0, 64, -128, 0, 0, 64, 0 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ 0.5 0 0.25 0 0 0.25 ; ... + 0.5 -0.25 0.25 -0.5 -0.25 0.25 ; ... + 0.5 -0.25 0 0 -0.25 0 ; ... + 0.5 0 0 -0.5 0 0 ]; +*/ + { 128, 0, 64, 0, 0, 64, 128, -64, 64, -128, -64, 64, 128, -64, 0, 0, -64, 0, 128, 0, 0, -128, 0, 0 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ 0 0.25 0.5 0.25 0 0 ; ... + 0 0 0.5 0 -0.5 0 ; ... + -0.25 0.25 0.5 0.25 -0.5 -0.25 ; ... + -0.25 0 0.5 0 0 -0.25 ]; +*/ + { 0, 64, 128, 64, 0, 0, 0, 0, 128, 0, -128, 0, -64, 64, 128, 64, -128, -64, -64, 0, 128, 0, 0, -64 }, + /* +a = [ 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ 0.25 0.25 0.25 0.25 7.45058e-09 6.70552e-08 ; ... + 0.25 4.47035e-08 0.25 4.47035e-08 -0.5 4.47035e-08 ; ... + 0.25 0.25 0.25 0.25 -0.5 -0.5 ; ... + 0.25 -2.98023e-08 0.25 -2.98023e-08 2.98023e-08 -0.5 ]; +*/ + { 64, 64, 64, 64, 0, 0, 63, 0, 63, 0, -128, 0, 63, 64, 63, 64, -128, -127, 63, 0, 63, 0, 0, -127 }, + /* +a = [ 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ 0.166667 0.166667 0.166667 0.166667 0.166667 0.166667 ; ... + 0.25 0 0.25 -0.25 -0.25 0 ; ... + 0.25 0.25 0 0 -0.25 -0.25 ; ... + 0 0.25 0.25 -0.25 0 -0.25 ]; +*/ + { 42, 42, 42, 42, 42, 42, 64, 0, 64, -64, -64, 0, 64, 64, 0, 0, -64, -64, 0, 64, 64, -64, 0, -64 }, + /* +a = [ 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ 0.125 0.125 0.125 0.25 0.125 0.25 ; ... + 0.25 -0.125 0.125 -0.125 -0.25 0.125 ; ... + 0.25 0.125 -0.125 0.125 -0.25 -0.125 ; ... + 0.125 0.125 0.125 -0.25 0.125 -0.25 ]; +*/ + { 32, 32, 32, 64, 32, 64, 64, -32, 32, -32, -64, 32, 64, 32, -32, 32, -64, -32, 32, 32, 32, -64, 32, -64 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ 7.45058e-09 0.142857 0.214286 0.285714 0.214286 0.142857 ; ... + -0.5 0.214286 0.0714286 -0.0714286 0.0714285 0.214286 ; ... + -1.49012e-08 -0.142857 0.285714 0.214286 -0.214286 -0.142857 ; ... + -0.5 0.0714286 -0.142857 0.142857 0.357143 0.0714286 ]; +*/ + { 0, 36, 54, 73, 54, 36, -128, 54, 18, -18, 18, 54, 0, -36, 73, 54, -54, -36, -127, 18, -36, 36, 91, 18 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ 0.166667 0.166667 0.166667 0.166667 0.166667 0.166667 ; ... + -0.25 0.25 0.25 0 -0.25 0 ; ... + 0 0 0.25 0.25 -0.25 -0.25 ; ... + -0.25 0.25 0 0.25 0 -0.25 ]; +*/ + { 42, 42, 42, 42, 42, 42, -64, 64, 64, 0, -64, 0, 0, 0, 64, 64, -64, -64, -64, 64, 0, 64, 0, -64 }, + /* +a = [ 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ 0.142857 1.49012e-08 0.214286 0.142857 0.214286 0.285714 ; ... + -0.0714286 0.5 0.142857 -0.0714286 -0.357143 -0.142857 ; ... + 0.142857 -2.98023e-08 0.214286 0.142857 -0.285714 -0.214286 ; ... + 0.0714286 0.5 -0.142857 0.0714286 -0.142857 -0.357143 ]; +*/ + { 36, 0, 54, 36, 54, 73, -18, 127, 36, -18, -91, -36, 36, 0, 54, 36, -73, -54, 18, 127, -36, 18, -36, -91 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ 0.142857 0.214286 1.49012e-08 0.285714 0.214286 0.142857 ; ... + 0.0714286 -0.142857 0.5 -0.357143 -0.142857 0.0714286 ; ... + -0.142857 0.285714 0 0.214286 -0.214286 -0.142857 ; ... + -0.0714286 -0.357143 0.5 -0.142857 0.142857 -0.0714286 ]; +*/ + { 36, 54, 0, 73, 54, 36, 18, -36, 127, -91, -36, 18, -36, 73, 0, 54, -54, -36, -18, -91, 128, -36, 36, -18 }, + /* +a = [ 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ 0 0.25 0 0.25 0.25 0.25 ; ... + 0.25 0 0.25 -0.25 -0.25 0 ; ... + -0.166667 0.166667 0.166667 0.166667 -0.166667 -0.166667 ; ... + 0.25 -0.25 0.25 0 0 -0.25 ]; +*/ + { 0, 64, 0, 64, 64, 64, 64, 0, 64, -64, -64, 0, -42, 42, 42, 42, -42, -42, 64, -64, 64, 0, 0, -64 }, + /* +a = [ 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ 0.25 0 0 0.25 0.25 0.25 ; ... + -0.125 0.25 0.25 -0.375 -0.125 0.125 ; ... + 0.25 7.45058e-09 7.45058e-09 0.25 -0.25 -0.25 ; ... + -0.375 0.25 0.25 -0.125 0.125 -0.125 ]; +*/ + { 64, 0, 0, 64, 64, 64, -31, 64, 64, -96, -32, 32, 64, 0, 0, 64, -64, -64, -96, 64, 64, -32, 32, -32 }, + /* +a = [ 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ]; +ahainvah = [ 5.96046e-08 5.96046e-08 5.96046e-08 0.5 5.96046e-08 0.5 ; ... + 0.166667 0.166667 0.166667 -0.5 -5.96046e-08 0 ; ... + 8.9407e-08 8.9407e-08 8.9407e-08 0.5 -0.5 -2.98023e-08 ; ... + 0.166667 0.166667 0.166667 -0.5 0.5 -0.5 ]; +*/ + { 0, 0, 0, 127, 0, 128, 42, 42, 42, -127, 0, 0, 0, 0, 0, 127, -127, 0, 42, 42, 42, -127, 127, -127 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ]; +ahainvah = [ -5.96046e-08 -5.96046e-08 -5.96046e-08 -5.96046e-08 0.5 0.5 ; ... + -0.166667 -0.166667 -0.166667 0.5 -1.49012e-08 1.49012e-08 ; ... + -0.166667 -0.166667 -0.166667 -4.96705e-08 0.5 -9.93411e-09 ; ... + -2.98023e-08 -2.98023e-08 -2.98023e-08 -0.5 0 0.5 ]; +*/ + { 0, 0, 0, 0, 127, 128, -42, -42, -42, 128, 0, 0, -42, -42, -42, 0, 127, 0, 0, 0, 0, -128, 0, 128 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ]; +ahainvah = [ 0.142857 -0.0714286 -0.0714286 0.142857 0.5 0.357143 ; ... + -0.214286 -0.142857 -0.142857 0.285714 2.6077e-08 0.214286 ; ... + -0.0714286 -0.214286 -0.214286 -0.0714286 0.5 0.0714286 ; ... + 0.285714 -0.142857 -0.142857 -0.214286 -1.49012e-08 0.214286 ]; +*/ + { 36, -18, -18, 36, 128, 91, -54, -36, -36, 73, 0, 54, -18, -54, -54, -18, 128, 18, 73, -36, -36, -54, 0, 54 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ]; +ahainvah = [ 0.25 0.125 -0.125 0.125 0.25 0.375 ; ... + 2.42144e-08 -0.25 -0.25 0.25 2.42144e-08 0.25 ; ... + 0.25 -0.125 -0.375 -0.125 0.25 0.125 ; ... + 0 0.25 -0.25 -0.25 0 0.25 ]; +*/ + { 64, 32, -32, 32, 64, 96, 0, -64, -64, 63, 0, 63, 64, -32, -96, -32, 64, 32, 0, 64, -64, -64, 0, 64 }, + /* +a = [ 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ]; +ahainvah = [ 0.25 0 0 0.25 0.25 0.25 ; ... + 0 -0.25 -0.25 0.25 0 0.25 ; ... + 0.25 -0.25 -0.25 0 0.25 0 ; ... + 0.166667 0.166667 -0.166667 -0.166667 -0.166667 0.166667 ]; +*/ + { 64, 0, 0, 64, 64, 64, 0, -64, -64, 64, 0, 64, 64, -64, -64, 0, 64, 0, 42, 42, -42, -42, -42, 42 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ]; +ahainvah = [ 0 0.25 0 0 0.25 0.5 ; ... + 0 0 -0.5 0 0 0.5 ; ... + -0.25 0.25 -0.5 -0.25 0.25 0.5 ; ... + -0.25 0 0 -0.25 0 0.5 ]; +*/ + { 0, 64, 0, 0, 64, 128, 0, 0, -128, 0, 0, 128, -64, 64, -128, -64, 64, 128, -64, 0, 0, -64, 0, 128 }, + /* +a = [ 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ]; +ahainvah = [ 0.25 0.25 7.45058e-09 6.70552e-08 0.25 0.25 ; ... + 0.25 4.47035e-08 -0.5 4.47035e-08 4.47035e-08 0.25 ; ... + 0.25 0.25 -0.5 -0.5 0.25 0.25 ; ... + 0.25 -2.98023e-08 2.98023e-08 -0.5 -2.98023e-08 0.25 ]; +*/ + { 64, 64, 0, 0, 64, 64, 63, 0, -128, 0, 0, 63, 63, 64, -128, -127, 64, 63, 63, 0, 0, -127, 0, 63 }, + /* +a = [ 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ]; +ahainvah = [ 0.166667 0.166667 0.166667 0.166667 0.166667 0.166667 ; ... + 0.25 0 -0.25 0 -0.25 0.25 ; ... + 0.25 0.25 -0.25 -0.25 0 0 ; ... + 0 0.25 0 -0.25 -0.25 0.25 ]; +*/ + { 42, 42, 42, 42, 42, 42, 64, 0, -64, 0, -64, 64, 64, 64, -64, -64, 0, 0, 0, 64, 0, -64, -64, 64 }, + /* +a = [ 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ]; +ahainvah = [ 0.125 0.125 0.125 0.25 0.25 0.125 ; ... + 0.25 -0.125 -0.25 0.125 -0.125 0.125 ; ... + 0.25 0.125 -0.25 -0.125 0.125 -0.125 ; ... + 0.125 0.125 0.125 -0.25 -0.25 0.125 ]; +*/ + { 32, 32, 32, 64, 64, 32, 64, -32, -64, 32, -32, 32, 64, 32, -64, -32, 32, -32, 32, 32, 32, -64, -64, 32 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ]; +ahainvah = [ 0 0 0.25 0.25 0.25 0.25 ; ... + -0.5 0.5 0 0 0 0 ; ... + -0.5 0 0.25 0 0.25 0 ; ... + 0 -0.5 0 0.25 0 0.25 ]; +*/ + { 0, 0, 64, 64, 64, 64, -128, 128, 0, 0, 0, 0, -128, 0, 64, 0, 64, 0, 0, -128, 0, 64, 0, 64 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ]; +ahainvah = [ 7.45058e-09 6.70552e-08 0.25 0.25 0.25 0.25 ; ... + -0.5 4.47035e-08 4.47035e-08 0.25 4.47035e-08 0.25 ; ... + -0.5 -0.5 0.25 0.25 0.25 0.25 ; ... + 2.98023e-08 -0.5 -2.98023e-08 0.25 -2.98023e-08 0.25 ]; +*/ + { 0, 0, 64, 64, 64, 64, -128, 0, 0, 63, 0, 63, -128, -127, 64, 63, 64, 63, 0, -127, 0, 63, 0, 63 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ]; +ahainvah = [ 0.214286 -1.49012e-08 0.214286 0.142857 0.285714 0.142857 ; ... + -0.142857 0.5 -0.142857 0.0714286 -0.357143 0.0714286 ; ... + -0.357143 0.5 0.142857 -0.0714286 -0.142857 -0.0714286 ; ... + -0.285714 0 0.214286 0.142857 -0.214286 0.142857 ]; +*/ + { 54, 0, 54, 36, 73, 36, -36, 128, -36, 18, -91, 18, -91, 128, 36, -18, -36, -18, -73, 0, 54, 36, -54, 36 }, + /* +a = [ 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ]; +ahainvah = [ 0.166667 0 2.98023e-08 0.166667 0.5 0.166667 ; ... + -8.9407e-08 0.5 5.96046e-08 -8.9407e-08 -0.5 -8.9407e-08 ; ... + -0.166667 0.5 0.5 -0.166667 -0.5 -0.166667 ; ... + 0 0 0.5 0 -0.5 0 ]; +*/ + { 42, 0, 0, 42, 128, 42, 0, 128, 0, 0, -127, 0, -42, 128, 128, -42, -128, -42, 0, 0, 128, 0, -128, 0 }, + /* +a = [ 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ]; +ahainvah = [ 0.125 -0.125 0.125 0.25 0.375 0.25 ; ... + 0.25 0.25 -0.25 -2.42144e-08 -0.25 -2.42144e-08 ; ... + 0.125 0.375 0.125 -0.25 -0.125 -0.25 ; ... + -0.25 0.25 0.25 0 -0.25 0 ]; +*/ + { 32, -32, 32, 64, 96, 64, 64, 64, -63, 0, -63, 0, 32, 96, 32, -64, -32, -64, -64, 64, 64, 0, -64, 0 }, + /* +a = [ 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ]; +ahainvah = [ -1.49012e-08 -1.49012e-08 -1.49012e-08 0.25 0.5 0.25 ; ... + 0.25 0.25 -0.5 1.49012e-08 -1.49012e-08 1.49012e-08 ; ... + 0.25 0.25 1.49012e-08 -0.25 -1.49012e-08 -0.25 ; ... + 0 0 0.5 0 -0.5 0 ]; +*/ + { 0, 0, 0, 64, 128, 64, 64, 64, -128, 0, 0, 0, 64, 64, 0, -63, 0, -63, 0, 0, 128, 0, -128, 0 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ]; +ahainvah = [ 0.1 0.1 0.1 0.2 0.3 0.2 ; ... + -0.166667 -0.166667 0.166667 0.166667 -0.166667 0.166667 ; ... + -0.1 -0.1 -0.1 0.3 0.2 -0.2 ; ... + -0.1 -0.1 -0.1 -0.2 0.2 0.3 ]; +*/ + { 25, 25, 25, 51, 76, 51, -42, -42, 42, 42, -42, 42, -25, -25, -25, 76, 51, -51, -25, -25, -25, -51, 51, 76 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ]; +ahainvah = [ 0.125 0.125 0.125 0.25 0.25 0.125 ; ... + -0.125 -0.25 0.125 0.125 -0.125 0.25 ; ... + -0.125 -0.125 -0.125 0.25 0.25 -0.125 ; ... + 0.125 -0.25 -0.125 -0.125 0.125 0.25 ]; +*/ + { 32, 32, 32, 64, 64, 32, -32, -64, 32, 32, -32, 64, -32, -32, -32, 64, 64, -32, 32, -64, -32, -32, 32, 64 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ]; +ahainvah = [ 0.166667 0.166667 0.166667 0.166667 0.166667 0.166667 ; ... + -0.25 -0.25 0 0.25 0 0.25 ; ... + 0 -0.25 -0.25 0.25 0.25 0 ; ... + -0.25 0 -0.25 0 0.25 0.25 ]; +*/ + { 42, 42, 42, 42, 42, 42, -64, -64, 0, 64, 0, 64, 0, -64, -64, 64, 64, 0, -64, 0, -64, 0, 64, 64 }, + /* +a = [ 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ]; +ahainvah = [ 0.142857 0.214286 0.285714 0.214286 0.142857 1.49012e-08 ; ... + -0.0714286 -0.357143 -0.142857 0.142857 -0.0714286 0.5 ; ... + 0.142857 -0.285714 -0.214286 0.214286 0.142857 -2.98023e-08 ; ... + 0.0714286 -0.142857 -0.357143 -0.142857 0.0714286 0.5 ]; +*/ + { 36, 54, 73, 54, 36, 0, -18, -91, -36, 36, -18, 127, 36, -73, -54, 54, 36, 0, 18, -36, -91, -36, 18, 127 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ]; +ahainvah = [ 0.214286 0.285714 0.142857 -1.49012e-08 0.214286 0.142857 ; ... + -0.142857 -0.357143 0.0714286 0.5 -0.142857 0.0714286 ; ... + -0.357143 -0.142857 -0.0714286 0.5 0.142857 -0.0714286 ; ... + -0.285714 -0.214286 0.142857 0 0.214286 0.142857 ]; +*/ + { 54, 73, 36, 0, 54, 36, -36, -91, 18, 128, -36, 18, -91, -36, -18, 128, 36, -18, -73, -54, 36, 0, 54, 36 }, + /* +a = [ 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ]; +ahainvah = [ 0.166667 0.5 0.166667 0 2.98023e-08 0.166667 ; ... + -8.9407e-08 -0.5 -8.9407e-08 0.5 5.96046e-08 -8.9407e-08 ; ... + -0.166667 -0.5 -0.166667 0.5 0.5 -0.166667 ; ... + 0 -0.5 0 0 0.5 0 ]; +*/ + { 42, 128, 42, 0, 0, 42, 0, -127, 0, 128, 0, 0, -42, -128, -42, 128, 128, -42, 0, -128, 0, 0, 128, 0 }, + /* +a = [ 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ]; +ahainvah = [ -0.5 0.25 0.25 0.5 0.25 0.25 ; ... + 0.5 -0.25 0 0 -0.25 0 ; ... + 0.5 0 -0.25 0 0 -0.25 ; ... + 0.5 0 0 -0.5 0 0 ]; +*/ + { -128, 64, 64, 128, 64, 64, 128, -64, 0, 0, -64, 0, 128, 0, -64, 0, 0, -64, 128, 0, 0, -128, 0, 0 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ]; +ahainvah = [ 0.25 0.125 0.125 0.125 0.25 0.125 ; ... + -0.25 0.125 0.125 0.125 -0.25 0.125 ; ... + -0.125 -0.125 0.25 0.125 0.125 -0.25 ; ... + -0.125 -0.125 -0.25 0.125 0.125 0.25 ]; +*/ + { 64, 32, 32, 32, 64, 32, -64, 32, 32, 32, -64, 32, -32, -32, 64, 32, 32, -64, -32, -32, -64, 32, 32, 64 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ]; +ahainvah = [ 0.25 0.25 0.25 0 0.25 0 ; ... + -0.25 0 0 0.25 -0.25 0.25 ; ... + -0.166667 -0.166667 0.166667 0.166667 0.166667 -0.166667 ; ... + 0 -0.25 -0.25 0.25 0 0.25 ]; +*/ + { 64, 64, 64, 0, 64, 0, -64, 0, 0, 64, -64, 64, -42, -42, 42, 42, 42, -42, 0, -64, -64, 64, 0, 64 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ]; +ahainvah = [ 0.375 0.25 0.125 -0.125 0.125 0.25 ; ... + -0.25 -2.42144e-08 0.25 0.25 -0.25 -2.42144e-08 ; ... + -0.125 -0.25 0.125 0.375 0.125 -0.25 ; ... + -0.25 0 -0.25 0.25 0.25 0 ]; +*/ + { 96, 64, 32, -32, 32, 64, -63, 0, 64, 64, -63, 0, -32, -64, 32, 96, 32, -64, -64, 0, -64, 64, 64, 0 }, + /* +a = [ 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ]; +ahainvah = [ 0.25 0.25 0.5 -0.5 0.25 0.25 ; ... + -0.25 0 0 0.5 -0.25 0 ; ... + 0 -0.25 0 0.5 0 -0.25 ; ... + 0 0 -0.5 0.5 0 0 ]; +*/ + { 64, 64, 128, -128, 64, 64, -64, 0, 0, 128, -64, 0, 0, -64, 0, 128, 0, -64, 0, 0, -128, 128, 0, 0 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ]; +ahainvah = [ 0.357143 0.142857 -0.0714286 -0.0714286 0.5 0.142857 ; ... + -0.0714286 0.0714286 0.214286 0.214286 -0.5 0.0714286 ; ... + -0.214286 0.214286 0.142857 0.142857 -7.45058e-09 -0.285714 ; ... + -0.214286 -0.285714 0.142857 0.142857 0 0.214286 ]; +*/ + { 91, 36, -18, -18, 128, 36, -18, 18, 54, 54, -128, 18, -54, 54, 36, 36, 0, -73, -54, -73, 36, 36, 0, 54 }, + /* +a = [ 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ]; +ahainvah = [ 0.25 0.5 -0.25 -0.25 0.5 0.25 ; ... + -1.49012e-08 -4.47035e-08 0.25 0.25 -0.5 -1.49012e-08 ; ... + -0.25 -2.98023e-08 0.25 0.25 -4.47035e-08 -0.25 ; ... + -2.98023e-08 -0.5 0.25 0.25 -8.9407e-08 -2.98023e-08 ]; +*/ + { 64, 128, -63, -63, 128, 64, 0, 0, 64, 64, -128, 0, -63, 0, 64, 64, 0, -63, 0, -128, 63, 63, 0, 0 }, + /* +a = [ 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ]; +ahainvah = [ 0.5 -0.166667 -0.166667 -0.166667 0.5 0.5 ; ... + -2.98023e-08 0.166667 0.166667 0.166667 -0.5 -2.98023e-08 ; ... + -5.21541e-08 0.166667 0.166667 0.166667 -6.70552e-08 -0.5 ; ... + -0.5 0.166667 0.166667 0.166667 -2.98023e-08 -2.98023e-08 ]; +*/ + { 128, -42, -42, -42, 128, 128, 0, 42, 42, 42, -128, 0, 0, 42, 42, 42, 0, -128, -128, 42, 42, 42, 0, 0 }, + /* +a = [ 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ]; +ahainvah = [ 0.5 -5.96046e-08 -5.96046e-08 -5.96046e-08 -5.96046e-08 0.5 ; ... + -2.98023e-08 -0.166667 -0.166667 -0.166667 0.5 2.98023e-08 ; ... + 1.65568e-08 -1.65568e-08 -1.65568e-08 -1.65568e-08 -0.5 0.5 ; ... + 0.5 -0.166667 -0.166667 -0.166667 -5.96046e-08 0 ]; +*/ + { 128, 0, 0, 0, 0, 127, 0, -42, -42, -42, 128, 0, 0, 0, 0, 0, -128, 127, 128, -42, -42, -42, 0, 0 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ]; +ahainvah = [ 0.142857 0.5 -0.0714286 -0.0714286 0.142857 0.357143 ; ... + -0.214286 2.98023e-08 -0.142857 -0.142857 0.285714 0.214286 ; ... + 0.285714 -7.45058e-09 -0.142857 -0.142857 -0.214286 0.214286 ; ... + -0.0714286 0.5 -0.214286 -0.214286 -0.0714286 0.0714286 ]; +*/ + { 36, 128, -18, -18, 36, 91, -54, 0, -36, -36, 73, 54, 73, 0, -36, -36, -54, 54, -18, 128, -54, -54, -18, 18 }, + /* +a = [ 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ]; +ahainvah = [ 0.25 0.25 0 0 0.25 0.25 ; ... + -0.125 0.125 -0.25 -0.25 0.375 0.125 ; ... + 0.25 -0.25 -7.45058e-09 -7.45058e-09 -0.25 0.25 ; ... + 0.125 0.375 -0.25 -0.25 0.125 -0.125 ]; +*/ + { 64, 64, 0, 0, 64, 64, -32, 31, -64, -64, 96, 32, 64, -64, 0, 0, -64, 64, 32, 96, -64, -64, 32, -32 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ]; +ahainvah = [ 0.0714285 0.142857 0.5 -0.142857 0.0714285 0.357143 ; ... + 0.142857 -0.214286 0 -0.285714 0.142857 0.214286 ; ... + -0.142857 0.214286 -7.45058e-09 -0.214286 -0.142857 0.285714 ; ... + -0.0714286 -0.142857 0.5 -0.357143 -0.0714286 0.142857 ]; +*/ + { 18, 36, 128, -36, 18, 91, 36, -54, 0, -73, 36, 54, -36, 54, 0, -54, -36, 73, -18, -36, 128, -91, -18, 36 }, + /* +a = [ 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ]; +ahainvah = [ 0.25 0.25 0.25 0 0 0.25 ; ... + 0.166667 -0.166667 -0.166667 -0.166667 0.166667 0.166667 ; ... + 0 0.25 0 -0.25 -0.25 0.25 ; ... + 0.25 0 0.25 -0.25 -0.25 0 ]; +*/ + { 64, 64, 64, 0, 0, 64, 42, -42, -42, -42, 42, 42, 0, 64, 0, -64, -64, 64, 64, 0, 64, -64, -64, 0 }, + /* +a = [ 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ]; +ahainvah = [ 0.142857 0.214286 0.285714 1.49012e-08 0.214286 0.142857 ; ... + 0.0714286 -0.142857 0.142857 -0.5 0.357143 0.0714286 ; ... + 0.142857 0.214286 -0.214286 -2.98023e-08 -0.285714 0.142857 ; ... + -0.0714286 0.142857 0.357143 -0.5 0.142857 -0.0714286 ]; +*/ + { 36, 54, 73, 0, 54, 36, 18, -36, 36, -127, 91, 18, 36, 54, -54, 0, -73, 36, -18, 36, 91, -127, 36, -18 }, + /* +a = [ 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ]; +ahainvah = [ 0.166667 0.166667 0.166667 0.166667 0.166667 0.166667 ; ... + 0.25 -0.25 0 -0.25 0.25 0 ; ... + 0 0.25 -0.25 0 -0.25 0.25 ; ... + 0.25 0 0.25 -0.25 0 -0.25 ]; +*/ + { 42, 42, 42, 42, 42, 42, 64, -64, 0, -64, 64, 0, 0, 64, -64, 0, -64, 64, 64, 0, 64, -64, 0, -64 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ]; +ahainvah = [ -0.142857 0.0714285 0.142857 0.5 0.0714285 0.357143 ; ... + -0.285714 0.142857 -0.214286 0 0.142857 0.214286 ; ... + -0.214286 -0.142857 0.214286 -7.45058e-09 -0.142857 0.285714 ; ... + -0.357143 -0.0714286 -0.142857 0.5 -0.0714286 0.142857 ]; +*/ + { -36, 18, 36, 128, 18, 91, -73, 36, -54, 0, 36, 54, -54, -36, 54, 0, -36, 73, -91, -18, -36, 128, -18, 36 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ]; +ahainvah = [ 0.25 0 0 0.25 0 0.5 ; ... + 0 0 -0.5 0 0 0.5 ; ... + 0 -0.25 0 0 -0.25 0.5 ; ... + 0.25 -0.25 -0.5 0.25 -0.25 0.5 ]; +*/ + { 64, 0, 0, 64, 0, 128, 0, 0, -128, 0, 0, 128, 0, -64, 0, 0, -64, 128, 64, -64, -128, 64, -64, 128 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ]; +ahainvah = [ 0.142857 0.285714 0.142857 0.214286 1.49012e-08 0.214286 ; ... + -0.142857 0.214286 -0.142857 -0.214286 1.49012e-08 0.285714 ; ... + 0.0714286 0.142857 0.0714286 -0.142857 -0.5 0.357143 ; ... + -0.0714286 0.357143 -0.0714286 0.142857 -0.5 0.142857 ]; +*/ + { 36, 73, 36, 54, 0, 54, -36, 54, -36, -54, 0, 73, 18, 36, 18, -36, -127, 91, -18, 91, -18, 36, -127, 36 }, + /* +a = [ 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ]; +ahainvah = [ 0.166667 0.166667 0.166667 0.166667 0.166667 0.166667 ; ... + 0 0.25 -0.25 -0.25 0 0.25 ; ... + 0.25 0 0 -0.25 -0.25 0.25 ; ... + 0.25 0.25 -0.25 0 -0.25 0 ]; +*/ + { 42, 42, 42, 42, 42, 42, 0, 64, -64, -64, 0, 64, 64, 0, 0, -64, -64, 64, 64, 64, -64, 0, -64, 0 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ]; +ahainvah = [ 1.49012e-08 0.142857 0.214286 0.285714 0.214286 0.142857 ; ... + 0.5 0.0714286 -0.142857 -0.357143 -0.142857 0.0714286 ; ... + 0 0.142857 0.214286 -0.214286 -0.285714 0.142857 ; ... + 0.5 -0.0714286 0.142857 -0.142857 -0.357143 -0.0714286 ]; +*/ + { 0, 36, 54, 73, 54, 36, 127, 18, -36, -91, -36, 18, 0, 36, 54, -54, -73, 36, 128, -18, 36, -36, -91, -18 }, + /* +a = [ 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ]; +ahainvah = [ 0.142857 -2.23517e-08 0.214286 0.285714 0.214286 0.142857 ; ... + -0.0714286 0.5 -0.357143 -0.142857 0.142857 -0.0714286 ; ... + 0.142857 0 0.214286 -0.214286 -0.285714 0.142857 ; ... + -0.214286 0.5 -0.0714286 0.0714286 -0.0714286 -0.214286 ]; +*/ + { 36, 0, 54, 73, 54, 36, -18, 128, -91, -36, 36, -18, 36, 0, 54, -54, -73, 36, -54, 128, -18, 18, -18, -54 }, + /* +a = [ 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ]; +ahainvah = [ 0 0 0.25 0.25 0.25 0.25 ; ... + 0.25 0.25 -0.375 -0.125 0.125 -0.125 ; ... + 7.45058e-09 7.45058e-09 0.25 -0.25 -0.25 0.25 ; ... + 0.25 0.25 -0.125 0.125 -0.125 -0.375 ]; +*/ + { 0, 0, 64, 64, 64, 64, 64, 64, -96, -32, 32, -31, 0, 0, 64, -64, -64, 64, 64, 64, -32, 32, -32, -96 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ]; +ahainvah = [ 0.0714285 0.0714285 -0.142857 0.357143 0.5 0.142857 ; ... + -0.142857 -0.142857 0.285714 -0.214286 0 0.214286 ; ... + -0.142857 -0.142857 -0.214286 0.285714 -7.45058e-09 0.214286 ; ... + -0.0714286 -0.0714286 -0.357143 0.142857 0.5 -0.142857 ]; +*/ + { 18, 18, -36, 91, 128, 36, -36, -36, 73, -54, 0, 54, -36, -36, -54, 73, 0, 54, -18, -18, -91, 36, 128, -36 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ]; +ahainvah = [ 0.25 0 0 0.25 0.25 0.25 ; ... + -0.166667 -0.166667 0.166667 -0.166667 0.166667 0.166667 ; ... + 0 -0.25 -0.25 0.25 0 0.25 ; ... + 0.25 -0.25 -0.25 0 0.25 0 ]; +*/ + { 64, 0, 0, 64, 64, 64, -42, -42, 42, -42, 42, 42, 0, -64, -64, 64, 0, 64, 64, -64, -64, 0, 64, 0 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ]; +ahainvah = [ 0.142857 0.214286 1.49012e-08 0.142857 0.285714 0.214286 ; ... + -0.142857 -0.214286 1.49012e-08 -0.142857 0.214286 0.285714 ; ... + 0.0714286 -0.142857 -0.5 0.0714286 0.142857 0.357143 ; ... + -0.0714286 0.142857 -0.5 -0.0714286 0.357143 0.142857 ]; +*/ + { 36, 54, 0, 36, 73, 54, -36, -54, 0, -36, 54, 73, 18, -36, -127, 18, 36, 91, -18, 36, -127, -18, 91, 36 }, + /* +a = [ 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ]; +ahainvah = [ 0.166667 0.166667 0.166667 0.166667 0.166667 0.166667 ; ... + 0 -0.25 0 -0.25 0.25 0.25 ; ... + 0.25 -0.25 -0.25 0 0 0.25 ; ... + 0.25 0 -0.25 -0.25 0.25 0 ]; +*/ + { 42, 42, 42, 42, 42, 42, 0, -64, 0, -64, 64, 64, 64, -64, -64, 0, 0, 64, 64, 0, -64, -64, 64, 0 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ]; +ahainvah = [ -2.98023e-08 0.25 0.25 0.25 0.25 0 ; ... + 1.30385e-08 -0.25 1.67638e-08 -0.25 1.67638e-08 0.5 ; ... + -0.5 -2.98023e-08 2.98023e-08 -2.98023e-08 2.98023e-08 0.5 ; ... + -0.5 0 0.25 0 0.25 0 ]; +*/ + { 0, 63, 64, 63, 64, 0, 0, -64, 0, -64, 0, 128, -128, 0, 0, 0, 0, 127, -128, 0, 64, 0, 64, 0 }, + /* +a = [ 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ]; +ahainvah = [ 0 0 0.25 0.5 0.25 0 ; ... + 0.25 0 0 -0.5 0 0.25 ; ... + 0.25 0.5 -0.25 -0.5 -0.25 0.25 ; ... + 0 0.5 0 -0.5 0 0 ]; +*/ + { 0, 0, 64, 128, 64, 0, 64, 0, 0, -128, 0, 64, 64, 128, -64, -128, -64, 64, 0, 128, 0, -128, 0, 0 }, + /* +a = [ 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ]; +ahainvah = [ -0.125 0.125 0.25 0.375 0.25 0.125 ; ... + 0.25 -0.25 -2.42144e-08 -0.25 -2.42144e-08 0.25 ; ... + 0.375 0.125 -0.25 -0.125 -0.25 0.125 ; ... + 0.25 0.25 0 -0.25 0 -0.25 ]; +*/ + { -32, 32, 64, 96, 64, 32, 64, -63, 0, -63, 0, 64, 96, 32, -64, -32, -64, 32, 64, 64, 0, -64, 0, -64 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ]; +ahainvah = [ 0.2 0.1 0.1 0.3 0.2 0.1 ; ... + -0.3 0.1 0.1 -0.2 0.2 0.1 ; ... + -0.166667 -0.166667 0.166667 0.166667 -0.166667 0.166667 ; ... + -0.2 -0.1 -0.1 0.2 0.3 -0.1 ]; +*/ + { 51, 25, 25, 76, 51, 25, -76, 25, 25, -51, 51, 25, -42, -42, 42, 42, -42, 42, -51, -25, -25, 51, 76, -25 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ]; +ahainvah = [ 0.285714 0.214286 0.142857 0.214286 1.49012e-08 0.142857 ; ... + -0.357143 -0.142857 0.0714286 -0.142857 0.5 0.0714286 ; ... + -0.214286 -0.285714 0.142857 0.214286 0 0.142857 ; ... + -0.142857 -0.357143 -0.0714286 0.142857 0.5 -0.0714286 ]; +*/ + { 73, 54, 36, 54, 0, 36, -91, -36, 18, -36, 127, 18, -54, -73, 36, 54, 0, 36, -36, -91, -18, 36, 128, -18 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ]; +ahainvah = [ 0.5 0.25 0 0 0.25 0 ; ... + -0.5 0 0.25 0 0 0.25 ; ... + -0.5 -0.25 0.25 0.5 -0.25 0.25 ; ... + -0.5 0 0 0.5 0 0 ]; +*/ + { 128, 64, 0, 0, 64, 0, -128, 0, 64, 0, 0, 64, -128, -64, 64, 128, -64, 64, -128, 0, 0, 128, 0, 0 }, + /* +a = [ 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ]; +ahainvah = [ 0.357143 0.0714285 -0.142857 0.5 0.142857 0.0714285 ; ... + -0.142857 0.0714286 0.357143 -0.5 0.142857 0.0714286 ; ... + -0.285714 0.142857 0.214286 3.72529e-09 -0.214286 0.142857 ; ... + -0.214286 -0.142857 0.285714 -1.49012e-08 0.214286 -0.142857 ]; +*/ + { 91, 18, -36, 127, 36, 18, -36, 18, 91, -128, 36, 18, -73, 36, 54, 0, -54, 36, -54, -36, 73, 0, 54, -36 }, + /* +a = [ 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ]; +ahainvah = [ 0.25 0.25 -0.5 0.5 0.25 0.25 ; ... + 2.98023e-08 -2.98023e-08 0.5 -0.5 2.98023e-08 -2.98023e-08 ; ... + -0.25 0 0.5 -2.98023e-08 -0.25 0 ; ... + 2.98023e-08 -0.25 0.5 0 2.98023e-08 -0.25 ]; +*/ + { 63, 63, -128, 128, 63, 63, 0, 0, 128, -128, 0, 0, -63, 0, 128, 0, -63, 0, 0, -63, 128, 0, 0, -63 }, + /* +a = [ 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ]; +ahainvah = [ 0.25 -0.25 -0.25 0.5 0.5 0.25 ; ... + 0 0.25 0.25 -0.5 -5.96046e-08 0 ; ... + -2.98023e-08 0.25 0.25 -2.98023e-08 -0.5 -2.98023e-08 ; ... + -0.25 0.25 0.25 -2.98023e-08 -5.96046e-08 -0.25 ]; +*/ + { 64, -64, -64, 128, 128, 64, 0, 64, 64, -128, 0, 0, 0, 64, 64, 0, -128, 0, -63, 64, 64, 0, 0, -63 }, + /* +a = [ 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ]; +ahainvah = [ -0.166667 -0.166667 -0.166667 0.5 0.5 0.5 ; ... + 0.166667 0.166667 0.166667 -0.5 -2.98023e-08 -2.98023e-08 ; ... + 0.166667 0.166667 0.166667 -6.70552e-08 -0.5 -5.21541e-08 ; ... + 0.166667 0.166667 0.166667 -2.98023e-08 -2.98023e-08 -0.5 ]; +*/ + { -42, -42, -42, 128, 128, 128, 42, 42, 42, -128, 0, 0, 42, 42, 42, 0, -128, 0, 42, 42, 42, 0, 0, -128 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ]; +ahainvah = [ 0.166667 0.166667 0.166667 -1.49012e-08 0 0.5 ; ... + -0.166667 -0.166667 -0.166667 0.5 4.96705e-09 -3.47694e-08 ; ... + 0 0 0 -0.5 0.5 1.49012e-08 ; ... + 0 0 0 -2.98023e-08 -0.5 0.5 ]; +*/ + { 42, 42, 42, 0, 0, 128, -42, -42, -42, 128, 0, 0, 0, 0, 0, -127, 127, 0, 0, 0, 0, 0, -127, 128 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ]; +ahainvah = [ 0.214286 0.142857 0.142857 -1.49012e-08 0.214286 0.285714 ; ... + -0.0714286 -0.214286 -0.214286 0.5 -0.0714286 0.0714286 ; ... + -0.142857 0.0714286 0.0714286 -0.5 0.357143 0.142857 ; ... + 0.285714 -0.142857 -0.142857 0 -0.214286 0.214286 ]; +*/ + { 54, 36, 36, 0, 54, 73, -18, -54, -54, 127, -18, 18, -36, 18, 18, -127, 91, 36, 73, -36, -36, 0, -54, 54 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ]; +ahainvah = [ 0.125 0.25 0.125 0.125 0.125 0.25 ; ... + -0.25 -0.125 -0.125 0.25 0.125 0.125 ; ... + 0.25 -0.125 -0.125 -0.25 0.125 0.125 ; ... + -0.125 0.25 -0.125 -0.125 -0.125 0.25 ]; +*/ + { 32, 64, 32, 32, 32, 64, -64, -32, -32, 64, 32, 32, 64, -32, -32, -64, 32, 32, -32, 64, -32, -32, -32, 64 }, + /* +a = [ 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ]; +ahainvah = [ 0.166667 0.166667 0.166667 0.166667 0.166667 0.166667 ; ... + -0.25 0 -0.25 0.25 0 0.25 ; ... + 0.25 -0.25 0 -0.25 0.25 0 ; ... + 0 0.25 -0.25 0 -0.25 0.25 ]; +*/ + { 42, 42, 42, 42, 42, 42, -64, 0, -64, 64, 0, 64, 64, -64, 0, -64, 64, 0, 0, 64, -64, 0, -64, 64 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ]; +ahainvah = [ 0.1 0.2 0.3 0.1 0.1 0.2 ; ... + 0.1 -0.3 -0.2 0.1 0.1 0.2 ; ... + -0.166667 0.166667 -0.166667 -0.166667 0.166667 0.166667 ; ... + -0.1 -0.2 0.2 -0.1 -0.1 0.3 ]; +*/ + { 25, 51, 76, 25, 25, 51, 25, -76, -51, 25, 25, 51, -42, 42, -42, -42, 42, 42, -25, -51, 51, -25, -25, 76 }, + /* +a = [ 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ]; +ahainvah = [ 0.125 0.25 0.25 0.125 0.125 0.125 ; ... + 0.125 -0.25 -0.25 0.125 0.125 0.125 ; ... + -0.125 0.125 -0.125 -0.25 0.125 0.25 ; ... + 0.125 -0.125 0.125 -0.25 -0.125 0.25 ]; +*/ + { 32, 64, 64, 32, 32, 32, 32, -64, -64, 32, 32, 32, -32, 32, -32, -64, 32, 64, 32, -32, 32, -64, -32, 64 }, + /* +a = [ 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ]; +ahainvah = [ 0.142857 0.214286 0.285714 0.214286 0.142857 -2.23517e-08 ; ... + -0.0714286 -0.357143 -0.142857 0.142857 -0.0714286 0.5 ; ... + 0.142857 0.214286 -0.214286 -0.285714 0.142857 0 ; ... + -0.214286 -0.0714286 0.0714286 -0.0714286 -0.214286 0.5 ]; +*/ + { 36, 54, 73, 54, 36, 0, -18, -91, -36, 36, -18, 128, 36, 54, -54, -73, 36, 0, -54, -18, 18, -18, -54, 128 }, + /* +a = [ 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ]; +ahainvah = [ 0 0.25 0.25 0.25 0.25 0 ; ... + 0.25 -0.375 -0.125 0.125 -0.125 0.25 ; ... + 7.45058e-09 0.25 -0.25 -0.25 0.25 7.45058e-09 ; ... + 0.25 -0.125 0.125 -0.125 -0.375 0.25 ]; +*/ + { 0, 64, 64, 64, 64, 0, 64, -96, -32, 32, -31, 64, 0, 64, -64, -64, 64, 0, 64, -32, 32, -32, -96, 64 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ]; +ahainvah = [ 0.25 0 0.25 0.25 0 0.25 ; ... + -0.25 0.25 -0.25 0 0.25 0 ; ... + -0.166667 -0.166667 0.166667 -0.166667 0.166667 0.166667 ; ... + 0 -0.25 0 0.25 -0.25 0.25 ]; +*/ + { 64, 0, 64, 64, 0, 64, -64, 64, -64, 0, 64, 0, -42, -42, 42, -42, 42, 42, 0, -64, 0, 64, -64, 64 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ]; +ahainvah = [ 0.25 0.125 0.25 0.125 0.125 0.125 ; ... + -0.25 0.125 -0.25 0.125 0.125 0.125 ; ... + -0.125 -0.25 0.125 -0.125 0.125 0.25 ; ... + 0.125 -0.25 -0.125 0.125 -0.125 0.25 ]; +*/ + { 64, 32, 64, 32, 32, 32, -64, 32, -64, 32, 32, 32, -32, -64, 32, -32, 32, 64, 32, -64, -32, 32, -32, 64 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ]; +ahainvah = [ 0.25 0.25 0.25 0.25 4.96705e-09 -4.96705e-09 ; ... + -0.25 1.49012e-08 -0.25 1.49012e-08 0.5 1.49012e-08 ; ... + 0 -0.25 0 -0.25 0 0.5 ; ... + 0 0 0 0 -0.5 0.5 ]; +*/ + { 64, 64, 64, 64, 0, 0, -64, 0, -64, 0, 128, 0, 0, -64, 0, -64, 0, 128, 0, 0, 0, 0, -128, 128 }, + /* +a = [ 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ]; +ahainvah = [ 0.125 0.25 0.375 0.25 0.125 -0.125 ; ... + -0.25 -2.42144e-08 -0.25 -2.42144e-08 0.25 0.25 ; ... + 0.125 -0.25 -0.125 -0.25 0.125 0.375 ; ... + 0.25 0 -0.25 0 -0.25 0.25 ]; +*/ + { 32, 64, 96, 64, 32, -32, -63, 0, -63, 0, 64, 64, 32, -64, -32, -64, 32, 96, 64, 0, -64, 0, -64, 64 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ]; +ahainvah = [ 0.357143 0.0714285 0.5 0.142857 0.0714285 -0.142857 ; ... + -0.142857 0.0714286 -0.5 0.142857 0.0714286 0.357143 ; ... + -0.285714 0.142857 3.72529e-09 -0.214286 0.142857 0.214286 ; ... + -0.214286 -0.142857 -1.49012e-08 0.214286 -0.142857 0.285714 ]; +*/ + { 91, 18, 127, 36, 18, -36, -36, 18, -128, 36, 18, 91, -73, 36, 0, -54, 36, 54, -54, -36, 0, 54, -36, 73 }, + /* +a = [ 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ]; +ahainvah = [ 0.25 0.25 0.5 0.25 0.25 -0.5 ; ... + 2.98023e-08 -2.98023e-08 -0.5 2.98023e-08 -2.98023e-08 0.5 ; ... + -0.25 0 -2.98023e-08 -0.25 0 0.5 ; ... + 2.98023e-08 -0.25 0 2.98023e-08 -0.25 0.5 ]; +*/ + { 63, 63, 128, 63, 63, -128, 0, 0, -128, 0, 0, 128, -63, 0, 0, -63, 0, 128, 0, -63, 0, 0, -63, 128 }, + /* +a = [ 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ]; +ahainvah = [ 0.25 -0.25 0.5 0.5 0.25 -0.25 ; ... + 0 0.25 -0.5 -5.96046e-08 0 0.25 ; ... + -2.98023e-08 0.25 -2.98023e-08 -0.5 -2.98023e-08 0.25 ; ... + -0.25 0.25 -2.98023e-08 -5.96046e-08 -0.25 0.25 ]; +*/ + { 64, -64, 128, 128, 64, -64, 0, 64, -128, 0, 0, 64, 0, 64, 0, -128, 0, 64, -63, 64, 0, 0, -63, 64 }, + /* +a = [ 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ]; +ahainvah = [ -0.166667 -0.166667 0.5 0.5 0.5 -0.166667 ; ... + 0.166667 0.166667 -0.5 -2.98023e-08 -2.98023e-08 0.166667 ; ... + 0.166667 0.166667 -6.70552e-08 -0.5 -5.21541e-08 0.166667 ; ... + 0.166667 0.166667 -2.98023e-08 -2.98023e-08 -0.5 0.166667 ]; +*/ + { -42, -42, 128, 128, 128, -42, 42, 42, -128, 0, 0, 42, 42, 42, 0, -128, 0, 42, 42, 42, 0, 0, -128, 42 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ]; +ahainvah = [ 0.25 0.25 0 -2.98023e-08 0.25 0.25 ; ... + -0.25 -0.25 0.5 1.30385e-08 1.67638e-08 1.67638e-08 ; ... + 2.98023e-08 2.98023e-08 -0.5 0.5 -2.98023e-08 -2.98023e-08 ; ... + 0 0 0 -0.5 0.25 0.25 ]; +*/ + { 63, 63, 0, 0, 64, 64, -64, -64, 128, 0, 0, 0, 0, 0, -127, 128, 0, 0, 0, 0, 0, -128, 64, 64 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ]; +ahainvah = [ 0.214286 0.285714 -1.49012e-08 0.214286 0.142857 0.142857 ; ... + -0.142857 -0.357143 0.5 -0.142857 0.0714286 0.0714286 ; ... + -0.142857 0.142857 -0.5 0.357143 0.0714286 0.0714286 ; ... + 0.214286 -0.214286 0 -0.285714 0.142857 0.142857 ]; +*/ + { 54, 73, 0, 54, 36, 36, -36, -91, 128, -36, 18, 18, -36, 36, -128, 91, 18, 18, 54, -54, 0, -73, 36, 36 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ]; +ahainvah = [ 0.2 0.3 0.2 0.1 0.1 0.1 ; ... + -0.3 -0.2 0.2 0.1 0.1 0.1 ; ... + 0.2 -0.2 -0.3 0.1 0.1 0.1 ; ... + -0.166667 0.166667 -0.166667 -0.166667 0.166667 0.166667 ]; +*/ + { 51, 76, 51, 25, 25, 25, -76, -51, 51, 25, 25, 25, 51, -51, -76, 25, 25, 25, -42, 42, -42, -42, 42, 42 }, + /* +a = [ 1 -1 1 1 ; ... + 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ]; +ahainvah = [ 0.25 0.25 0.25 0.25 0 0 ; ... + -0.375 -0.125 0.125 -0.125 0.25 0.25 ; ... + 0.25 -0.25 -0.25 0.25 7.45058e-09 7.45058e-09 ; ... + -0.125 0.125 -0.125 -0.375 0.25 0.25 ]; +*/ + { 64, 64, 64, 64, 0, 0, -96, -32, 32, -31, 64, 64, 64, -64, -64, 64, 0, 0, -32, 32, -32, -96, 64, 64 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ]; +ahainvah = [ 0.142857 0.5 0.357143 -0.142857 0.0714285 0.0714285 ; ... + 0.142857 -0.5 -0.142857 0.357143 0.0714286 0.0714286 ; ... + -0.214286 3.72529e-09 -0.285714 0.214286 0.142857 0.142857 ; ... + -0.214286 1.49012e-08 0.214286 -0.285714 0.142857 0.142857 ]; +*/ + { 36, 127, 91, -36, 18, 18, 36, -128, -36, 91, 18, 18, -54, 0, -73, 54, 36, 36, -54, 0, 54, -73, 36, 36 }, + /* +a = [ 1 1 -1 1 ; ... + 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ]; +ahainvah = [ 0.25 0.5 0.25 -4.96705e-09 -2.48353e-08 -2.48353e-08 ; ... + -1.49012e-08 -0.5 -1.49012e-08 0.5 1.49012e-08 1.49012e-08 ; ... + -0.25 -7.45058e-09 -0.25 7.45058e-09 0.25 0.25 ; ... + 0 0 0 -0.5 0.25 0.25 ]; +*/ + { 63, 128, 63, 0, 0, 0, 0, -128, 0, 127, 0, 0, -64, 0, -64, 0, 64, 64, 0, 0, 0, -127, 63, 63 }, + /* +a = [ 1 1 1 -1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ]; +ahainvah = [ 0.25 0.5 0.5 0.25 -0.25 -0.25 ; ... + 0 -0.5 -5.96046e-08 0 0.25 0.25 ; ... + -2.98023e-08 -2.98023e-08 -0.5 -2.98023e-08 0.25 0.25 ; ... + -0.25 -2.98023e-08 -5.96046e-08 -0.25 0.25 0.25 ]; +*/ + { 64, 128, 128, 64, -64, -64, 0, -128, 0, 0, 64, 64, 0, 0, -128, 0, 64, 64, -63, 0, 0, -63, 64, 64 }, + /* +a = [ 1 1 1 1 ; ... + 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ]; +ahainvah = [ -0.166667 0.5 0.5 0.5 -0.166667 -0.166667 ; ... + 0.166667 -0.5 -2.98023e-08 -2.98023e-08 0.166667 0.166667 ; ... + 0.166667 -6.70552e-08 -0.5 -5.21541e-08 0.166667 0.166667 ; ... + 0.166667 -2.98023e-08 -2.98023e-08 -0.5 0.166667 0.166667 ]; +*/ + { -42, 128, 128, 128, -42, -42, 42, -128, 0, 0, 42, 42, 42, 0, -128, 0, 42, 42, 42, 0, 0, -128, 42, 42 }, + /* +a = [ 1 -1 -1 -1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ]; +ahainvah = [ 0.5 2.23517e-08 -2.23517e-08 0.166667 0.166667 0.166667 ; ... + -0.5 0.5 3.27826e-08 -2.98023e-09 -2.98023e-09 -2.98023e-09 ; ... + 2.98023e-08 -0.5 0.5 -2.98023e-08 -2.98023e-08 -2.98023e-08 ; ... + 0 -2.98023e-08 -0.5 0.166667 0.166667 0.166667 ]; +*/ + { 128, 0, 0, 42, 42, 42, -128, 127, 0, 0, 0, 0, 0, -127, 127, 0, 0, 0, 0, 0, -127, 42, 42, 42 }, + /* +a = [ 1 -1 -1 1 ; ... + 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ]; +ahainvah = [ 0.5 7.45058e-08 0.5 -1.49012e-08 -1.49012e-08 -1.49012e-08 ; ... + -0.5 0.5 -0.5 0.166667 0.166667 0.166667 ; ... + 1.49012e-08 -0.5 0.5 1.49012e-08 1.49012e-08 1.49012e-08 ; ... + -2.98023e-08 -8.9407e-08 -0.5 0.166667 0.166667 0.166667 ]; +*/ + { 128, 0, 127, 0, 0, 0, -128, 127, -127, 42, 42, 42, 0, -127, 127, 0, 0, 0, 0, 0, -127, 42, 42, 42 }, + /* +a = [ 1 -1 1 -1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ]; +ahainvah = [ 0.5 0.5 1.98682e-08 -1.98682e-08 -1.98682e-08 -1.98682e-08 ; ... + -0.5 -1.49012e-08 0.5 1.49012e-08 1.49012e-08 1.49012e-08 ; ... + -2.23517e-08 -0.5 -2.23517e-08 0.166667 0.166667 0.166667 ; ... + 0 0 -0.5 0.166667 0.166667 0.166667 ]; +*/ + { 128, 128, 0, 0, 0, 0, -128, 0, 127, 0, 0, 0, 0, -128, 0, 42, 42, 42, 0, 0, -127, 42, 42, 42 }, + /* +a = [ 1 -1 1 1 ; ... + 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ]; +ahainvah = [ 0.5 0.5 0.5 -0.166667 -0.166667 -0.166667 ; ... + -0.5 -2.98023e-08 -2.98023e-08 0.166667 0.166667 0.166667 ; ... + -6.70552e-08 -0.5 -5.21541e-08 0.166667 0.166667 0.166667 ; ... + -2.98023e-08 -2.98023e-08 -0.5 0.166667 0.166667 0.166667 ]; +*/ + { 128, 128, 128, -42, -42, -42, -128, 0, 0, 42, 42, 42, 0, -128, 0, 42, 42, 42, 0, 0, -128, 42, 42, 42 }, + /* +a = [ 1 1 -1 -1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 1 -1 1 ; ... + 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 1 1 -1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ]; + singular +*/ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + /* +a = [ 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ; ... + 1 1 1 1 ]; + singular +*/ + { 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 const unsigned long estsingular[8] = { + 0x0000000f, 0xffffffff80080410, 0x00300201, 0xffffffffc0002040, 0x02040003, 0xffffffff80400c00, 0x08201001, 0xfffffffff0000000 +}; + diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..e9de238 --- /dev/null +++ b/install-sh @@ -0,0 +1,251 @@ +#!/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 "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + 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/libmisc/Makefile.am b/libmisc/Makefile.am new file mode 100644 index 0000000..b9fb042 --- /dev/null +++ b/libmisc/Makefile.am @@ -0,0 +1,8 @@ +EXTRA_DIST = getopt.c getopt.h getopt1.c openpty.c vsnprintf.c random.c + +noinst_LIBRARIES = libmisc.a + +noinst_HEADERS = raisedcosine.h + +libmisc_a_SOURCES = sinc.c hamming.c rctime.c rcfreq.c rrctime.c rrcfreq.c +libmisc_a_LIBADD = @LIBOBJS@ diff --git a/libmisc/Makefile.in b/libmisc/Makefile.in new file mode 100644 index 0000000..f064618 --- /dev/null +++ b/libmisc/Makefile.in @@ -0,0 +1,503 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = libmisc +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in getopt.c getopt1.c openpty.c random.c \ + vsnprintf.c +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +libmisc_a_AR = $(AR) $(ARFLAGS) +libmisc_a_DEPENDENCIES = @LIBOBJS@ +am_libmisc_a_OBJECTS = sinc.$(OBJEXT) hamming.$(OBJEXT) \ + rctime.$(OBJEXT) rcfreq.$(OBJEXT) rrctime.$(OBJEXT) \ + rrcfreq.$(OBJEXT) +libmisc_a_OBJECTS = $(am_libmisc_a_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libmisc_a_SOURCES) +DIST_SOURCES = $(libmisc_a_SOURCES) +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUDIOFILE_CFLAGS = @AUDIOFILE_CFLAGS@ +AUDIOFILE_LIBS = @AUDIOFILE_LIBS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +HAVE_ALSA = @HAVE_ALSA@ +HAVE_BITTYPES = @HAVE_BITTYPES@ +HAVE_DIRECTX = @HAVE_DIRECTX@ +HAVE_IFRNEWNAME = @HAVE_IFRNEWNAME@ +HAVE_MKISS = @HAVE_MKISS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTHREAD = @LIBTHREAD@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +M_PI = @M_PI@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USEMMX = @USEMMX@ +USEVIS = @USEVIS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WIN32 = @WIN32@ +WINDRES = @WINDRES@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CFLAGS = @XML_CFLAGS@ +XML_LIBS = @XML_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = getopt.c getopt.h getopt1.c openpty.c vsnprintf.c random.c +noinst_LIBRARIES = libmisc.a +noinst_HEADERS = raisedcosine.h +libmisc_a_SOURCES = sinc.c hamming.c rctime.c rcfreq.c rrctime.c rrcfreq.c +libmisc_a_LIBADD = @LIBOBJS@ +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libmisc/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu libmisc/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libmisc.a: $(libmisc_a_OBJECTS) $(libmisc_a_DEPENDENCIES) + -rm -f libmisc.a + $(libmisc_a_AR) libmisc.a $(libmisc_a_OBJECTS) $(libmisc_a_LIBADD) + $(RANLIB) libmisc.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/openpty.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/random.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/vsnprintf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hamming.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rcfreq.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rctime.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrcfreq.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rrctime.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sinc.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf $(DEPDIR) ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf $(DEPDIR) ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libmisc/getopt.c b/libmisc/getopt.c new file mode 100644 index 0000000..a59a013 --- /dev/null +++ b/libmisc/getopt.c @@ -0,0 +1,731 @@ +/* Getopt for GNU. + NOTE: getopt is now part of the C library, so if you don't know what + "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu + before changing it! + + Copyright (C) 1987, 88, 89, 90, 91, 92, 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, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* NOTE!!! AIX requires this to be the first thing in the file. + Do not put ANYTHING before it! */ +#if !defined (__GNUC__) && defined (_AIX) + #pragma alloca +#endif + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef __GNUC__ +#define alloca __builtin_alloca +#else /* not __GNUC__ */ +#if defined (HAVE_ALLOCA_H) || (defined(sparc) && (defined(sun) || (!defined(USG) && !defined(SVR4) && !defined(__svr4__)))) +#include +#else +#ifndef _AIX +char *alloca (); +#endif +#endif /* alloca.h */ +#endif /* not __GNUC__ */ + +#if !__STDC__ && !defined(const) && IN_GCC +#define const +#endif + +/* This tells Alpha OSF/1 not to define a getopt prototype in . */ +#ifndef _NO_PROTO +#define _NO_PROTO +#endif + +#include + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#if defined (_LIBC) || !defined (__GNU_LIBRARY__) + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +#undef alloca +/* Don't include stdlib.h for non-GNU C libraries because some of them + contain conflicting prototypes for getopt. */ +#include +#else /* Not GNU C library. */ +#define __alloca alloca +#endif /* GNU C library. */ + +/* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a + long-named option. Because this is not POSIX.2 compliant, it is + being phased out. */ +/* #define GETOPT_COMPAT */ + +/* This version of `getopt' appears to the caller like standard Unix `getopt' + but it behaves differently for the user, since it allows the user + to intersperse the options with the other arguments. + + As `getopt' works, it permutes the elements of ARGV so that, + when it is done, all the options precede everything else. Thus + all application programs are extended to handle flexible argument order. + + Setting the environment variable POSIXLY_CORRECT disables permutation. + Then the behavior is completely standard. + + GNU application programs can use a third alternative mode in which + they can distinguish the relative order of options and other arguments. */ + +#include "getopt.h" + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +char *optarg = 0; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns EOF, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +/* XXX 1003.2 says this must be 1 before any call. */ +int optind = 0; + +/* The next char to be scanned in the option-element + in which the last option character we returned was found. + This allows us to pick up the scan where we left off. + + If this is zero, or a null string, it means resume the scan + by advancing to the next ARGV-element. */ + +static char *nextchar; + +/* Callers store zero here to inhibit the error message + for unrecognized options. */ + +int opterr = 1; + +/* Set to an option character which was unrecognized. + This must be initialized on some systems to avoid linking in the + system's own getopt implementation. */ + +int optopt = '?'; + +/* Describe how to deal with options that follow non-option ARGV-elements. + + If the caller did not specify anything, + the default is REQUIRE_ORDER if the environment variable + POSIXLY_CORRECT is defined, PERMUTE otherwise. + + REQUIRE_ORDER means don't recognize them as options; + stop option processing when the first non-option is seen. + This is what Unix does. + This mode of operation is selected by either setting the environment + variable POSIXLY_CORRECT, or using `+' as the first character + of the list of option characters. + + PERMUTE is the default. We permute the contents of ARGV as we scan, + so that eventually all the non-options are at the end. This allows options + to be given in any order, even with programs that were not written to + expect this. + + RETURN_IN_ORDER is an option available to programs that were written + to expect options and other ARGV-elements in any order and that care about + the ordering of the two. We describe each non-option ARGV-element + as if it were the argument of an option with character code 1. + Using `-' as the first character of the list of option characters + selects this mode of operation. + + The special argument `--' forces an end of option-scanning regardless + of the value of `ordering'. In the case of RETURN_IN_ORDER, only + `--' can cause `getopt' to return EOF with `optind' != ARGC. */ + +static enum +{ + REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER +} ordering; + +#ifdef __GNU_LIBRARY__ +/* We want to avoid inclusion of string.h with non-GNU libraries + because there are many ways it can cause trouble. + On some systems, it contains special magic macros that don't work + in GCC. */ +#include +#define my_index strchr +#define my_bcopy(src, dst, n) memcpy ((dst), (src), (n)) +#else + +/* Avoid depending on library functions or files + whose names are inconsistent. */ + +char *getenv (); + +static char * +my_index (str, chr) + const char *str; + int chr; +{ + while (*str) + { + if (*str == chr) + return (char *) str; + str++; + } + return 0; +} + +static void +my_bcopy (from, to, size) + const char *from; + char *to; + int size; +{ + int i; + for (i = 0; i < size; i++) + to[i] = from[i]; +} +#endif /* GNU C library. */ + +/* Handle permutation of arguments. */ + +/* Describe the part of ARGV that contains non-options that have + been skipped. `first_nonopt' is the index in ARGV of the first of them; + `last_nonopt' is the index after the last of them. */ + +static int first_nonopt; +static int last_nonopt; + +/* Exchange two adjacent subsequences of ARGV. + One subsequence is elements [first_nonopt,last_nonopt) + which contains all the non-options that have been skipped so far. + The other is elements [last_nonopt,optind), which contains all + the options processed since those non-options were skipped. + + `first_nonopt' and `last_nonopt' are relocated so that they describe + the new indices of the non-options in ARGV after they are moved. */ + +static void +exchange (argv) + char **argv; +{ + int nonopts_size = (last_nonopt - first_nonopt) * sizeof (char *); + char **temp = (char **) __alloca (nonopts_size); + + /* Interchange the two blocks of data in ARGV. */ + + my_bcopy ((char *) &argv[first_nonopt], (char *) temp, nonopts_size); + my_bcopy ((char *) &argv[last_nonopt], (char *) &argv[first_nonopt], + (optind - last_nonopt) * sizeof (char *)); + my_bcopy ((char *) temp, + (char *) &argv[first_nonopt + optind - last_nonopt], + nonopts_size); + + /* Update records for the slots the non-options now occupy. */ + + first_nonopt += (optind - last_nonopt); + last_nonopt = optind; +} + +/* Scan elements of ARGV (whose length is ARGC) for option characters + given in OPTSTRING. + + If an element of ARGV starts with '-', and is not exactly "-" or "--", + then it is an option element. The characters of this element + (aside from the initial '-') are option characters. If `getopt' + is called repeatedly, it returns successively each of the option characters + from each of the option elements. + + If `getopt' finds another option character, it returns that character, + updating `optind' and `nextchar' so that the next call to `getopt' can + resume the scan with the following option character or ARGV-element. + + If there are no more option characters, `getopt' returns `EOF'. + Then `optind' is the index in ARGV of the first ARGV-element + that is not an option. (The ARGV-elements have been permuted + so that those that are not options now come last.) + + OPTSTRING is a string containing the legitimate option characters. + If an option character is seen that is not listed in OPTSTRING, + return '?' after printing an error message. If you set `opterr' to + zero, the error message is suppressed but we still return '?'. + + If a char in OPTSTRING is followed by a colon, that means it wants an arg, + so the following text in the same ARGV-element, or the text of the following + ARGV-element, is returned in `optarg'. Two colons mean an option that + wants an optional arg; if there is text in the current ARGV-element, + it is returned in `optarg', otherwise `optarg' is set to zero. + + If OPTSTRING starts with `-' or `+', it requests different methods of + handling the non-option ARGV-elements. + See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. + + Long-named options begin with `--' instead of `-'. + Their names may be abbreviated as long as the abbreviation is unique + or is an exact match for some defined option. If they have an + argument, it follows the option name in the same ARGV-element, separated + from the option name by a `=', or else the in next ARGV-element. + When `getopt' finds a long-named option, it returns 0 if that option's + `flag' field is nonzero, the value of the option's `val' field + if the `flag' field is zero. + + The elements of ARGV aren't really const, because we permute them. + But we pretend they're const in the prototype to be compatible + with other systems. + + LONGOPTS is a vector of `struct option' terminated by an + element containing a name which is zero. + + LONGIND returns the index in LONGOPT of the long-named option found. + It is only valid when a long-named option has been found by the most + recent call. + + If LONG_ONLY is nonzero, '-' as well as '--' can introduce + long-named options. */ + +int +_getopt_internal (argc, argv, optstring, longopts, longind, long_only) + int argc; + char *const *argv; + const char *optstring; + const struct option *longopts; + int *longind; + int long_only; +{ + int option_index; + + optarg = 0; + + /* Initialize the internal data when the first call is made. + Start processing options with ARGV-element 1 (since ARGV-element 0 + is the program name); the sequence of previously skipped + non-option ARGV-elements is empty. */ + + if (optind == 0) + { + first_nonopt = last_nonopt = optind = 1; + + nextchar = NULL; + + /* Determine how to handle the ordering of options and nonoptions. */ + + if (optstring[0] == '-') + { + ordering = RETURN_IN_ORDER; + ++optstring; + } + else if (optstring[0] == '+') + { + ordering = REQUIRE_ORDER; + ++optstring; + } + else if (getenv ("POSIXLY_CORRECT") != NULL) + ordering = REQUIRE_ORDER; + else + ordering = PERMUTE; + } + + if (nextchar == NULL || *nextchar == '\0') + { + if (ordering == PERMUTE) + { + /* If we have just processed some options following some non-options, + exchange them so that the options come first. */ + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (last_nonopt != optind) + first_nonopt = optind; + + /* Now skip any additional non-options + and extend the range of non-options previously skipped. */ + + while (optind < argc + && (argv[optind][0] != '-' || argv[optind][1] == '\0') +#ifdef GETOPT_COMPAT + && (longopts == NULL + || argv[optind][0] != '+' || argv[optind][1] == '\0') +#endif /* GETOPT_COMPAT */ + ) + optind++; + last_nonopt = optind; + } + + /* Special ARGV-element `--' means premature end of options. + Skip it like a null option, + then exchange with previous non-options as if it were an option, + then skip everything else like a non-option. */ + + if (optind != argc && !strcmp (argv[optind], "--")) + { + optind++; + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (first_nonopt == last_nonopt) + first_nonopt = optind; + last_nonopt = argc; + + optind = argc; + } + + /* If we have done all the ARGV-elements, stop the scan + and back over any non-options that we skipped and permuted. */ + + if (optind == argc) + { + /* Set the next-arg-index to point at the non-options + that we previously skipped, so the caller will digest them. */ + if (first_nonopt != last_nonopt) + optind = first_nonopt; + return EOF; + } + + /* If we have come to a non-option and did not permute it, + either stop the scan or describe it to the caller and pass it by. */ + + if ((argv[optind][0] != '-' || argv[optind][1] == '\0') +#ifdef GETOPT_COMPAT + && (longopts == NULL + || argv[optind][0] != '+' || argv[optind][1] == '\0') +#endif /* GETOPT_COMPAT */ + ) + { + if (ordering == REQUIRE_ORDER) + return EOF; + optarg = argv[optind++]; + return 1; + } + + /* We have found another option-ARGV-element. + Start decoding its characters. */ + + nextchar = (argv[optind] + 1 + + (longopts != NULL && argv[optind][1] == '-')); + } + + if (longopts != NULL + && ((argv[optind][0] == '-' + && (argv[optind][1] == '-' || long_only)) +#ifdef GETOPT_COMPAT + || argv[optind][0] == '+' +#endif /* GETOPT_COMPAT */ + )) + { + const struct option *p; + char *s = nextchar; + int exact = 0; + int ambig = 0; + const struct option *pfound = NULL; + int indfound; + + while (*s && *s != '=') + s++; + + /* Test all options for either exact match or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; + p++, option_index++) + if (!strncmp (p->name, nextchar, s - nextchar)) + { + if (s - nextchar == strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second nonexact match found. */ + ambig = 1; + } + + if (ambig && !exact) + { + if (opterr) + fprintf (stderr, "%s: option `%s' is ambiguous\n", + argv[0], argv[optind]); + nextchar += strlen (nextchar); + optind++; + return '?'; + } + + if (pfound != NULL) + { + option_index = indfound; + optind++; + if (*s) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + optarg = s + 1; + else + { + if (opterr) + { + if (argv[optind - 1][1] == '-') + /* --option */ + fprintf (stderr, + "%s: option `--%s' doesn't allow an argument\n", + argv[0], pfound->name); + else + /* +option or -option */ + fprintf (stderr, + "%s: option `%c%s' doesn't allow an argument\n", + argv[0], argv[optind - 1][0], pfound->name); + } + nextchar += strlen (nextchar); + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (optind < argc) + optarg = argv[optind++]; + else + { + if (opterr) + fprintf (stderr, "%s: option `%s' requires an argument\n", + argv[0], argv[optind - 1]); + nextchar += strlen (nextchar); + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + /* Can't find it as a long option. If this is not getopt_long_only, + or the option starts with '--' or is not a valid short + option, then it's an error. + Otherwise interpret it as a short option. */ + if (!long_only || argv[optind][1] == '-' +#ifdef GETOPT_COMPAT + || argv[optind][0] == '+' +#endif /* GETOPT_COMPAT */ + || my_index (optstring, *nextchar) == NULL) + { + if (opterr) + { + if (argv[optind][1] == '-') + /* --option */ + fprintf (stderr, "%s: unrecognized option `--%s'\n", + argv[0], nextchar); + else + /* +option or -option */ + fprintf (stderr, "%s: unrecognized option `%c%s'\n", + argv[0], argv[optind][0], nextchar); + } + nextchar = (char *) ""; + optind++; + return '?'; + } + } + + /* Look at and handle the next option-character. */ + + { + char c = *nextchar++; + char *temp = my_index (optstring, c); + + /* Increment `optind' when we start to process its last character. */ + if (*nextchar == '\0') + ++optind; + + if (temp == NULL || c == ':') + { + if (opterr) + { +#if 0 + if (c < 040 || c >= 0177) + fprintf (stderr, "%s: unrecognized option, character code 0%o\n", + argv[0], c); + else + fprintf (stderr, "%s: unrecognized option `-%c'\n", argv[0], c); +#else + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c); +#endif + } + optopt = c; + return '?'; + } + if (temp[1] == ':') + { + if (temp[2] == ':') + { + /* This is an option that accepts an argument optionally. */ + if (*nextchar != '\0') + { + optarg = nextchar; + optind++; + } + else + optarg = 0; + nextchar = NULL; + } + else + { + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + optind++; + } + else if (optind == argc) + { + if (opterr) + { +#if 0 + fprintf (stderr, "%s: option `-%c' requires an argument\n", + argv[0], c); +#else + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, "%s: option requires an argument -- %c\n", + argv[0], c); +#endif + } + optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + optarg = argv[optind++]; + nextchar = NULL; + } + } + return c; + } +} + +int +getopt (argc, argv, optstring) + int argc; + char *const *argv; + const char *optstring; +{ + return _getopt_internal (argc, argv, optstring, + (const struct option *) 0, + (int *) 0, + 0); +} + +#endif /* _LIBC or not __GNU_LIBRARY__. */ + +#ifdef TEST + +/* Compile with -DTEST to make an executable for use in testing + the above definition of `getopt'. */ + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + + c = getopt (argc, argv, "abc:d:0123456789"); + if (c == EOF) + break; + + switch (c) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/libmisc/getopt.h b/libmisc/getopt.h new file mode 100644 index 0000000..45541f5 --- /dev/null +++ b/libmisc/getopt.h @@ -0,0 +1,129 @@ +/* Declarations for getopt. + Copyright (C) 1989, 1990, 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, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#ifndef _GETOPT_H +#define _GETOPT_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +extern char *optarg; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns EOF, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +extern int optind; + +/* Callers store zero here to inhibit the error message `getopt' prints + for unrecognized options. */ + +extern int opterr; + +/* Set to an option character which was unrecognized. */ + +extern int optopt; + +/* Describe the long-named options requested by the application. + The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector + of `struct option' terminated by an element containing a name which is + zero. + + The field `has_arg' is: + no_argument (or 0) if the option does not take an argument, + required_argument (or 1) if the option requires an argument, + optional_argument (or 2) if the option takes an optional argument. + + If the field `flag' is not NULL, it points to a variable that is set + to the value given in the field `val' when the option is found, but + left unchanged if the option is not found. + + To have a long-named option do something other than set an `int' to + a compiled-in constant, such as set a value from `optarg', set the + option's `flag' field to zero and its `val' field to a nonzero + value (the equivalent single-letter option character, if there is + one). For long options that have a zero `flag' field, `getopt' + returns the contents of the `val' field. */ + +struct option +{ +#if __STDC__ + const char *name; +#else + char *name; +#endif + /* has_arg can't be an enum because some compilers complain about + type mismatches in all the code that assumes it is an int. */ + int has_arg; + int *flag; + int val; +}; + +/* Names for the values of the `has_arg' field of `struct option'. */ + +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 + +#if __STDC__ +#if defined(__GNU_LIBRARY__) +/* Many other libraries have conflicting prototypes for getopt, with + differences in the consts, in stdlib.h. To avoid compilation + errors, only prototype getopt for the GNU C library. */ +extern int getopt (int argc, char *const *argv, const char *shortopts); +#else /* not __GNU_LIBRARY__ */ +extern int getopt (); +#endif /* not __GNU_LIBRARY__ */ +extern int getopt_long (int argc, char *const *argv, const char *shortopts, + const struct option *longopts, int *longind); +extern int getopt_long_only (int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind); + +/* Internal only. Users should not call this directly. */ +extern int _getopt_internal (int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind, + int long_only); +#else /* not __STDC__ */ +extern int getopt (); +extern int getopt_long (); +extern int getopt_long_only (); + +extern int _getopt_internal (); +#endif /* not __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _GETOPT_H */ diff --git a/libmisc/getopt1.c b/libmisc/getopt1.c new file mode 100644 index 0000000..a32615c --- /dev/null +++ b/libmisc/getopt1.c @@ -0,0 +1,176 @@ +/* getopt_long and getopt_long_only entry points for GNU getopt. + Copyright (C) 1987, 88, 89, 90, 91, 92, 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, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "getopt.h" + +#if !__STDC__ && !defined(const) && IN_GCC +#define const +#endif + +#include + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#if defined (_LIBC) || !defined (__GNU_LIBRARY__) + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +#include +#else +char *getenv (); +#endif + +#ifndef NULL +#define NULL 0 +#endif + +int +getopt_long (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct option *long_options; + int *opt_index; +{ + return _getopt_internal (argc, argv, options, long_options, opt_index, 0); +} + +/* Like getopt_long, but '-' as well as '--' can indicate a long option. + If an option that starts with '-' (not '--') doesn't match a long option, + but does match a short option, it is parsed as a short option + instead. */ + +int +getopt_long_only (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct option *long_options; + int *opt_index; +{ + return _getopt_internal (argc, argv, options, long_options, opt_index, 1); +} + + +#endif /* _LIBC or not __GNU_LIBRARY__. */ + +#ifdef TEST + +#include + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + int option_index = 0; + static struct option long_options[] = + { + {"add", 1, 0, 0}, + {"append", 0, 0, 0}, + {"delete", 1, 0, 0}, + {"verbose", 0, 0, 0}, + {"create", 0, 0, 0}, + {"file", 1, 0, 0}, + {0, 0, 0, 0} + }; + + c = getopt_long (argc, argv, "abc:d:0123456789", + long_options, &option_index); + if (c == EOF) + break; + + switch (c) + { + case 0: + printf ("option %s", long_options[option_index].name); + if (optarg) + printf (" with arg %s", optarg); + printf ("\n"); + break; + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case 'd': + printf ("option d with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/libmisc/hamming.c b/libmisc/hamming.c new file mode 100644 index 0000000..cae1dd0 --- /dev/null +++ b/libmisc/hamming.c @@ -0,0 +1,44 @@ +/*****************************************************************************/ + +/* + * hamming.c -- Hamming Window. + * + * Copyright (C) 1999-2000, 2003 + * Thomas Sailer (t.sailer@alumni.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include "raisedcosine.h" + +/* --------------------------------------------------------------------- */ + +double hamming(double x) +{ + return 0.54-0.46*cos(2*M_PI*x); +} diff --git a/libmisc/openpty.c b/libmisc/openpty.c new file mode 100644 index 0000000..71d76e6 --- /dev/null +++ b/libmisc/openpty.c @@ -0,0 +1,83 @@ +/*****************************************************************************/ + +/* + * openpty.c -- openpty. + * + * From glibc2, Copyright (C) Free Software Foundation + * Modified by Thomas Sailer, sailer@ife.ee.ethz.ch + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*****************************************************************************/ + +#ifndef HAVE_OPENPTY + +#include +#include +#include +#include +#include +#include +#include +#include + +int openpty(int *amaster, int *aslave, char *name, struct termios *termp, struct winsize *winp) +{ + char line[11]; + const char *cp1, *cp2; + int master, slave, ttygid; + struct group *gr; + + strcpy (line, "/dev/ptyXX"); + if (gr = getgrnam("tty")) + ttygid = gr->gr_gid; + else + ttygid = -1; + for (cp1 = "pqrs"; *cp1; cp1++) { + line[8] = *cp1; + for (cp2 = "0123456789abcdef"; *cp2; cp2++) { + line[9] = *cp2; + if ((master = open(line, O_RDWR, 0)) == -1) { + if (errno == ENOENT) + return (-1); /* out of ptys */ + } else { + line[5] = 't'; + (void)chown(line, getuid(), ttygid); + (void)chmod(line, S_IRUSR|S_IWUSR|S_IWGRP); +#ifdef HAVE_REVOKE + revoke(line); +#endif + if ((slave = open(line, O_RDWR, 0)) != -1) { + *amaster = master; + *aslave = slave; + if (name) + strcpy(name, line); + if (termp) + (void)tcsetattr(slave, TCSAFLUSH, termp); + if (winp) + (void)ioctl(slave, TIOCSWINSZ, (char *)winp); + return 0; + } + (void)close(master); + line[5] = 'p'; + } + } + } + errno = ENOENT; /* out of ptys */ + return -1; +} + +#endif /* HAVE_OPENPTY */ diff --git a/libmisc/raisedcosine.h b/libmisc/raisedcosine.h new file mode 100644 index 0000000..a493e0b --- /dev/null +++ b/libmisc/raisedcosine.h @@ -0,0 +1,53 @@ +/*****************************************************************************/ + +/* + * raisedcosine.h -- Raised Cosine Functions. + * + * Copyright (C) 2002 + * Thomas Sailer (t.sailer@alumni.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + */ + +/*****************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifndef _RAISEDCOSINE_H +#define _RAISEDCOSINE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* --------------------------------------------------------------------- */ + +extern double sinc(double x); +extern double hamming(double x); +extern double raised_cosine_time(double time, double alpha); +extern double raised_cosine_freq(double freq, double alpha); +extern double root_raised_cosine_time(double time, double alpha); +extern double root_raised_cosine_freq(double freq, double alpha); + +/* --------------------------------------------------------------------- */ +#ifdef __cplusplus +} +#endif + +#endif /* _RAISEDCOSINE_H */ diff --git a/libmisc/random.c b/libmisc/random.c new file mode 100644 index 0000000..e20cca1 --- /dev/null +++ b/libmisc/random.c @@ -0,0 +1,40 @@ +/*****************************************************************************/ + +/* + * random.c -- Random Emulation (for mingw32). + * + * Copyright (C) 2000 + * Thomas Sailer + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + */ + +/*****************************************************************************/ + +#include + +/* --------------------------------------------------------------------- */ + +long int random(void) +{ + return rand(); +} + +void srandom(unsigned int seed) +{ + srand(seed); +} diff --git a/libmisc/rcfreq.c b/libmisc/rcfreq.c new file mode 100644 index 0000000..cd5af5e --- /dev/null +++ b/libmisc/rcfreq.c @@ -0,0 +1,52 @@ +/*****************************************************************************/ + +/* + * rcfreq.c -- Raised Cosine Function (Frequency Domain). + * + * Copyright (C) 2001, 2002 + * Thomas Sailer (t.sailer@alumni.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include "raisedcosine.h" + +/* --------------------------------------------------------------------- */ + +double raised_cosine_freq(double freq, double alpha) +{ + freq = fabs(freq); + freq -= 0.5 * (1 - alpha); + if (freq <= 0) + return 1; + if (freq >= alpha) + return 0; + freq /= alpha; + freq *= M_PI; + return 0.5 * (1 + cos(freq)); +} diff --git a/libmisc/rctime.c b/libmisc/rctime.c new file mode 100644 index 0000000..775f8a6 --- /dev/null +++ b/libmisc/rctime.c @@ -0,0 +1,58 @@ +/*****************************************************************************/ + +/* + * rctime.c -- Raised Cosine Function (Time Domain). + * + * Copyright (C) 2001, 2002 + * Thomas Sailer (t.sailer@alumni.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include "raisedcosine.h" + +/* --------------------------------------------------------------------- */ + +/* + * sinc(pi t) cos(pi alpha t) / [ 1 - (2 alpha t)^2 ] + */ + +double raised_cosine_time(double time, double alpha) +{ + float f1, f2, alphatime; + + if (fabs(alpha) < 1e-8) + return sinc(time); + alphatime = time * alpha; + f1 = 1 - 4 * alphatime * alphatime; + if (fabs(f1) < 1e-10) + f2 = M_PI / 4.0; + else + f2 = cos(M_PI * alphatime) / f1; + return sinc(time) * f2; +} diff --git a/libmisc/rrcfreq.c b/libmisc/rrcfreq.c new file mode 100644 index 0000000..6aae11a --- /dev/null +++ b/libmisc/rrcfreq.c @@ -0,0 +1,52 @@ +/*****************************************************************************/ + +/* + * rrcfreq.c -- Square Root Raised Cosine Function (Frequency Domain). + * + * Copyright (C) 2001, 2002 + * Thomas Sailer (t.sailer@alumni.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include "raisedcosine.h" + +/* --------------------------------------------------------------------- */ + +double root_raised_cosine_freq(double freq, double alpha) +{ + freq = fabs(freq); + freq -= 0.5 * (1 - alpha); + if (freq <= 0) + return 1; + if (freq >= alpha) + return 0; + freq /= alpha; + freq *= M_PI; + return sqrt(0.5 * (1 + cos(freq))); +} diff --git a/libmisc/rrctime.c b/libmisc/rrctime.c new file mode 100644 index 0000000..086111a --- /dev/null +++ b/libmisc/rrctime.c @@ -0,0 +1,62 @@ +/*****************************************************************************/ + +/* + * rrctime.c -- Square Root Raised Cosine Function (Time Domain). + * + * Copyright (C) 2001, 2002 + * Thomas Sailer (t.sailer@alumni.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include "raisedcosine.h" + +/* --------------------------------------------------------------------- */ + +/* + * see Huber: Trelliscodierung, S. 15, or ptolemy source code + * + * [ (4 alpha t) cos( pi (1+alpha) t) + sin (pi (1 - alpha)t) ] / [ (pi t) (1 - (4 alpha t)^2) ] + */ + +double root_raised_cosine_time(double time, double alpha) +{ + float opap, omap, at4, omat4sq; + + if (fabs(alpha) < 1e-8) + return sinc(time); + if (fabs(time) < 1e-8) + return ((4.0 / M_PI) - 1.0) * alpha + 1.0; + opap = (1.0 + alpha) * M_PI; + omap = (1.0 - alpha) * M_PI; + at4 = alpha * time * 4; + omat4sq = 1 - at4 * at4; + if (fabs(omat4sq) < 1e-8) + return ((4.0 * alpha) * cos(opap * time) - at4 * opap * sin(opap * time) + omap * cos(omap * time)) / (1 - 3 * at4 * at4) * (1.0 / M_PI); + return (4.0 / M_PI) * alpha / omat4sq * (cos(opap * time) + sin(omap * time) / at4); +} diff --git a/libmisc/sinc.c b/libmisc/sinc.c new file mode 100644 index 0000000..fc9a025 --- /dev/null +++ b/libmisc/sinc.c @@ -0,0 +1,48 @@ +/*****************************************************************************/ + +/* + * sinc.c -- sinc aka sin(x)/x. + * + * Copyright (C) 2001, 2002 + * Thomas Sailer (t.sailer@alumni.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include "raisedcosine.h" + +/* --------------------------------------------------------------------- */ + +double sinc(double x) +{ + double arg = x * M_PI; + + if (fabs(arg) < 1e-10) + return 1; + return sin(arg) / arg; +} diff --git a/libmisc/vsnprintf.c b/libmisc/vsnprintf.c new file mode 100644 index 0000000..0b9ab56 --- /dev/null +++ b/libmisc/vsnprintf.c @@ -0,0 +1,194 @@ +/* + * This file is derived from GLIB by Thomas Sailer, + * + * + * GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library 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. + */ + +#include +#include +#include +#include +#include + +static unsigned int printf_string_upper_bound (const char *format, va_list args) +{ + unsigned int len = 1; + + while (*format) { + int long_int = 0; + int extra_long = 0; + char c; + + c = *format++; + + if (c == '%') { + int done = 0; + + while (*format && !done) { + switch (*format++) { + char *string_arg; + + case '*': + len += va_arg (args, int); + break; + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + /* add specified format length, since it might exceed the + * size we assume it to have. + */ + format -= 1; + len += strtol (format, (char**) &format, 10); + break; + case 'h': + /* ignore short int flag, since all args have at least the + * same size as an int + */ + break; + case 'l': + if (long_int) + extra_long = 1; /* linux specific */ + else + long_int = 1; + break; + case 'q': + case 'L': + long_int = 1; + extra_long = 1; + break; + case 's': + string_arg = va_arg (args, char *); + if (string_arg) + len += strlen (string_arg); + else { + /* add enough padding to hold "(null)" identifier */ + len += 16; + } + done = 1; + break; + case 'd': + case 'i': + case 'o': + case 'u': + case 'x': + case 'X': + if (long_int) + (void) va_arg (args, long); + else + (void) va_arg (args, int); + len += extra_long ? 64 : 32; + done = 1; + break; + case 'D': + case 'O': + case 'U': + (void) va_arg (args, long); + len += 32; + done = 1; + break; + case 'e': + case 'E': + case 'f': + case 'g': + (void) va_arg (args, double); + len += extra_long ? 64 : 32; + done = 1; + break; + case 'c': + (void) va_arg (args, int); + len += 1; + done = 1; + break; + case 'p': + case 'n': + (void) va_arg (args, void*); + len += 32; + done = 1; + break; + case '%': + len += 1; + done = 1; + break; + default: + /* ignore unknow/invalid flags */ + break; + } + } + } + else + len += 1; + } + return len; +} + +/* WARNING: This does only work for i386 (plus a few others, but not eg. alpha) !!!! */ +#define VA_COPY(x,y) (x) = (y) + +static char *strdup_vprintf (const char *format, va_list args1) +{ + char *buffer; + va_list args2; + + VA_COPY (args2, args1); + buffer = malloc(printf_string_upper_bound (format, args1)); + if (buffer) + vsprintf (buffer, format, args2); + va_end (args2); + return buffer; +} + +int snprintf (char *str, size_t n, char const *fmt, ...) +{ + char *printed; + va_list args; + int len; + + va_start(args, fmt); + printed = strdup_vprintf (fmt, args); + va_end (args); + if (!printed) + return -1; + len = strlen(printed); + strncpy(str, printed, n); + str[n-1] = '\0'; + free(printed); + return len >= n ? -1 : len; +} + +int vsnprintf (char *str, size_t n, char const *fmt, va_list args) +{ + char *printed; + int len; + + printed = strdup_vprintf (fmt, args); + if (!printed) + return -1; + len = strlen(printed); + strncpy(str, printed, n); + str[n-1] = '\0'; + free(printed); + return len >= n ? -1 : len; +} diff --git a/m4/ChangeLog b/m4/ChangeLog new file mode 100644 index 0000000..89eb165 --- /dev/null +++ b/m4/ChangeLog @@ -0,0 +1,11 @@ +2011-06-18 gettextize + + * gettext.m4: New file, from gettext-0.18.1. + * iconv.m4: New file, from gettext-0.18.1. + * lib-ld.m4: New file, from gettext-0.18.1. + * lib-link.m4: New file, from gettext-0.18.1. + * lib-prefix.m4: New file, from gettext-0.18.1. + * nls.m4: New file, from gettext-0.18.1. + * po.m4: New file, from gettext-0.18.1. + * progtest.m4: New file, from gettext-0.18.1. + diff --git a/m4/gettext.m4 b/m4/gettext.m4 new file mode 100644 index 0000000..f84e6a5 --- /dev/null +++ b/m4/gettext.m4 @@ -0,0 +1,383 @@ +# gettext.m4 serial 63 (gettext-0.18) +dnl Copyright (C) 1995-2010 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2006, 2008-2010. + +dnl Macro to add for using GNU gettext. + +dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). +dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The +dnl default (if it is not specified or empty) is 'no-libtool'. +dnl INTLSYMBOL should be 'external' for packages with no intl directory, +dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. +dnl If INTLSYMBOL is 'use-libtool', then a libtool library +dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, +dnl depending on --{enable,disable}-{shared,static} and on the presence of +dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library +dnl $(top_builddir)/intl/libintl.a will be created. +dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext +dnl implementations (in libc or libintl) without the ngettext() function +dnl will be ignored. If NEEDSYMBOL is specified and is +dnl 'need-formatstring-macros', then GNU gettext implementations that don't +dnl support the ISO C 99 formatstring macros will be ignored. +dnl INTLDIR is used to find the intl libraries. If empty, +dnl the value `$(top_builddir)/intl/' is used. +dnl +dnl The result of the configuration is one of three cases: +dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled +dnl and used. +dnl Catalog format: GNU --> install in $(datadir) +dnl Catalog extension: .mo after installation, .gmo in source tree +dnl 2) GNU gettext has been found in the system's C library. +dnl Catalog format: GNU --> install in $(datadir) +dnl Catalog extension: .mo after installation, .gmo in source tree +dnl 3) No internationalization, always use English msgid. +dnl Catalog format: none +dnl Catalog extension: none +dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur. +dnl The use of .gmo is historical (it was needed to avoid overwriting the +dnl GNU format catalogs when building on a platform with an X/Open gettext), +dnl but we keep it in order not to force irrelevant filename changes on the +dnl maintainers. +dnl +AC_DEFUN([AM_GNU_GETTEXT], +[ + dnl Argument checking. + ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , + [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT +])])])])]) + ifelse(ifelse([$1], [], [old])[]ifelse([$1], [no-libtool], [old]), [old], + [AC_DIAGNOSE([obsolete], [Use of AM_GNU_GETTEXT without [external] argument is deprecated.])]) + ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , + [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT +])])])]) + define([gt_included_intl], + ifelse([$1], [external], + ifdef([AM_GNU_GETTEXT_][INTL_SUBDIR], [yes], [no]), + [yes])) + define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], [])) + gt_NEEDS_INIT + AM_GNU_GETTEXT_NEED([$2]) + + AC_REQUIRE([AM_PO_SUBDIRS])dnl + ifelse(gt_included_intl, yes, [ + AC_REQUIRE([AM_INTL_SUBDIR])dnl + ]) + + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Sometimes libintl requires libiconv, so first search for libiconv. + dnl Ideally we would do this search only after the + dnl if test "$USE_NLS" = "yes"; then + dnl if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then + dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT + dnl the configure script would need to contain the same shell code + dnl again, outside any 'if'. There are two solutions: + dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. + dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. + dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not + dnl documented, we avoid it. + ifelse(gt_included_intl, yes, , [ + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) + ]) + + dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation. + gt_INTL_MACOSX + + dnl Set USE_NLS. + AC_REQUIRE([AM_NLS]) + + ifelse(gt_included_intl, yes, [ + BUILD_INCLUDED_LIBINTL=no + USE_INCLUDED_LIBINTL=no + ]) + LIBINTL= + LTLIBINTL= + POSUB= + + dnl Add a version number to the cache macros. + case " $gt_needs " in + *" need-formatstring-macros "*) gt_api_version=3 ;; + *" need-ngettext "*) gt_api_version=2 ;; + *) gt_api_version=1 ;; + esac + gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc" + gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl" + + dnl If we use NLS figure out what method + if test "$USE_NLS" = "yes"; then + gt_use_preinstalled_gnugettext=no + ifelse(gt_included_intl, yes, [ + AC_MSG_CHECKING([whether included gettext is requested]) + AC_ARG_WITH([included-gettext], + [ --with-included-gettext use the GNU gettext library included here], + nls_cv_force_use_gnu_gettext=$withval, + nls_cv_force_use_gnu_gettext=no) + AC_MSG_RESULT([$nls_cv_force_use_gnu_gettext]) + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + ]) + dnl User does not insist on using GNU NLS library. Figure out what + dnl to use. If GNU gettext is available we use this. Else we have + dnl to fall back to GNU NLS library. + + if test $gt_api_version -ge 3; then + gt_revision_test_code=' +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +changequote(,)dnl +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +changequote([,])dnl +' + else + gt_revision_test_code= + fi + if test $gt_api_version -ge 2; then + gt_expression_test_code=' + * ngettext ("", "", 0)' + else + gt_expression_test_code= + fi + + AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc], + [AC_TRY_LINK([#include +$gt_revision_test_code +extern int _nl_msg_cat_cntr; +extern int *_nl_domain_bindings;], + [bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings], + [eval "$gt_func_gnugettext_libc=yes"], + [eval "$gt_func_gnugettext_libc=no"])]) + + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then + dnl Sometimes libintl requires libiconv, so first search for libiconv. + ifelse(gt_included_intl, yes, , [ + AM_ICONV_LINK + ]) + dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL + dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) + dnl because that would add "-liconv" to LIBINTL and LTLIBINTL + dnl even if libiconv doesn't exist. + AC_LIB_LINKFLAGS_BODY([intl]) + AC_CACHE_CHECK([for GNU gettext in libintl], + [$gt_func_gnugettext_libintl], + [gt_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCINTL" + gt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBINTL" + dnl Now see whether libintl exists and does not depend on libiconv. + AC_TRY_LINK([#include +$gt_revision_test_code +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (const char *);], + [bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")], + [eval "$gt_func_gnugettext_libintl=yes"], + [eval "$gt_func_gnugettext_libintl=no"]) + dnl Now see whether libintl exists and depends on libiconv. + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then + LIBS="$LIBS $LIBICONV" + AC_TRY_LINK([#include +$gt_revision_test_code +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (const char *);], + [bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")], + [LIBINTL="$LIBINTL $LIBICONV" + LTLIBINTL="$LTLIBINTL $LTLIBICONV" + eval "$gt_func_gnugettext_libintl=yes" + ]) + fi + CPPFLAGS="$gt_save_CPPFLAGS" + LIBS="$gt_save_LIBS"]) + fi + + dnl If an already present or preinstalled GNU gettext() is found, + dnl use it. But if this macro is used in GNU gettext, and GNU + dnl gettext is already preinstalled in libintl, we update this + dnl libintl. (Cf. the install rule in intl/Makefile.in.) + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ + || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ + && test "$PACKAGE" != gettext-runtime \ + && test "$PACKAGE" != gettext-tools; }; then + gt_use_preinstalled_gnugettext=yes + else + dnl Reset the values set by searching for libintl. + LIBINTL= + LTLIBINTL= + INCINTL= + fi + + ifelse(gt_included_intl, yes, [ + if test "$gt_use_preinstalled_gnugettext" != "yes"; then + dnl GNU gettext is not found in the C library. + dnl Fall back on included GNU gettext library. + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions used to generate GNU NLS library. + BUILD_INCLUDED_LIBINTL=yes + USE_INCLUDED_LIBINTL=yes + LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV $LIBTHREAD" + LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV $LTLIBTHREAD" + LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` + fi + + CATOBJEXT= + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions to use GNU gettext tools. + CATOBJEXT=.gmo + fi + ]) + + if test -n "$INTL_MACOSX_LIBS"; then + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Some extra flags are needed during linking. + LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" + LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" + fi + fi + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + AC_DEFINE([ENABLE_NLS], [1], + [Define to 1 if translation of program messages to the user's native language + is requested.]) + else + USE_NLS=no + fi + fi + + AC_MSG_CHECKING([whether to use NLS]) + AC_MSG_RESULT([$USE_NLS]) + if test "$USE_NLS" = "yes"; then + AC_MSG_CHECKING([where the gettext function comes from]) + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then + gt_source="external libintl" + else + gt_source="libc" + fi + else + gt_source="included intl directory" + fi + AC_MSG_RESULT([$gt_source]) + fi + + if test "$USE_NLS" = "yes"; then + + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then + AC_MSG_CHECKING([how to link with libintl]) + AC_MSG_RESULT([$LIBINTL]) + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) + fi + + dnl For backward compatibility. Some packages may be using this. + AC_DEFINE([HAVE_GETTEXT], [1], + [Define if the GNU gettext() function is already present or preinstalled.]) + AC_DEFINE([HAVE_DCGETTEXT], [1], + [Define if the GNU dcgettext() function is already present or preinstalled.]) + fi + + dnl We need to process the po/ directory. + POSUB=po + fi + + ifelse(gt_included_intl, yes, [ + dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL + dnl to 'yes' because some of the testsuite requires it. + if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then + BUILD_INCLUDED_LIBINTL=yes + fi + + dnl Make all variables we use known to autoconf. + AC_SUBST([BUILD_INCLUDED_LIBINTL]) + AC_SUBST([USE_INCLUDED_LIBINTL]) + AC_SUBST([CATOBJEXT]) + + dnl For backward compatibility. Some configure.ins may be using this. + nls_cv_header_intl= + nls_cv_header_libgt= + + dnl For backward compatibility. Some Makefiles may be using this. + DATADIRNAME=share + AC_SUBST([DATADIRNAME]) + + dnl For backward compatibility. Some Makefiles may be using this. + INSTOBJEXT=.mo + AC_SUBST([INSTOBJEXT]) + + dnl For backward compatibility. Some Makefiles may be using this. + GENCAT=gencat + AC_SUBST([GENCAT]) + + dnl For backward compatibility. Some Makefiles may be using this. + INTLOBJS= + if test "$USE_INCLUDED_LIBINTL" = yes; then + INTLOBJS="\$(GETTOBJS)" + fi + AC_SUBST([INTLOBJS]) + + dnl Enable libtool support if the surrounding package wishes it. + INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix + AC_SUBST([INTL_LIBTOOL_SUFFIX_PREFIX]) + ]) + + dnl For backward compatibility. Some Makefiles may be using this. + INTLLIBS="$LIBINTL" + AC_SUBST([INTLLIBS]) + + dnl Make all documented variables known to autoconf. + AC_SUBST([LIBINTL]) + AC_SUBST([LTLIBINTL]) + AC_SUBST([POSUB]) +]) + + +dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized. +m4_define([gt_NEEDS_INIT], +[ + m4_divert_text([DEFAULTS], [gt_needs=]) + m4_define([gt_NEEDS_INIT], []) +]) + + +dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL]) +AC_DEFUN([AM_GNU_GETTEXT_NEED], +[ + m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"]) +]) + + +dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) +AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) diff --git a/m4/iconv.m4 b/m4/iconv.m4 new file mode 100644 index 0000000..e2041b9 --- /dev/null +++ b/m4/iconv.m4 @@ -0,0 +1,214 @@ +# iconv.m4 serial 11 (gettext-0.18.1) +dnl Copyright (C) 2000-2002, 2007-2010 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], +[ + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([iconv]) +]) + +AC_DEFUN([AM_ICONV_LINK], +[ + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and + dnl those with the standalone portable GNU libiconv installed). + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) + + dnl Add $INCICONV to CPPFLAGS before performing the following checks, + dnl because if the user has installed libiconv and not disabled its use + dnl via --without-libiconv-prefix, he wants to use it. The first + dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. + am_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) + + AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [ + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + [am_cv_func_iconv=yes]) + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + [am_cv_lib_iconv=yes] + [am_cv_func_iconv=yes]) + LIBS="$am_save_LIBS" + fi + ]) + if test "$am_cv_func_iconv" = yes; then + AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [ + dnl This tests against bugs in AIX 5.1, HP-UX 11.11, Solaris 10. + am_save_LIBS="$LIBS" + if test $am_cv_lib_iconv = yes; then + LIBS="$LIBS $LIBICONV" + fi + AC_TRY_RUN([ +#include +#include +int main () +{ + /* Test against AIX 5.1 bug: Failures are not distinguishable from successful + returns. */ + { + iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); + if (cd_utf8_to_88591 != (iconv_t)(-1)) + { + static const char input[] = "\342\202\254"; /* EURO SIGN */ + char buf[10]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_utf8_to_88591, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + return 1; + } + } + /* Test against Solaris 10 bug: Failures are not distinguishable from + successful returns. */ + { + iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); + if (cd_ascii_to_88591 != (iconv_t)(-1)) + { + static const char input[] = "\263"; + char buf[10]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_ascii_to_88591, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + return 1; + } + } +#if 0 /* This bug could be worked around by the caller. */ + /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + char buf[50]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_88591_to_utf8, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if ((int)res > 0) + return 1; + } + } +#endif + /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is + provided. */ + if (/* Try standardized names. */ + iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) + /* Try IRIX, OSF/1 names. */ + && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) + /* Try AIX names. */ + && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) + /* Try HP-UX names. */ + && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) + return 1; + return 0; +}], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no], + [case "$host_os" in + aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; + *) am_cv_func_iconv_works="guessing yes" ;; + esac]) + LIBS="$am_save_LIBS" + ]) + case "$am_cv_func_iconv_works" in + *no) am_func_iconv=no am_cv_lib_iconv=no ;; + *) am_func_iconv=yes ;; + esac + else + am_func_iconv=no am_cv_lib_iconv=no + fi + if test "$am_func_iconv" = yes; then + AC_DEFINE([HAVE_ICONV], [1], + [Define if you have the iconv() function and it works.]) + fi + if test "$am_cv_lib_iconv" = yes; then + AC_MSG_CHECKING([how to link with libiconv]) + AC_MSG_RESULT([$LIBICONV]) + else + dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV + dnl either. + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + AC_SUBST([LIBICONV]) + AC_SUBST([LTLIBICONV]) +]) + +dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to +dnl avoid warnings like +dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required". +dnl This is tricky because of the way 'aclocal' is implemented: +dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN. +dnl Otherwise aclocal's initial scan pass would miss the macro definition. +dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions. +dnl Otherwise aclocal would emit many "Use of uninitialized value $1" +dnl warnings. +m4_define([gl_iconv_AC_DEFUN], + m4_version_prereq([2.64], + [[AC_DEFUN_ONCE( + [$1], [$2])]], + [[AC_DEFUN( + [$1], [$2])]])) +gl_iconv_AC_DEFUN([AM_ICONV], +[ + AM_ICONV_LINK + if test "$am_cv_func_iconv" = yes; then + AC_MSG_CHECKING([for iconv declaration]) + AC_CACHE_VAL([am_cv_proto_iconv], [ + AC_TRY_COMPILE([ +#include +#include +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif +], [], [am_cv_proto_iconv_arg1=""], [am_cv_proto_iconv_arg1="const"]) + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) + am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + AC_MSG_RESULT([ + $am_cv_proto_iconv]) + AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1], + [Define as const if the declaration of iconv() needs const.]) + fi +]) diff --git a/m4/lib-ld.m4 b/m4/lib-ld.m4 new file mode 100644 index 0000000..ebb3052 --- /dev/null +++ b/m4/lib-ld.m4 @@ -0,0 +1,110 @@ +# lib-ld.m4 serial 4 (gettext-0.18) +dnl Copyright (C) 1996-2003, 2009-2010 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Subroutines of libtool.m4, +dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision +dnl with libtool.m4. + +dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. +AC_DEFUN([AC_LIB_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld], +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +case `$LD -v 2>&1 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 +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]* | [A-Za-z]:[\\/]*)] + [re_direlt='/[^/][^/]*/\.\./'] + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL([acl_cv_path_LD], +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in + *GNU* | *'with BFD'*) + test "$with_gnu_ld" != no && break ;; + *) + test "$with_gnu_ld" != yes && break ;; + esac + fi + done + IFS="$ac_save_ifs" +else + acl_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$acl_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT([$LD]) +else + AC_MSG_RESULT([no]) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_LIB_PROG_LD_GNU +]) diff --git a/m4/lib-link.m4 b/m4/lib-link.m4 new file mode 100644 index 0000000..c73bd8e --- /dev/null +++ b/m4/lib-link.m4 @@ -0,0 +1,774 @@ +# lib-link.m4 serial 21 (gettext-0.18) +dnl Copyright (C) 2001-2010 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +AC_PREREQ([2.54]) + +dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and +dnl augments the CPPFLAGS variable. +dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname +dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. +AC_DEFUN([AC_LIB_LINKFLAGS], +[ + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + pushdef([Name],[translit([$1],[./-], [___])]) + pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ + AC_LIB_LINKFLAGS_BODY([$1], [$2]) + ac_cv_lib[]Name[]_libs="$LIB[]NAME" + ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" + ac_cv_lib[]Name[]_cppflags="$INC[]NAME" + ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX" + ]) + LIB[]NAME="$ac_cv_lib[]Name[]_libs" + LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" + INC[]NAME="$ac_cv_lib[]Name[]_cppflags" + LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) + AC_SUBST([LIB]NAME) + AC_SUBST([LTLIB]NAME) + AC_SUBST([LIB]NAME[_PREFIX]) + dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the + dnl results of this search when this library appears as a dependency. + HAVE_LIB[]NAME=yes + popdef([NAME]) + popdef([Name]) +]) + +dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message]) +dnl searches for libname and the libraries corresponding to explicit and +dnl implicit dependencies, together with the specified include files and +dnl the ability to compile and link the specified testcode. The missing-message +dnl defaults to 'no' and may contain additional hints for the user. +dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} +dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and +dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs +dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. +dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname +dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. +AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], +[ + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + pushdef([Name],[translit([$1],[./-], [___])]) + pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + + dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([$1], [$2]) + + dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, + dnl because if the user has installed lib[]Name and not disabled its use + dnl via --without-lib[]Name-prefix, he wants to use it. + ac_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) + + AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ + ac_save_LIBS="$LIBS" + dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS, + dnl because these -l options might require -L options that are present in + dnl LIBS. -l options benefit only from the -L options listed before it. + dnl Otherwise, add it to the front of LIBS, because it may be a static + dnl library that depends on another static library that is present in LIBS. + dnl Static libraries benefit only from the static libraries listed after + dnl it. + case " $LIB[]NAME" in + *" -l"*) LIBS="$LIBS $LIB[]NAME" ;; + *) LIBS="$LIB[]NAME $LIBS" ;; + esac + AC_TRY_LINK([$3], [$4], + [ac_cv_lib[]Name=yes], + [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])']) + LIBS="$ac_save_LIBS" + ]) + if test "$ac_cv_lib[]Name" = yes; then + HAVE_LIB[]NAME=yes + AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.]) + AC_MSG_CHECKING([how to link with lib[]$1]) + AC_MSG_RESULT([$LIB[]NAME]) + else + HAVE_LIB[]NAME=no + dnl If $LIB[]NAME didn't lead to a usable library, we don't need + dnl $INC[]NAME either. + CPPFLAGS="$ac_save_CPPFLAGS" + LIB[]NAME= + LTLIB[]NAME= + LIB[]NAME[]_PREFIX= + fi + AC_SUBST([HAVE_LIB]NAME) + AC_SUBST([LIB]NAME) + AC_SUBST([LTLIB]NAME) + AC_SUBST([LIB]NAME[_PREFIX]) + popdef([NAME]) + popdef([Name]) +]) + +dnl Determine the platform dependent parameters needed to use rpath: +dnl acl_libext, +dnl acl_shlibext, +dnl acl_hardcode_libdir_flag_spec, +dnl acl_hardcode_libdir_separator, +dnl acl_hardcode_direct, +dnl acl_hardcode_minus_L. +AC_DEFUN([AC_LIB_RPATH], +[ + dnl Tell automake >= 1.10 to complain if config.rpath is missing. + m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) + AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS + AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld + AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host + AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir + AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [ + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + ]) + wl="$acl_cv_wl" + acl_libext="$acl_cv_libext" + acl_shlibext="$acl_cv_shlibext" + acl_libname_spec="$acl_cv_libname_spec" + acl_library_names_spec="$acl_cv_library_names_spec" + acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + acl_hardcode_direct="$acl_cv_hardcode_direct" + acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" + dnl Determine whether the user wants rpath handling at all. + AC_ARG_ENABLE([rpath], + [ --disable-rpath do not hardcode runtime library paths], + :, enable_rpath=yes) +]) + +dnl AC_LIB_FROMPACKAGE(name, package) +dnl declares that libname comes from the given package. The configure file +dnl will then not have a --with-libname-prefix option but a +dnl --with-package-prefix option. Several libraries can come from the same +dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar +dnl macro call that searches for libname. +AC_DEFUN([AC_LIB_FROMPACKAGE], +[ + pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + define([acl_frompackage_]NAME, [$2]) + popdef([NAME]) + pushdef([PACK],[$2]) + pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + define([acl_libsinpackage_]PACKUP, + m4_ifdef([acl_libsinpackage_]PACKUP, [acl_libsinpackage_]PACKUP[[, ]],)[lib$1]) + popdef([PACKUP]) + popdef([PACK]) +]) + +dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. +dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found +dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem. +AC_DEFUN([AC_LIB_LINKFLAGS_BODY], +[ + AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) + pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])]) + pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) + dnl Autoconf >= 2.61 supports dots in --with options. + pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit(PACK,[.],[_])],PACK)]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_ARG_WITH(P_A_C_K[-prefix], +[[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib + --without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + if test "$acl_libdirstem2" != "$acl_libdirstem" \ + && ! test -d "$withval/$acl_libdirstem"; then + additional_libdir="$withval/$acl_libdirstem2" + fi + fi + fi +]) + dnl Search the library and its dependencies in $additional_libdir and + dnl $LDFLAGS. Using breadth-first-seach. + LIB[]NAME= + LTLIB[]NAME= + INC[]NAME= + LIB[]NAME[]_PREFIX= + dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been + dnl computed. So it has to be reset here. + HAVE_LIB[]NAME= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='$1 $2' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + dnl See if it was already located by an earlier AC_LIB_LINKFLAGS + dnl or AC_LIB_HAVE_LINKFLAGS call. + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" + else + dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined + dnl that this library doesn't exist. So just drop it. + : + fi + else + dnl Search the library lib$name in $additional_libdir and $LDFLAGS + dnl and the already constructed $LIBNAME/$LTLIBNAME. + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + dir="$additional_libdir" + dnl The same code as in the loop below: + dnl First look for a shared library. + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + dnl Then look for a static library. + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + dnl First look for a shared library. + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + dnl Then look for a static library. + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + dnl Found the library. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + dnl Linking with a shared library. We attempt to hardcode its + dnl directory into the executable's runpath, unless it's the + dnl standard /usr/lib. + if test "$enable_rpath" = no \ + || test "X$found_dir" = "X/usr/$acl_libdirstem" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then + dnl No hardcoding is needed. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + dnl The hardcoding into $LIBNAME is system dependent. + if test "$acl_hardcode_direct" = yes; then + dnl Using DIR/libNAME.so during linking hardcodes DIR into the + dnl resulting binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + dnl Rely on "-L$found_dir". + dnl But don't add it if it's already contained in the LDFLAGS + dnl or the already constructed $LIBNAME + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" + fi + if test "$acl_hardcode_minus_L" != no; then + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH + dnl here, because this doesn't fit in flags passed to the + dnl compiler. So give up. No hardcoding. This affects only + dnl very old systems. + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + dnl Linking with a static library. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" + else + dnl We shouldn't come here, but anyway it's good to have a + dnl fallback. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" + fi + fi + dnl Assume the include files are nearby. + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + if test "$name" = '$1'; then + LIB[]NAME[]_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem2 | */$acl_libdirstem2/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` + if test "$name" = '$1'; then + LIB[]NAME[]_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + dnl Potentially add $additional_includedir to $INCNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's /usr/local/include and we are using GCC on Linux, + dnl 3. if it's already present in $CPPFLAGS or the already + dnl constructed $INCNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INC[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $INCNAME. + INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + dnl Look for dependencies. + if test -n "$found_la"; then + dnl Read the .la file. It defines the variables + dnl dlname, library_names, old_library, dependency_libs, current, + dnl age, revision, installed, dlopen, dlpreopen, libdir. + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + dnl We use only dependency_libs. + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's /usr/local/lib and we are using GCC on Linux, + dnl 3. if it's already present in $LDFLAGS or the already + dnl constructed $LIBNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LIBNAME. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LTLIBNAME. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + dnl Handle this in the next round. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + dnl Handle this in the next round. Throw away the .la's + dnl directory; it is already contained in a preceding -L + dnl option. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + dnl Most likely an immediate library name. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" + ;; + esac + done + fi + else + dnl Didn't find the library; assume it is in the system directories + dnl known to the linker and runtime loader. (All the system + dnl directories known to the linker should also be known to the + dnl runtime loader, otherwise the system is severely misconfigured.) + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$acl_hardcode_libdir_separator"; then + dnl Weird platform: only the last -rpath option counts, the user must + dnl pass all path elements in one option. We can arrange that for a + dnl single library, but not when more than one $LIBNAMEs are used. + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" + done + dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl. + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + else + dnl The -rpath options are cumulative. + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + dnl When using libtool, the option that works for both libraries and + dnl executables is -R. The -R options are cumulative. + for found_dir in $ltrpathdirs; do + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" + done + fi + popdef([P_A_C_K]) + popdef([PACKLIBS]) + popdef([PACKUP]) + popdef([PACK]) + popdef([NAME]) +]) + +dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, +dnl unless already present in VAR. +dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes +dnl contains two or three consecutive elements that belong together. +AC_DEFUN([AC_LIB_APPENDTOVAR], +[ + for element in [$2]; do + haveit= + for x in $[$1]; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + [$1]="${[$1]}${[$1]:+ }$element" + fi + done +]) + +dnl For those cases where a variable contains several -L and -l options +dnl referring to unknown libraries and directories, this macro determines the +dnl necessary additional linker options for the runtime path. +dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL]) +dnl sets LDADDVAR to linker options needed together with LIBSVALUE. +dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed, +dnl otherwise linking without libtool is assumed. +AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], +[ + AC_REQUIRE([AC_LIB_RPATH]) + AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) + $1= + if test "$enable_rpath" != no; then + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + dnl Use an explicit option to hardcode directories into the resulting + dnl binary. + rpathdirs= + next= + for opt in $2; do + if test -n "$next"; then + dir="$next" + dnl No need to hardcode the standard /usr/lib. + if test "X$dir" != "X/usr/$acl_libdirstem" \ + && test "X$dir" != "X/usr/$acl_libdirstem2"; then + rpathdirs="$rpathdirs $dir" + fi + next= + else + case $opt in + -L) next=yes ;; + -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` + dnl No need to hardcode the standard /usr/lib. + if test "X$dir" != "X/usr/$acl_libdirstem" \ + && test "X$dir" != "X/usr/$acl_libdirstem2"; then + rpathdirs="$rpathdirs $dir" + fi + next= ;; + *) next= ;; + esac + fi + done + if test "X$rpathdirs" != "X"; then + if test -n ""$3""; then + dnl libtool is used for linking. Use -R options. + for dir in $rpathdirs; do + $1="${$1}${$1:+ }-R$dir" + done + else + dnl The linker is used for linking directly. + if test -n "$acl_hardcode_libdir_separator"; then + dnl Weird platform: only the last -rpath option counts, the user + dnl must pass all path elements in one option. + alldirs= + for dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + $1="$flag" + else + dnl The -rpath options are cumulative. + for dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + $1="${$1}${$1:+ }$flag" + done + fi + fi + fi + fi + fi + AC_SUBST([$1]) +]) diff --git a/m4/lib-prefix.m4 b/m4/lib-prefix.m4 new file mode 100644 index 0000000..1601cea --- /dev/null +++ b/m4/lib-prefix.m4 @@ -0,0 +1,224 @@ +# lib-prefix.m4 serial 7 (gettext-0.18) +dnl Copyright (C) 2001-2005, 2008-2010 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and +dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't +dnl require excessive bracketing. +ifdef([AC_HELP_STRING], +[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], +[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) + +dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed +dnl to access previously installed libraries. The basic assumption is that +dnl a user will want packages to use other packages he previously installed +dnl with the same --prefix option. +dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate +dnl libraries, but is otherwise very convenient. +AC_DEFUN([AC_LIB_PREFIX], +[ + AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_LIB_ARG_WITH([lib-prefix], +[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib + --without-lib-prefix don't search for libraries in includedir and libdir], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + fi + fi +]) + if test $use_additional = yes; then + dnl Potentially add $additional_includedir to $CPPFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's already present in $CPPFLAGS, + dnl 3. if it's /usr/local/include and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + for x in $CPPFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $CPPFLAGS. + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" + fi + fi + fi + fi + dnl Potentially add $additional_libdir to $LDFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's already present in $LDFLAGS, + dnl 3. if it's /usr/local/lib and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then + haveit= + for x in $LDFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LDFLAGS. + LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" + fi + fi + fi + fi + fi +]) + +dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, +dnl acl_final_exec_prefix, containing the values to which $prefix and +dnl $exec_prefix will expand at the end of the configure script. +AC_DEFUN([AC_LIB_PREPARE_PREFIX], +[ + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" +]) + +dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the +dnl variables prefix and exec_prefix bound to the values they will have +dnl at the end of the configure script. +AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], +[ + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + $1 + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" +]) + +dnl AC_LIB_PREPARE_MULTILIB creates +dnl - a variable acl_libdirstem, containing the basename of the libdir, either +dnl "lib" or "lib64" or "lib/64", +dnl - a variable acl_libdirstem2, as a secondary possible value for +dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or +dnl "lib/amd64". +AC_DEFUN([AC_LIB_PREPARE_MULTILIB], +[ + dnl There is no formal standard regarding lib and lib64. + dnl On glibc systems, the current practice is that on a system supporting + dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under + dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine + dnl the compiler's default mode by looking at the compiler's library search + dnl path. If at least one of its elements ends in /lib64 or points to a + dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI. + dnl Otherwise we use the default, namely "lib". + dnl On Solaris systems, the current practice is that on a system supporting + dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under + dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or + dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib. + AC_REQUIRE([AC_CANONICAL_HOST]) + acl_libdirstem=lib + acl_libdirstem2= + case "$host_os" in + solaris*) + dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment + dnl . + dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." + dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the + dnl symlink is missing, so we set acl_libdirstem2 too. + AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit], + [AC_EGREP_CPP([sixtyfour bits], [ +#ifdef _LP64 +sixtyfour bits +#endif + ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no]) + ]) + if test $gl_cv_solaris_64bit = yes; then + acl_libdirstem=lib/64 + case "$host_cpu" in + sparc*) acl_libdirstem2=lib/sparcv9 ;; + i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; + esac + fi + ;; + *) + searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` + if test -n "$searchpath"; then + acl_save_IFS="${IFS= }"; IFS=":" + for searchdir in $searchpath; do + if test -d "$searchdir"; then + case "$searchdir" in + */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; + */../ | */.. ) + # Better ignore directories of this form. They are misleading. + ;; + *) searchdir=`cd "$searchdir" && pwd` + case "$searchdir" in + */lib64 ) acl_libdirstem=lib64 ;; + esac ;; + esac + fi + done + IFS="$acl_save_IFS" + fi + ;; + esac + test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" +]) diff --git a/m4/nls.m4 b/m4/nls.m4 new file mode 100644 index 0000000..003704c --- /dev/null +++ b/m4/nls.m4 @@ -0,0 +1,32 @@ +# nls.m4 serial 5 (gettext-0.18) +dnl Copyright (C) 1995-2003, 2005-2006, 2008-2010 Free Software Foundation, +dnl Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2003. + +AC_PREREQ([2.50]) + +AC_DEFUN([AM_NLS], +[ + AC_MSG_CHECKING([whether NLS is requested]) + dnl Default is enabled NLS + AC_ARG_ENABLE([nls], + [ --disable-nls do not use Native Language Support], + USE_NLS=$enableval, USE_NLS=yes) + AC_MSG_RESULT([$USE_NLS]) + AC_SUBST([USE_NLS]) +]) diff --git a/m4/po.m4 b/m4/po.m4 new file mode 100644 index 0000000..47f36a4 --- /dev/null +++ b/m4/po.m4 @@ -0,0 +1,449 @@ +# po.m4 serial 17 (gettext-0.18) +dnl Copyright (C) 1995-2010 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2003. + +AC_PREREQ([2.50]) + +dnl Checks for all prerequisites of the po subdirectory. +AC_DEFUN([AM_PO_SUBDIRS], +[ + AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_INSTALL])dnl + AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake + AC_REQUIRE([AM_NLS])dnl + + dnl Release version of the gettext macros. This is used to ensure that + dnl the gettext macros and po/Makefile.in.in are in sync. + AC_SUBST([GETTEXT_MACRO_VERSION], [0.18]) + + dnl Perform the following tests also if --disable-nls has been given, + dnl because they are needed for "make dist" to work. + + dnl Search for GNU msgfmt in the PATH. + dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. + dnl The second test excludes FreeBSD msgfmt. + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], + :) + AC_PATH_PROG([GMSGFMT], [gmsgfmt], [$MSGFMT]) + + dnl Test whether it is GNU msgfmt >= 0.15. +changequote(,)dnl + case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;; + *) MSGFMT_015=$MSGFMT ;; + esac +changequote([,])dnl + AC_SUBST([MSGFMT_015]) +changequote(,)dnl + case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; + *) GMSGFMT_015=$GMSGFMT ;; + esac +changequote([,])dnl + AC_SUBST([GMSGFMT_015]) + + dnl Search for GNU xgettext 0.12 or newer in the PATH. + dnl The first test excludes Solaris xgettext and early GNU xgettext versions. + dnl The second test excludes FreeBSD xgettext. + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], + :) + dnl Remove leftover from FreeBSD xgettext call. + rm -f messages.po + + dnl Test whether it is GNU xgettext >= 0.15. +changequote(,)dnl + case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; + *) XGETTEXT_015=$XGETTEXT ;; + esac +changequote([,])dnl + AC_SUBST([XGETTEXT_015]) + + dnl Search for GNU msgmerge 0.11 or newer in the PATH. + AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, + [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :) + + dnl Installation directories. + dnl Autoconf >= 2.60 defines localedir. For older versions of autoconf, we + dnl have to define it here, so that it can be used in po/Makefile. + test -n "$localedir" || localedir='${datadir}/locale' + AC_SUBST([localedir]) + + dnl Support for AM_XGETTEXT_OPTION. + test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= + AC_SUBST([XGETTEXT_EXTRA_OPTIONS]) + + AC_CONFIG_COMMANDS([po-directories], [[ + for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + # Treat a directory as a PO directory if and only if it has a + # POTFILES.in file. This allows packages to have multiple PO + # directories under different names or in different locations. + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" + POMAKEFILEDEPS="POTFILES.in" + # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend + # on $ac_dir but don't depend on user-specified configuration + # parameters. + if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then + # The LINGUAS file contains the set of available languages. + if test -n "$OBSOLETE_ALL_LINGUAS"; then + test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" + fi + ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` + # Hide the ALL_LINGUAS assigment from automake < 1.5. + eval 'ALL_LINGUAS''=$ALL_LINGUAS_' + POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" + else + # The set of available languages was given in configure.in. + # Hide the ALL_LINGUAS assigment from automake < 1.5. + eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' + fi + # Compute POFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) + # Compute UPDATEPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) + # Compute DUMMYPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) + # Compute GMOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) + case "$ac_given_srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; + esac + POFILES= + UPDATEPOFILES= + DUMMYPOFILES= + GMOFILES= + for lang in $ALL_LINGUAS; do + POFILES="$POFILES $srcdirpre$lang.po" + UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" + DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + done + # CATALOGS depends on both $ac_dir and the user's LINGUAS + # environment variable. + INST_LINGUAS= + if test -n "$ALL_LINGUAS"; then + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "$LINGUAS"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + INST_LINGUAS="$INST_LINGUAS $presentlang" + fi + done + fi + CATALOGS= + if test -n "$INST_LINGUAS"; then + for lang in $INST_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + done + fi + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do + if test -f "$f"; then + case "$f" in + *.orig | *.bak | *~) ;; + *) cat "$f" >> "$ac_dir/Makefile" ;; + esac + fi + done + fi + ;; + esac + done]], + [# Capture the value of obsolete ALL_LINGUAS because we need it to compute + # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it + # from automake < 1.5. + eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' + # Capture the value of LINGUAS because we need it to compute CATALOGS. + LINGUAS="${LINGUAS-%UNSET%}" + ]) +]) + +dnl Postprocesses a Makefile in a directory containing PO files. +AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE], +[ + # When this code is run, in config.status, two variables have already been + # set: + # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in, + # - LINGUAS is the value of the environment variable LINGUAS at configure + # time. + +changequote(,)dnl + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + # Find a way to echo strings without interpreting backslash. + if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then + gt_echo='echo' + else + if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then + gt_echo='printf %s\n' + else + echo_func () { + cat < "$ac_file.tmp" + if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then + # Add dependencies that cannot be formulated as a simple suffix rule. + for lang in $ALL_LINGUAS; do + frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` + cat >> "$ac_file.tmp" < /dev/null; then + # Add dependencies that cannot be formulated as a simple suffix rule. + for lang in $ALL_LINGUAS; do + frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` + cat >> "$ac_file.tmp" <> "$ac_file.tmp" <, 1996. + +AC_PREREQ([2.50]) + +# Search path for a program which passes the given test. + +dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN([AM_PATH_PROG_WITH_TEST], +[ +# Prepare PATH_SEPARATOR. +# 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 + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL([ac_cv_path_$1], +[case "[$]$1" in + [[\\/]]* | ?:[[\\/]]*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in ifelse([$5], , $PATH, [$5]); do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then + AC_MSG_RESULT([$][$1]) +else + AC_MSG_RESULT([no]) +fi +AC_SUBST([$1])dnl +]) diff --git a/matlib/Makefile.am b/matlib/Makefile.am new file mode 100644 index 0000000..bf924c2 --- /dev/null +++ b/matlib/Makefile.am @@ -0,0 +1,38 @@ +#dnl INCLUDES = -I$(top_srcdir) + +noinst_LIBRARIES = libmat.a + +libmat_a_SOURCES = \ + randn.c \ + dcchol.c \ + drchol.c \ + fcchol.c \ + frchol.c \ + fcgseidel.c \ + frgseidel.c \ + frtransp.c \ + fradd.c \ + frsub.c \ + frmul.c \ + frinv.c \ + frdet.c \ + fctransp.c \ + fchermtransp.c \ + fcconj.c \ + fcadd.c \ + fcsub.c \ + fcmul.c \ + fcinv.c \ + fcdet.c + +noinst_HEADERS = \ + mat.h \ + fft.hh \ + mat.hh + +noinst_PROGRAMS = tests + +tests_SOURCES = tests.c +tests_LDADD = libmat.a ../libmisc/libmisc.a + +#dnl EXTRA_DIST = bpskberr.m diff --git a/matlib/Makefile.in b/matlib/Makefile.in new file mode 100644 index 0000000..47acce2 --- /dev/null +++ b/matlib/Makefile.in @@ -0,0 +1,561 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +#dnl INCLUDES = -I$(top_srcdir) + + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +noinst_PROGRAMS = tests$(EXEEXT) +subdir = matlib +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +libmat_a_AR = $(AR) $(ARFLAGS) +libmat_a_LIBADD = +am_libmat_a_OBJECTS = randn.$(OBJEXT) dcchol.$(OBJEXT) \ + drchol.$(OBJEXT) fcchol.$(OBJEXT) frchol.$(OBJEXT) \ + fcgseidel.$(OBJEXT) frgseidel.$(OBJEXT) frtransp.$(OBJEXT) \ + fradd.$(OBJEXT) frsub.$(OBJEXT) frmul.$(OBJEXT) \ + frinv.$(OBJEXT) frdet.$(OBJEXT) fctransp.$(OBJEXT) \ + fchermtransp.$(OBJEXT) fcconj.$(OBJEXT) fcadd.$(OBJEXT) \ + fcsub.$(OBJEXT) fcmul.$(OBJEXT) fcinv.$(OBJEXT) \ + fcdet.$(OBJEXT) +libmat_a_OBJECTS = $(am_libmat_a_OBJECTS) +PROGRAMS = $(noinst_PROGRAMS) +am_tests_OBJECTS = tests.$(OBJEXT) +tests_OBJECTS = $(am_tests_OBJECTS) +tests_DEPENDENCIES = libmat.a ../libmisc/libmisc.a +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libmat_a_SOURCES) $(tests_SOURCES) +DIST_SOURCES = $(libmat_a_SOURCES) $(tests_SOURCES) +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUDIOFILE_CFLAGS = @AUDIOFILE_CFLAGS@ +AUDIOFILE_LIBS = @AUDIOFILE_LIBS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +HAVE_ALSA = @HAVE_ALSA@ +HAVE_BITTYPES = @HAVE_BITTYPES@ +HAVE_DIRECTX = @HAVE_DIRECTX@ +HAVE_IFRNEWNAME = @HAVE_IFRNEWNAME@ +HAVE_MKISS = @HAVE_MKISS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTHREAD = @LIBTHREAD@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +M_PI = @M_PI@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USEMMX = @USEMMX@ +USEVIS = @USEVIS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WIN32 = @WIN32@ +WINDRES = @WINDRES@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CFLAGS = @XML_CFLAGS@ +XML_LIBS = @XML_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +noinst_LIBRARIES = libmat.a +libmat_a_SOURCES = \ + randn.c \ + dcchol.c \ + drchol.c \ + fcchol.c \ + frchol.c \ + fcgseidel.c \ + frgseidel.c \ + frtransp.c \ + fradd.c \ + frsub.c \ + frmul.c \ + frinv.c \ + frdet.c \ + fctransp.c \ + fchermtransp.c \ + fcconj.c \ + fcadd.c \ + fcsub.c \ + fcmul.c \ + fcinv.c \ + fcdet.c + +noinst_HEADERS = \ + mat.h \ + fft.hh \ + mat.hh + +tests_SOURCES = tests.c +tests_LDADD = libmat.a ../libmisc/libmisc.a +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu matlib/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu matlib/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libmat.a: $(libmat_a_OBJECTS) $(libmat_a_DEPENDENCIES) + -rm -f libmat.a + $(libmat_a_AR) libmat.a $(libmat_a_OBJECTS) $(libmat_a_LIBADD) + $(RANLIB) libmat.a + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) +tests$(EXEEXT): $(tests_OBJECTS) $(tests_DEPENDENCIES) + @rm -f tests$(EXEEXT) + $(LINK) $(tests_OBJECTS) $(tests_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dcchol.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drchol.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fcadd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fcchol.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fcconj.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fcdet.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fcgseidel.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fchermtransp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fcinv.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fcmul.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fcsub.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fctransp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fradd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frchol.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frdet.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frgseidel.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frinv.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frmul.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frsub.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frtransp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/randn.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tests.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES clean-noinstPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am + + +#dnl EXTRA_DIST = bpskberr.m + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/matlib/dcchol.c b/matlib/dcchol.c new file mode 100644 index 0000000..5a412d1 --- /dev/null +++ b/matlib/dcchol.c @@ -0,0 +1,125 @@ +/* + * Matrix operations library + * + * Copyright (C) 1999-2000 + * Thomas Sailer, + * + * 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 + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +#include "mat.h" +#include +#include +#include + + +/* + * A el C^{d x d} + * This routine calculates G*G^H = A, where G is lower triangular, and then uses this to solve + * A*c=b for c + * G*G^H*c=b + * G*t=b + * G^H*c=t + */ + +static inline double pwr(cplxdouble_t c) +{ + return real(c) * real(c) + imag(c) * imag(c); +} + +int dccholfactor(const cplxdouble_t *a, cplxdouble_t *g, unsigned int d) +{ + unsigned int i, j, k; + cplxdouble_t sc, co; + double s; + + memset(g, 0, d*d*sizeof(g[0])); + for (i = 0; i < d; i++) { + s = real(a[i*d+i]); + for (j = 0; j < i; j++) + s -= pwr(g[i*d+j]); + if (s <= 0 || imag(a[i*d+i]) != 0) { + fprintf(stderr, "dccholfactor: matrix not positive definite a[%u][%u]=%g%+gi s=%g\n", i, i, real(a[i*d+i]), imag(a[i*d+i]), s); + return -1; + } + s = 1/sqrt(s); + cplx(g[i*d+i], s, 0); + for (j = i+1; j < d; j++) { + sc = a[j*d+i]; + for (k = 0; k < i; k++) { + conj(co, g[i*d+k]); + cmsub(sc, g[j*d+k], co); + } + cmuls(g[j*d+i], sc, s); + } + } + return 0; +} + +void dccholapply(const cplxdouble_t *g, const cplxdouble_t *b, cplxdouble_t *c, unsigned int d) +{ + cplxdouble_t *t, s, s2; + unsigned int i, j; + + t = alloca(d*sizeof(t[0])); + for (i = 0; i < d; i++) { + s = b[i]; + for (j = 0; j < i; j++) + cmsub(s, g[i*d+j], t[j]); + /* g's diagonal is real, therefore we have a division by a real */ + cmuls(t[i], s, real(g[i*d+i])); + } + for (i = d; i > 0; i--) { + s = t[i-1]; + for (j = i; j < d; j++) { + conj(s2, g[j*d+(i-1)]); + cmsub(s, s2, c[j]); + } + /* g's diagonal is real, therefore we have a division by a real */ + cmuls(c[i-1], s, real(g[(i-1)*d+(i-1)])); + } +} + +int dcchol(const cplxdouble_t *a, const cplxdouble_t *b, cplxdouble_t *c, unsigned int d) +{ + cplxdouble_t *g; + + g = alloca(d*d*sizeof(g[0])); + if (dccholfactor(a, g, d)) { + memset(c, 0, d*sizeof(c[0])); + return -1; + } + dccholapply(g, b, c, d); + return 0; +} diff --git a/matlib/drchol.c b/matlib/drchol.c new file mode 100644 index 0000000..eab5797 --- /dev/null +++ b/matlib/drchol.c @@ -0,0 +1,113 @@ +/* + * Matrix operations library + * + * Copyright (C) 1999-2000 + * Thomas Sailer, + * + * 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 + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +#include "mat.h" +#include +#include +#include + +/* + * A el R^{d x d} + * This routine calculates G*G^T = A, where G is lower triangular, and then uses this to solve + * A*c=b for c + * G*G^T*c=b + * G*t=b + * G^T*c=t + */ + +int drcholfactor(const double *a, double *g, unsigned int d) +{ + unsigned int i, j, k; + double s, s1; + + memset(g, 0, d*d*sizeof(g[0])); + for (i = 0; i < d; i++) { + s = a[i*d+i]; + for (j = 0; j < i; j++) + s -= g[i*d+j] * g[i*d+j]; + if (s <= 0) { + fprintf(stderr, "frcholfactor: matrix not positive definite a[%u][%u]=%g s=%g\n", i, i, a[i*d+i], s); + return -1; + } + s = 1/sqrt(s); + g[i*d+i] = s; + for (j = i+1; j < d; j++) { + s1 = 0; + for (k = 0; k < i; k++) + s1 += g[j*d+k] * g[i*d+k]; + g[j*d+i] = s * (a[j*d+i] - s1); + } + } + return 0; +} + +void drcholapply(const double *g, const double *b, double *c, unsigned int d) +{ + double *t; + unsigned int i, j; + double s1; + + t = alloca(d*sizeof(t[0])); + for (i = 0; i < d; i++) { + s1 = b[i]; + for (j = 0; j < i; j++) + s1 -= g[i*d+j] * t[j]; + t[i] = s1 * g[i*d+i]; + } + for (i = d; i > 0; i--) { + s1 = t[i-1]; + for (j = i; j < d; j++) + s1 -= g[j*d+(i-1)] * c[j]; + c[i-1] = s1 * g[(i-1)*d+(i-1)]; + } +} + +int drchol(const double *a, const double *b, double *c, unsigned int d) +{ + double *g; + + g = alloca(d*d*sizeof(g[0])); + if (drcholfactor(a, g, d)) { + memset(c, 0, d*sizeof(c[0])); + return -1; + } + drcholapply(g, b, c, d); + return 0; +} diff --git a/matlib/fcadd.c b/matlib/fcadd.c new file mode 100644 index 0000000..8e163d0 --- /dev/null +++ b/matlib/fcadd.c @@ -0,0 +1,31 @@ +/* + * Matrix operations library + * + * Copyright (C) 1999-2000 + * Thomas Sailer, + * + * 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 + */ + +#include "mat.h" + +void fcadd(cplxfloat_t *c, const cplxfloat_t *a, const cplxfloat_t *b, unsigned int d1, unsigned int d2) +{ + unsigned int i, j = d1 * d2; + + for (i = 0; i < j; i++) + cadd(c[i], a[i], b[i]); +} + diff --git a/matlib/fcchol.c b/matlib/fcchol.c new file mode 100644 index 0000000..7219582 --- /dev/null +++ b/matlib/fcchol.c @@ -0,0 +1,125 @@ +/* + * Matrix operations library + * + * Copyright (C) 1999-2000 + * Thomas Sailer, + * + * 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 + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +#include "mat.h" +#include +#include +#include + + +/* + * A el C^{d x d} + * This routine calculates G*G^H = A, where G is lower triangular, and then uses this to solve + * A*c=b for c + * G*G^H*c=b + * G*t=b + * G^H*c=t + */ + +static inline float pwr(cplxfloat_t c) +{ + return real(c) * real(c) + imag(c) * imag(c); +} + +int fccholfactor(const cplxfloat_t *a, cplxfloat_t *g, unsigned int d) +{ + unsigned int i, j, k; + cplxfloat_t sc, co; + float s; + + memset(g, 0, d*d*sizeof(g[0])); + for (i = 0; i < d; i++) { + s = real(a[i*d+i]); + for (j = 0; j < i; j++) + s -= pwr(g[i*d+j]); + if (s <= 0 || imag(a[i*d+i]) != 0) { + fprintf(stderr, "fccholfactor: matrix not positive definite a[%u][%u]=%g%+gi s=%g\n", i, i, real(a[i*d+i]), imag(a[i*d+i]), s); + return -1; + } + s = 1/sqrt(s); + cplx(g[i*d+i], s, 0); + for (j = i+1; j < d; j++) { + sc = a[j*d+i]; + for (k = 0; k < i; k++) { + conj(co, g[i*d+k]); + cmsub(sc, g[j*d+k], co); + } + cmuls(g[j*d+i], sc, s); + } + } + return 0; +} + +void fccholapply(const cplxfloat_t *g, const cplxfloat_t *b, cplxfloat_t *c, unsigned int d) +{ + cplxfloat_t *t, s, s2; + unsigned int i, j; + + t = alloca(d*sizeof(t[0])); + for (i = 0; i < d; i++) { + s = b[i]; + for (j = 0; j < i; j++) + cmsub(s, g[i*d+j], t[j]); + /* g's diagonal is real, therefore we have a division by a real */ + cmuls(t[i], s, real(g[i*d+i])); + } + for (i = d; i > 0; i--) { + s = t[i-1]; + for (j = i; j < d; j++) { + conj(s2, g[j*d+(i-1)]); + cmsub(s, s2, c[j]); + } + /* g's diagonal is real, therefore we have a division by a real */ + cmuls(c[i-1], s, real(g[(i-1)*d+(i-1)])); + } +} + +int fcchol(const cplxfloat_t *a, const cplxfloat_t *b, cplxfloat_t *c, unsigned int d) +{ + cplxfloat_t *g; + + g = alloca(d*d*sizeof(g[0])); + if (fccholfactor(a, g, d)) { + memset(c, 0, d*sizeof(c[0])); + return -1; + } + fccholapply(g, b, c, d); + return 0; +} diff --git a/matlib/fcconj.c b/matlib/fcconj.c new file mode 100644 index 0000000..171e934 --- /dev/null +++ b/matlib/fcconj.c @@ -0,0 +1,31 @@ +/* + * Matrix operations library + * + * Copyright (C) 1999-2000 + * Thomas Sailer, + * + * 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 + */ + +#include "mat.h" + +void fcconj(cplxfloat_t *c, const cplxfloat_t *a, unsigned int d1, unsigned int d2) +{ + unsigned int i, j = d1 * d2; + + for (i = 0; i < j; i++) + conj(c[i], a[i]); +} + diff --git a/matlib/fcdet.c b/matlib/fcdet.c new file mode 100644 index 0000000..2ab23e5 --- /dev/null +++ b/matlib/fcdet.c @@ -0,0 +1,76 @@ +/* + * Matrix operations library + * + * Copyright (C) 1999-2000 + * Thomas Sailer, + * + * 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 + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +#include "mat.h" + +cplxfloat_t fcdet(const cplxfloat_t *c, unsigned int d) +{ + cplxfloat_t *c2; + unsigned int i, j, k, l; + cplxfloat_t det, dr; + + cplx(det, 0, 0); + if (!d) + return det; + if (d == 1) + return c[0]; + if (d == 2) { + cmul(det, c[0], c[3]); + cmsub(det, c[1], c[2]); + return det; + } + c2 = alloca(sizeof(cplxfloat_t)*(d-1)*(d-1)); + for (i = 0; i < d; i++) { + for (j = k = 0; j < d; j++) { + if (j == i) + continue; + for (l = 0; l < d-1; l++) + c2[l*(d-1)+k] = c[(l+1)*d+j]; + k++; + } + dr = fcdet(c2, d-1); + if (i & 1) + cmsub(det, dr, c[i]); + else + cmac(det, dr, c[i]); + } + return det; +} + diff --git a/matlib/fcgseidel.c b/matlib/fcgseidel.c new file mode 100644 index 0000000..17a9584 --- /dev/null +++ b/matlib/fcgseidel.c @@ -0,0 +1,80 @@ +/* + * Matrix operations library + * + * Copyright (C) 1999-2000 + * Thomas Sailer, + * + * 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 + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +#include "mat.h" +#include +#include + +/* + * This routine calculates A*c=b iteratively, using the Gauss-Seidel iteration method + */ + +int fcgaussseidel(const cplxfloat_t *a, const cplxfloat_t *b, cplxfloat_t *c, unsigned int d, unsigned int iter) +{ + cplxfloat_t *adiag; + unsigned int i, j, k; + cplxfloat_t s; + + adiag = alloca(d*sizeof(adiag[0])); + /* initial vector */ + for (i = 1; i < d; i++) + cplx(c[i], 0, 0); + cplx(c[0], 1, 0); + /* check for diagonal */ + for (i = 0; i < d; i++) { + if (real(a[i*d+i]) == 0 && imag(a[i*d+i]) == 0) { + fprintf(stderr, "fcgaussseidel: matrix diagonal zero a[%u][%u]=%g%+gi\n", i, i, real(a[i*d+i]), imag(a[i*d+i])); + return -1; + } + cinv(adiag[i], a[i*d+i]); + } + /* iteration */ + for (i = 0; i < iter; i++) { + for (j = 0; j < d; j++) { + s = b[j]; + for (k = 0; k < j; k++) + cmsub(s, a[j*d+k], c[k]); + for (k = j+1; k < d; k++) + cmsub(s, a[j*d+k], c[k]); + cmul(c[j], s, adiag[j]); + } + } + return 0; +} diff --git a/matlib/fchermtransp.c b/matlib/fchermtransp.c new file mode 100644 index 0000000..bc522c2 --- /dev/null +++ b/matlib/fchermtransp.c @@ -0,0 +1,61 @@ +/* + * Matrix operations library + * + * Copyright (C) 1999-2000 + * Thomas Sailer, + * + * 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 + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +#include +#include "mat.h" + +/* Transpose a matrix (a el C^{d1 x d2}, b el C^{d2 x d1}) */ + +void fchermtranspose(cplxfloat_t *b, const cplxfloat_t *a, unsigned int d1, unsigned int d2) +{ + const cplxfloat_t *c = a; + unsigned int ci, bi, i, j; + + if (b == a) { + c = alloca(d1 * d2 * sizeof(c[0])); + memcpy((void *)c, a, d1 * d2 * sizeof(c[0])); + } + for (i = 0; i < d1; i++) + for (j = 0; j < d2; j++) { + ci = i*d2+j; + bi = j*d1+i; + conj(b[bi], c[ci]); + } +} diff --git a/matlib/fcinv.c b/matlib/fcinv.c new file mode 100644 index 0000000..d0a0749 --- /dev/null +++ b/matlib/fcinv.c @@ -0,0 +1,132 @@ +/* + * Matrix operations library + * + * Copyright (C) 1999-2000 + * Thomas Sailer, + * + * 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 + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +#include +#include +#include "mat.h" + + +/* + * Golub/van Loan, 3.1.3, p 112; PA=LU factorization with partial pivoting + */ + +#define exch(x,y) do { cplxfloat_t z; z = (x); (x) = (y); (y) = z; } while (0) + +static inline float csqr(cplxfloat_t x) +{ + return real(x) * real(x) + imag(x) * imag(x); +} + +void fclufact(cplxfloat_t *u, unsigned int *p, const cplxfloat_t *a, unsigned int d) +{ + unsigned int i, j, k, mu; + cplxfloat_t fm; + float f1, f2; + + if (u != a) + memcpy(u, a, d*d*sizeof(u[0])); + for (k = 0; k < d-1; k++) { + /* search pivot index */ + for (f1 = 0, i = mu = k; i < d; i++) { + f2 = csqr(u[i*d+k]); + if (f2 > f1) { + f1 = f2; + mu = i; + } + } + /* exchange rows */ + p[k] = mu; + for (i = k; i < d; i++) + exch(u[k*d+i], u[mu*d+i]); + fm = u[k*d+k]; + if (real(fm) != 0 || imag(fm) != 0) { + cinv(fm, fm); + for (i = k+1; i < d; i++) + cmul(u[i*d+k], u[i*d+k], fm); + for (i = k+1; i < d; i++) + for (j = k+1; j < d; j++) + cmsub(u[i*d+j], u[i*d+k], u[k*d+j]); + } + } +} + +void fclusolve(cplxfloat_t *x, const cplxfloat_t *b, const cplxfloat_t *u, const unsigned int *p, unsigned int d) +{ + cplxfloat_t *y, s, udiaginv; + unsigned int k, i; + + y = alloca(d * sizeof(y[0])); + memcpy(y, b, d * sizeof(y[0])); + for (k = 0; k < d-1; k++) { + i = p[k]; + if (i != k) + exch(y[k], y[i]); + if (real(y[k]) == 0 && imag(y[k]) == 0) + continue; + for (i = k+1; i < d; i++) + cmsub(y[i], y[k], u[i*d+k]); + } + /* solve Ux=y */ + for (k = d; k > 0; k--) { + s = y[k-1]; + for (i = k; i < d; i++) + cmsub(s, u[(k-1)*d+i], x[i]); + cinv(udiaginv, u[(k-1)*d+(k-1)]); + cmul(x[k-1], s, udiaginv); + } +} + +void fcinv(cplxfloat_t *ainv, const cplxfloat_t *a, unsigned d) +{ + cplxfloat_t *u, *y; + unsigned int *p; + unsigned int k; + + u = alloca(d * d * sizeof(u[0])); + p = alloca((d-1) * sizeof(p[0])); + fclufact(u, p, a, d); + for (k = 0; k < d; k++) { + y = &ainv[k*d]; + memset(y, 0, d * sizeof(y[0])); + cplx(y[k], 1, 0); + fclusolve(y, y, u, p, d); + } + fctranspose(ainv, ainv, d, d); +} diff --git a/matlib/fcmul.c b/matlib/fcmul.c new file mode 100644 index 0000000..2283085 --- /dev/null +++ b/matlib/fcmul.c @@ -0,0 +1,62 @@ +/* + * Matrix operations library + * + * Copyright (C) 1999-2000 + * Thomas Sailer, + * + * 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 + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +#include +#include "mat.h" + +/* c el C^{d1 x d3}, a el C^{d1 x d2}, b el C^{d2 x d3} */ + +void fcmul(cplxfloat_t *c, const cplxfloat_t *a, const cplxfloat_t *b, unsigned int d1, unsigned int d2, unsigned int d3) +{ + cplxfloat_t *r = c, s; + unsigned int i, j, k; + + if (c == a || c == b) + r = alloca(d1 * d3 * sizeof(r[0])); + for (i = 0; i < d1; i++) + for (k = 0; k < d3; k++) { + cplx(s, 0, 0); + for (j = 0; j < d2; j++) + cmac(s, a[i*d2+j], b[j*d3+k]); + r[i*d3+k] = s; + } + if (r != c) + memcpy(c, r, d1 * d3 * sizeof(c[0])); +} diff --git a/matlib/fcsub.c b/matlib/fcsub.c new file mode 100644 index 0000000..1f5d0a8 --- /dev/null +++ b/matlib/fcsub.c @@ -0,0 +1,31 @@ +/* + * Matrix operations library + * + * Copyright (C) 1999-2000 + * Thomas Sailer, + * + * 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 + */ + +#include "mat.h" + +void fcsub(cplxfloat_t *c, const cplxfloat_t *a, const cplxfloat_t *b, unsigned int d1, unsigned int d2) +{ + unsigned int i, j = d1 * d2; + + for (i = 0; i < j; i++) + csub(c[i], a[i], b[i]); +} + diff --git a/matlib/fctransp.c b/matlib/fctransp.c new file mode 100644 index 0000000..bfedc53 --- /dev/null +++ b/matlib/fctransp.c @@ -0,0 +1,61 @@ +/* + * Matrix operations library + * + * Copyright (C) 1999-2000 + * Thomas Sailer, + * + * 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 + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +#include +#include "mat.h" + +/* Transpose a matrix (a el C^{d1 x d2}, b el C^{d2 x d1}) */ + +void fctranspose(cplxfloat_t *b, const cplxfloat_t *a, unsigned int d1, unsigned int d2) +{ + const cplxfloat_t *c = a; + unsigned int ci, bi, i, j; + + if (b == a) { + c = alloca(d1 * d2 * sizeof(c[0])); + memcpy((void *)c, a, d1 * d2 * sizeof(c[0])); + } + for (i = 0; i < d1; i++) + for (j = 0; j < d2; j++) { + ci = i*d2+j; + bi = j*d1+i; + b[bi] = c[ci]; + } +} diff --git a/matlib/fft.hh b/matlib/fft.hh new file mode 100644 index 0000000..c1c2c4f --- /dev/null +++ b/matlib/fft.hh @@ -0,0 +1,87 @@ +/*****************************************************************************/ + +/* + * fft.hh -- Simple RIF FFT function. + * + * Copyright (C) 2003 + * Thomas Sailer (t.sailer@alumni.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +/*****************************************************************************/ + +#ifndef _FFT_HH +#define _FFT_HH + +/* --------------------------------------------------------------------- */ + +/* + * This fft routine is from ~gabriel/src/filters/fft/fft.c; + * I am unsure of the original source. The file contains no + * copyright notice or description. + * The declaration is changed to the prototype form but the + * function body is unchanged. (J. T. Buck) + */ + +/* + * Replace data by its discrete Fourier transform, if isign is + * input as 1, or by its inverse discrete Fourier transform, if + * "isign" is input as -1. "data'"is a complex array of length "nn". + * "nn" MUST be an integer power of 2 (this is not checked for!?) + */ + +template static void fft_rif(complex *data, unsigned int nn, int isign) +{ + for (unsigned int i = 0, j = 0; i < nn; i++) { + if (j > i) { + complex temp = data[j]; + data[j] = data[i]; + data[i] = temp; + } + unsigned int m = nn >> 1; + while (m > 0 && (int)j >= (int)m) { + j -= m; + m >>= 1; + } + j += m; + } + unsigned int mmax = 1; + T theta = -6.28318530717959 * 0.5; + if (isign < 0) + theta = -theta; + T sintheta = sin(theta); + while (nn > mmax) { + T oldsintheta = sintheta; + theta *= 0.5; + sintheta = sin(theta); + complex wp(-2.0 * sintheta * sintheta, oldsintheta); /* -2.0 * sin(0.5*theta)^2 = cos(theta)-1 */ + complex w(1,0); + for (unsigned int m = 0; m < mmax; m++) { + for (unsigned int i = m; i < nn; i += 2*mmax) { + unsigned int j = i + mmax; + complex temp = w * data[j]; + data[j] = data[i] - temp; + data[i] += temp; + } + w += w * wp; + } + mmax <<= 1; + } +} + +/* ---------------------------------------------------------------------- */ +#endif /* _FFT_HH */ diff --git a/matlib/fradd.c b/matlib/fradd.c new file mode 100644 index 0000000..800ada4 --- /dev/null +++ b/matlib/fradd.c @@ -0,0 +1,31 @@ +/* + * Matrix operations library + * + * Copyright (C) 1999-2000 + * Thomas Sailer, + * + * 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 + */ + +#include "mat.h" + +void fradd(float *c, const float *a, const float *b, unsigned int d1, unsigned int d2) +{ + unsigned int i, j = d1 * d2; + + for (i = 0; i < j; i++) + c[i] = a[i] + b[i]; +} + diff --git a/matlib/frchol.c b/matlib/frchol.c new file mode 100644 index 0000000..001fc39 --- /dev/null +++ b/matlib/frchol.c @@ -0,0 +1,113 @@ +/* + * Matrix operations library + * + * Copyright (C) 1999-2000 + * Thomas Sailer, + * + * 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 + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +#include "mat.h" +#include +#include +#include + +/* + * A el R^{d x d} + * This routine calculates G*G^T = A, where G is lower triangular, and then uses this to solve + * A*c=b for c + * G*G^T*c=b + * G*t=b + * G^T*c=t + */ + +int frcholfactor(const float *a, float *g, unsigned int d) +{ + unsigned int i, j, k; + float s, s1; + + memset(g, 0, d*d*sizeof(g[0])); + for (i = 0; i < d; i++) { + s = a[i*d+i]; + for (j = 0; j < i; j++) + s -= g[i*d+j] * g[i*d+j]; + if (s <= 0) { + fprintf(stderr, "frcholfactor: matrix not positive definite a[%u][%u]=%g s=%g\n", i, i, a[i*d+i], s); + return -1; + } + s = 1/sqrt(s); + g[i*d+i] = s; + for (j = i+1; j < d; j++) { + s1 = 0; + for (k = 0; k < i; k++) + s1 += g[j*d+k] * g[i*d+k]; + g[j*d+i] = s * (a[j*d+i] - s1); + } + } + return 0; +} + +void frcholapply(const float *g, const float *b, float *c, unsigned int d) +{ + float *t; + unsigned int i, j; + float s1; + + t = alloca(d*sizeof(t[0])); + for (i = 0; i < d; i++) { + s1 = b[i]; + for (j = 0; j < i; j++) + s1 -= g[i*d+j] * t[j]; + t[i] = s1 * g[i*d+i]; + } + for (i = d; i > 0; i--) { + s1 = t[i-1]; + for (j = i; j < d; j++) + s1 -= g[j*d+(i-1)] * c[j]; + c[i-1] = s1 * g[(i-1)*d+(i-1)]; + } +} + +int frchol(const float *a, const float *b, float *c, unsigned int d) +{ + float *g; + + g = alloca(d*d*sizeof(g[0])); + if (frcholfactor(a, g, d)) { + memset(c, 0, d*sizeof(c[0])); + return -1; + } + frcholapply(g, b, c, d); + return 0; +} diff --git a/matlib/frdet.c b/matlib/frdet.c new file mode 100644 index 0000000..c3bda12 --- /dev/null +++ b/matlib/frdet.c @@ -0,0 +1,72 @@ +/* + * Matrix operations library + * + * Copyright (C) 1999-2000 + * Thomas Sailer, + * + * 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 + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +#include "mat.h" + +float frdet(const float *c, unsigned int d) +{ + float *c2; + unsigned int i, j, k, l; + float det = 0, dr; + + if (!d) + return 0; + if (d == 1) + return c[0]; + if (d == 2) + return c[0] * c[3] - c[1] * c[2]; + c2 = alloca(sizeof(float)*(d-1)*(d-1)); + for (i = 0; i < d; i++) { + for (j = k = 0; j < d; j++) { + if (j == i) + continue; + for (l = 0; l < d-1; l++) + c2[l*(d-1)+k] = c[(l+1)*d+j]; + k++; + } + dr = frdet(c2, d-1); + if (i & 1) + det -= dr * c[i]; + else + det += dr * c[i]; + } + return det; +} + diff --git a/matlib/frgseidel.c b/matlib/frgseidel.c new file mode 100644 index 0000000..b895be4 --- /dev/null +++ b/matlib/frgseidel.c @@ -0,0 +1,83 @@ +/* + * Matrix operations library + * + * Copyright (C) 1999-2000 + * Thomas Sailer, + * + * 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 + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +#include "mat.h" +#include +#include + +/* + * This routine calculates A*c=b iteratively, using the Gauss-Seidel iteration method + */ + +int frgaussseidel(const float *a, const float *b, float *c, unsigned int d, unsigned int iter) +{ + float *adiag; + unsigned int i, j, k; + float s; + + adiag = alloca(d * sizeof(adiag[0])); + /* initial vector */ + for (i = 0; i < d; i++) + c[i] = 0; + c[0] = 1; + /* check for diagonal */ + for (i = 0; i < d; i++) { + if (a[i*d+i] <= 0) { + fprintf(stderr, "frgaussseidel: matrix diagonal not positive a[%u][%u]=%g\n", i, i, a[i*d+i]); + return -1; + } + adiag[i] = 1 / a[i*d+i]; + } + /* iteration */ + for (i = 0; i < iter; i++) { + for (j = 0; j < d; j++) { + s = b[j]; + for (k = 0; k < j; k++) + s -= a[j*d+k] * c[k]; + for (k = j+1; k < d; k++) + s -= a[j*d+k] * c[k]; + c[j] = s * adiag[j]; + } + } + return 0; +} + + + diff --git a/matlib/frinv.c b/matlib/frinv.c new file mode 100644 index 0000000..32f7526 --- /dev/null +++ b/matlib/frinv.c @@ -0,0 +1,127 @@ +/* + * Matrix operations library + * + * Copyright (C) 1999-2000 + * Thomas Sailer, + * + * 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 + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +#include +#include +#include "mat.h" + + +/* + * Golub/van Loan, 3.1.3, p 112; PA=LU factorization with partial pivoting + */ + +#define exch(x,y) do { float z; z = (x); (x) = (y); (y) = z; } while (0) + + +void frlufact(float *u, unsigned int *p, const float *a, unsigned int d) +{ + unsigned int i, j, k, mu; + float f1, f2; + + if (u != a) + memcpy(u, a, d*d*sizeof(u[0])); + for (k = 0; k < d-1; k++) { + /* search pivot index */ + for (f1 = 0, i = mu = k; i < d; i++) { + f2 = fabs(u[i*d+k]); + if (f2 > f1) { + f1 = f2; + mu = i; + } + } + /* exchange rows */ + p[k] = mu; + for (i = k; i < d; i++) + exch(u[k*d+i], u[mu*d+i]); + f1 = u[k*d+k]; + if (f1 != 0) { + f1 = 1 / f1; + for (i = k+1; i < d; i++) + u[i*d+k] *= f1; + for (i = k+1; i < d; i++) + for (j = k+1; j < d; j++) + u[i*d+j] -= u[i*d+k] * u[k*d+j]; + } + } +} + +void frlusolve(float *x, const float *b, const float *u, const unsigned int *p, unsigned int d) +{ + float *y, s; + unsigned int k, i; + + y = alloca(d * sizeof(y[0])); + memcpy(y, b, d * sizeof(y[0])); + for (k = 0; k < d-1; k++) { + i = p[k]; + if (i != k) + exch(y[k], y[i]); + if (y[k] == 0) + continue; + for (i = k+1; i < d; i++) + y[i] -= y[k] * u[i*d+k]; + } + /* solve Ux=y */ + for (k = d; k > 0; k--) { + s = y[k-1]; + for (i = k; i < d; i++) + s -= u[(k-1)*d+i] * x[i]; + x[k-1] = s / u[(k-1)*d+(k-1)]; + } +} + +void frinv(float *ainv, const float *a, unsigned d) +{ + float *u, *y; + unsigned int *p; + unsigned int k; + + u = alloca(d * d * sizeof(u[0])); + p = alloca((d-1) * sizeof(p[0])); + frlufact(u, p, a, d); + for (k = 0; k < d; k++) { + y = &ainv[k*d]; + memset(y, 0, d * sizeof(y[0])); + y[k] = 1; + frlusolve(y, y, u, p, d); + } + frtranspose(ainv, ainv, d, d); +} + diff --git a/matlib/frmul.c b/matlib/frmul.c new file mode 100644 index 0000000..285c576 --- /dev/null +++ b/matlib/frmul.c @@ -0,0 +1,61 @@ +/* + * Matrix operations library + * + * Copyright (C) 1999-2000 + * Thomas Sailer, + * + * 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 + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +#include +#include "mat.h" + +/* c el R^{d1 x d3}, a el R^{d1 x d2}, b el R^{d2 x d3} */ + +void frmul(float *c, const float *a, const float *b, unsigned int d1, unsigned int d2, unsigned int d3) +{ + float *r = c, s; + unsigned int i, j, k; + + if (c == a || c == b) + r = alloca(d1 * d3 * sizeof(r[0])); + for (i = 0; i < d1; i++) + for (k = 0; k < d3; k++) { + for (s = 0, j = 0; j < d2; j++) + s += a[i*d2+j] * b[j*d3+k]; + r[i*d3+k] = s; + } + if (r != c) + memcpy(c, r, d1 * d3 * sizeof(c[0])); +} diff --git a/matlib/frsub.c b/matlib/frsub.c new file mode 100644 index 0000000..431c5ef --- /dev/null +++ b/matlib/frsub.c @@ -0,0 +1,30 @@ +/* + * Matrix operations library + * + * Copyright (C) 1999-2000 + * Thomas Sailer, + * + * 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 + */ + +#include "mat.h" + +void frsub(float *c, const float *a, const float *b, unsigned int d1, unsigned int d2) +{ + unsigned int i, j = d1 * d2; + + for (i = 0; i < j; i++) + c[i] = a[i] - b[i]; +} diff --git a/matlib/frtransp.c b/matlib/frtransp.c new file mode 100644 index 0000000..62fd2bf --- /dev/null +++ b/matlib/frtransp.c @@ -0,0 +1,61 @@ +/* + * Matrix operations library + * + * Copyright (C) 1999-2000 + * Thomas Sailer, + * + * 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 + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +#include +#include "mat.h" + +/* Transpose a matrix (a el R^{d1 x d2}, b el R^{d2 x d1}) */ + +void frtranspose(float *b, const float *a, unsigned int d1, unsigned int d2) +{ + const float *c = a; + unsigned int ci, bi, i, j; + + if (b == a) { + c = alloca(d1 * d2 * sizeof(c[0])); + memcpy((void *)c, a, d1 * d2 * sizeof(c[0])); + } + for (i = 0; i < d1; i++) + for (j = 0; j < d2; j++) { + ci = i*d2+j; + bi = j*d1+i; + b[bi] = c[ci]; + } +} diff --git a/matlib/mat.h b/matlib/mat.h new file mode 100644 index 0000000..271eb3f --- /dev/null +++ b/matlib/mat.h @@ -0,0 +1,199 @@ +/* + * Matrix operations library + * + * Copyright (C) 1999-2000 + * Thomas Sailer, + * + * 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 + */ + +/* + * (C) 1999 Institut für Elektronik, ETH Zürich + * Author: Thomas Sailer, + * KTI Projekt + */ + +#ifndef _MAT_H +#define _MAT_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +/* + * basic complex manipulations + */ + +typedef struct { + float re; + float im; +} cplxfloat_t; + +typedef struct { + double re; + double im; +} cplxdouble_t; + +#define real(r) ((r).re) +#define imag(r) ((r).im) +#define conj(r,a) do { (r).re = (a).re; (r).im = -(a).im; } while (0) +#define cplx(v,r,i) do { (v).re = (r); (v).im = (i); } while (0) + +#define csub(r,a,b) \ + do { \ + double xr,xi,yr,yi; \ + xr = (a).re; xi = (a).im; \ + yr = (b).re; yi = (b).im; \ + (r).re = xr - yr; \ + (r).im = xi - yi; \ + } while (0) + +#define cadd(r,a,b) \ + do { \ + double xr,xi,yr,yi; \ + xr = (a).re; xi = (a).im; \ + yr = (b).re; yi = (b).im; \ + (r).re = xr + yr; \ + (r).im = xi + yi; \ + } while (0) + +#define cmul(r,a,b) \ + do { \ + double xr,xi,yr,yi; \ + xr = (a).re; xi = (a).im; \ + yr = (b).re; yi = (b).im; \ + (r).re = xr * yr - xi * yi; \ + (r).im = xr * yi + xi * yr; \ + } while (0) + +#define cinv(r,a) \ + do { \ + double xr,xi,mag; \ + xr = (a).re; xi = (a).im; \ + mag = 1 / (xr * xr + xi * xi); \ + (r).re = xr * mag; \ + (r).im = -xi * mag; \ + } while (0) + +#define cmac(r,a,b) \ + do { \ + double xr,xi,yr,yi; \ + xr = (a).re; xi = (a).im; \ + yr = (b).re; yi = (b).im; \ + (r).re += xr * yr - xi * yi; \ + (r).im += xr * yi + xi * yr; \ + } while (0) + +#define cmsub(r,a,b) \ + do { \ + double xr,xi,yr,yi; \ + xr = (a).re; xi = (a).im; \ + yr = (b).re; yi = (b).im; \ + (r).re -= xr * yr - xi * yi; \ + (r).im -= xr * yi + xi * yr; \ + } while (0) + +#define cfma(r,a,b,c) \ + do { \ + double xr,xi,yr,yi,zr,zi; \ + xr = (a).re; xi = (a).im; \ + yr = (b).re; yi = (b).im; \ + zr = (c).re; zi = (c).im; \ + (r).re = xr * yr - xi * yi + zr; \ + (r).im = xr * yi + xi * yr + zi; \ + } while (0) + +#define cmuls(r,a,b) \ + do { \ + double xr,xi,bb; \ + xr = (a).re; xi = (a).im; bb = (b); \ + (r).re = xr * bb; \ + (r).im = xi * bb; \ + } while (0) + +#define cmacs(r,a,b) \ + do { \ + double xr,xi,bb; \ + xr = (a).re; xi = (a).im; bb = (b); \ + (r).re += xr * bb; \ + (r).im += xi * bb; \ + } while (0) + +#define cmsubs(r,a,b) \ + do { \ + double xr,xi,bb; \ + xr = (a).re; xi = (a).im; bb = (b); \ + (r).re -= xr * bb; \ + (r).im -= xi * bb; \ + } while (0) + +/* + * Gaussian distributed random variables + */ +extern float randn(void); + +/* + * Cholesky solver + */ + +extern int frcholfactor(const float *a, float *g, unsigned int d); +extern void frcholapply(const float *g, const float *b, float *c, unsigned int d); +extern int frchol(const float *a, const float *b, float *c, unsigned int d); +extern int fccholfactor(const cplxfloat_t *a, cplxfloat_t *g, unsigned int d); +extern void fccholapply(const cplxfloat_t *g, const cplxfloat_t *b, cplxfloat_t *c, unsigned int d); +extern int fcchol(const cplxfloat_t *a, const cplxfloat_t *b, cplxfloat_t *c, unsigned int d); +extern int drcholfactor(const double *a, double *g, unsigned int d); +extern void drcholapply(const double *g, const double *b, double *c, unsigned int d); +extern int drchol(const double *a, const double *b, double *c, unsigned int d); +extern int dccholfactor(const cplxdouble_t *a, cplxdouble_t *g, unsigned int d); +extern void dccholapply(const cplxdouble_t *g, const cplxdouble_t *b, cplxdouble_t *c, unsigned int d); +extern int dcchol(const cplxdouble_t *a, const cplxdouble_t *b, cplxdouble_t *c, unsigned int d); + +/* + * Gauss-Seidel iterative solver + */ +extern int frgaussseidel(const float *a, const float *b, float *c, unsigned int d, unsigned int iter); +extern int fcgaussseidel(const cplxfloat_t *a, const cplxfloat_t *b, cplxfloat_t *c, unsigned int d, unsigned int iter); + +/* + * Transpose etc. + */ + +extern void frtranspose(float *b, const float *a, unsigned int d1, unsigned int d2); +extern void fradd(float *c, const float *a, const float *b, unsigned int d1, unsigned int d2); +extern void frsub(float *c, const float *a, const float *b, unsigned int d1, unsigned int d2); +extern void frmul(float *c, const float *a, const float *b, unsigned int d1, unsigned int d2, unsigned int d3); +extern float frdet(const float *c, unsigned int d); + +extern void frlufact(float *u, unsigned int *p, const float *a, unsigned int d); +extern void frlusolve(float *x, const float *b, const float *u, const unsigned int *p, unsigned int d); +extern void frinv(float *ainv, const float *a, unsigned d); + +extern void fctranspose(cplxfloat_t *b, const cplxfloat_t *a, unsigned int d1, unsigned int d2); +extern void fchermtranspose(cplxfloat_t *b, const cplxfloat_t *a, unsigned int d1, unsigned int d2); +extern void fcconj(cplxfloat_t *c, const cplxfloat_t *a, unsigned int d1, unsigned int d2); +extern void fcadd(cplxfloat_t *c, const cplxfloat_t *a, const cplxfloat_t *b, unsigned int d1, unsigned int d2); +extern void fcsub(cplxfloat_t *c, const cplxfloat_t *a, const cplxfloat_t *b, unsigned int d1, unsigned int d2); +extern void fcmul(cplxfloat_t *c, const cplxfloat_t *a, const cplxfloat_t *b, unsigned int d1, unsigned int d2, unsigned int d3); +extern cplxfloat_t fcdet(const cplxfloat_t *c, unsigned int d); + +extern void fclufact(cplxfloat_t *u, unsigned int *p, const cplxfloat_t *a, unsigned int d); +extern void fclusolve(cplxfloat_t *x, const cplxfloat_t *b, const cplxfloat_t *u, const unsigned int *p, unsigned int d); +extern void fcinv(cplxfloat_t *ainv, const cplxfloat_t *a, unsigned d); + + +#endif /* _MAT_H */ diff --git a/matlib/mat.hh b/matlib/mat.hh new file mode 100644 index 0000000..5c01bc0 --- /dev/null +++ b/matlib/mat.hh @@ -0,0 +1,502 @@ +/* + * Matrix operations library + * + * Copyright (C) 1999-2000, 2003 + * Thomas Sailer, + * + * 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 + */ + +#ifndef _MAT_HH +#define _MAT_HH + +#ifdef HAVE_CONFIG_H +#include +#endif + +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +#include +#include +#include + +class matrix_exception : public exception +{ +public: + matrix_exception(const string& e) throw() : err(e) {} + virtual ~matrix_exception() throw() {} + virtual const char* what() const throw() { return err.c_str(); } +private: + const string err; +}; + + +/* + * Simple matrix operations + */ + +template void madd(T *c, const T *a, const T *b, unsigned int d1, unsigned int d2) +{ + unsigned int i, j = d1 * d2; + for (i = 0; i < j; i++) + c[i] = a[i] + b[i]; +} + +template void msub(T *c, const T *a, const T *b, unsigned int d1, unsigned int d2) +{ + unsigned int i, j = d1 * d2; + for (i = 0; i < j; i++) + c[i] = a[i] - b[i]; +} + +/* c el R^{d1 x d3}, a el R^{d1 x d2}, b el R^{d2 x d3} */ +template void mmul(T *c, const T *a, const T *b, unsigned int d1, unsigned int d2, unsigned int d3) +{ + T *r = c, s; + unsigned int i, j, k; + if (c == a || c == b) + r = (T *)alloca(d1 * d3 * sizeof(r[0])); + for (i = 0; i < d1; i++) + for (k = 0; k < d3; k++) { + for (s = 0, j = 0; j < d2; j++) + s += a[i*d2+j] * b[j*d3+k]; + r[i*d3+k] = s; + } + if (r != c) + memcpy(c, r, d1 * d3 * sizeof(c[0])); +} + +template void mdet(const T *c, unsigned int d) +{ + T *c2; + unsigned int i, j, k, l; + T det = 0, dr; + + if (!d) + return 0; + if (d == 1) + return c[0]; + if (d == 2) + return c[0] * c[3] - c[1] * c[2]; + c2 = alloca(sizeof(T)*(d-1)*(d-1)); + for (i = 0; i < d; i++) { + for (j = k = 0; j < d; j++) { + if (j == i) + continue; + for (l = 0; l < d-1; l++) + c2[l*(d-1)+k] = c[(l+1)*d+j]; + k++; + } + dr = mdet(c2, d-1); + if (i & 1) + det -= dr * c[i]; + else + det += dr * c[i]; + } + return det; +} + +/* Transpose a matrix (a el C^{d1 x d2}, b el C^{d2 x d1}) */ +template void mtranspose(T *b, const T *a, unsigned int d1, unsigned int d2) +{ + const T *c = a; + unsigned int ci, bi, i, j; + + if (b == a) { + void *cc = alloca(d1 * d2 * sizeof(c[0])); + memcpy(cc, a, d1 * d2 * sizeof(c[0])); + c = (const T *)cc; + } + for (i = 0; i < d1; i++) + for (j = 0; j < d2; j++) { + ci = i*d2+j; + bi = j*d1+i; + b[bi] = c[ci]; + } +} + +/* Transpose a matrix (a el C^{d1 x d2}, b el C^{d2 x d1}) */ +template void mhermtranspose(complex *b, const complex *a, unsigned int d1, unsigned int d2) +{ + const complex *c = a; + unsigned int ci, bi, i, j; + + if (b == a) { + void *cc = alloca(d1 * d2 * sizeof(c[0])); + memcpy(cc, a, d1 * d2 * sizeof(c[0])); + c = (const complex *)cc; + } + for (i = 0; i < d1; i++) + for (j = 0; j < d2; j++) { + ci = i*d2+j; + bi = j*d1+i; + b[bi] = conj(c[ci]); + } +} + +template void mconj(complex *c, const complex *a, unsigned int d1, unsigned int d2) +{ + unsigned int i, j = d1 * d2; + for (i = 0; i < j; i++) + c[i] = conj(a[i]); +} + +/* + * complex cholesky factorization + */ + +/* + * A el C^{d x d} + * This routine calculates G*G^H = A, where G is lower triangular, and then uses this to solve + * A*c=b for c + * G*G^H*c=b + * G*t=b + * G^H*c=t + */ + +template inline T complex_pwr(complex c) +{ + return real(c) * real(c) + imag(c) * imag(c); +} + +template void mcholfactor(const complex *a, complex *g, unsigned int d) +{ + unsigned int i, j, k; + complex sc; + T s; + + memset(g, 0, d*d*sizeof(g[0])); + for (i = 0; i < d; i++) { + s = real(a[i*d+i]); + for (j = 0; j < i; j++) + s -= complex_pwr(g[i*d+j]); + if (s <= 0 || imag(a[i*d+i]) != 0) { + ostringstream os; + os << "mcholfactor: matrix not positive definite a[" << i << "][" << i << "]=" << a[i*d+i] << " s=" << s << "\n"; + throw matrix_exception(os.str()); + } + s = T(1) / sqrt(s); + g[i*d+i] = s; + for (j = i+1; j < d; j++) { + sc = a[j*d+i]; + for (k = 0; k < i; k++) + sc -= g[j*d+k] * conj(g[i*d+k]); + g[j*d+i] = sc * s; + } + } +} + +template void mcholapply(const complex *g, const complex *b, complex *c, unsigned int d) +{ + complex *t, s, s2; + unsigned int i, j; + + t = alloca(d*sizeof(t[0])); + for (i = 0; i < d; i++) { + s = b[i]; + for (j = 0; j < i; j++) + s -= g[i*d+j] * t[j]; + /* g's diagonal is real, therefore we have a division by a real */ + t[i] = s * real(g[i*d+i]); + } + for (i = d; i > 0; i--) { + s = t[i-1]; + for (j = i; j < d; j++) + s -= conj(g[j*d+(i-1)]) * c[j]; + /* g's diagonal is real, therefore we have a division by a real */ + c[i-1] = s * real(g[(i-1)*d+(i-1)]); + } +} + +/* + * real cholesky factorization + */ + +/* + * A el R^{d x d} + * This routine calculates G*G^T = A, where G is lower triangular, and then uses this to solve + * A*c=b for c + * G*G^T*c=b + * G*t=b + * G^T*c=t + */ + +template void mcholfactor(const T *a, T *g, unsigned int d) +{ + unsigned int i, j, k; + T s, s1; + + memset(g, 0, d*d*sizeof(g[0])); + for (i = 0; i < d; i++) { + s = a[i*d+i]; + for (j = 0; j < i; j++) + s -= g[i*d+j] * g[i*d+j]; + if (s <= 0) { + ostringstream os; + os << "mcholfactor: matrix not positive definite a[" << i << "][" << i << "]=" << a[i*d+i] << " s=" << s << "\n"; + throw matrix_exception(os.str()); + } + s = T(1) / sqrt(s); + g[i*d+i] = s; + for (j = i+1; j < d; j++) { + s1 = a[j*d+i]; + for (k = 0; k < i; k++) + s1 -= g[j*d+k] * g[i*d+k]; + g[j*d+i] = s * s1; + } + } +} + +template void mcholapply(const T *g, const T *b, T *c, unsigned int d) +{ + T *t; + unsigned int i, j; + float s1; + + t = (T *)alloca(d*sizeof(t[0])); + for (i = 0; i < d; i++) { + s1 = b[i]; + for (j = 0; j < i; j++) + s1 -= g[i*d+j] * t[j]; + t[i] = s1 * g[i*d+i]; + } + for (i = d; i > 0; i--) { + s1 = t[i-1]; + for (j = i; j < d; j++) + s1 -= g[j*d+(i-1)] * c[j]; + c[i-1] = s1 * g[(i-1)*d+(i-1)]; + } +} + + +template void mchol(const T *a, const T *b, T *c, unsigned int d) +{ + T *g; + g = (T *)alloca(d*d*sizeof(g[0])); + mcholfactor(a, g, d); + mcholapply(g, b, c, d); +} + +/* + * Complex Gaussian Elimination + */ + +/* + * Golub/van Loan, 3.1.3, p 112; PA=LU factorization with partial pivoting + */ + +template inline void swap(T& a, T& b) +{ + T c = a; + a = b; + b = c; +} + +template void mlufact(complex *u, unsigned int *p, const complex *a, unsigned int d) +{ + unsigned int i, j, k, mu; + complex fm; + T f1, f2; + + if (u != a) + memcpy(u, a, d*d*sizeof(u[0])); + for (k = 0; k < d-1; k++) { + /* search pivot index */ + for (f1 = 0, i = mu = k; i < d; i++) { + f2 = complex_pwr(u[i*d+k]); + if (f2 > f1) { + f1 = f2; + mu = i; + } + } + /* exchange rows */ + p[k] = mu; + for (i = k; i < d; i++) + swap(u[k*d+i], u[mu*d+i]); + fm = u[k*d+k]; + if (real(fm) != 0 || imag(fm) != 0) { + fm = T(1) / fm; + for (i = k+1; i < d; i++) + u[i*d+k] *= fm; + for (i = k+1; i < d; i++) + for (j = k+1; j < d; j++) + u[i*d+j] -= u[i*d+k] * u[k*d+j]; + } + } +} + +template void mlusolve(complex *x, const complex *b, const complex *u, const unsigned int *p, unsigned int d) +{ + complex *y, s; + unsigned int k, i; + + y = alloca(d * sizeof(y[0])); + memcpy(y, b, d * sizeof(y[0])); + for (k = 0; k < d-1; k++) { + i = p[k]; + if (i != k) + swap(y[k], y[i]); + if (real(y[k]) == 0 && imag(y[k]) == 0) + continue; + for (i = k+1; i < d; i++) + y[i] -= y[k] * u[i*d+k]; + } + /* solve Ux=y */ + for (k = d; k > 0; k--) { + s = y[k-1]; + for (i = k; i < d; i++) + s -= u[(k-1)*d+i] * x[i]; + x[k-1] = s / u[(k-1)*d+(k-1)]; + } +} + +/* + * Real Gaussian Elimination + */ + +/* + * Golub/van Loan, 3.1.3, p 112; PA=LU factorization with partial pivoting + */ + +template void mlufact(T *u, unsigned int *p, const T *a, unsigned int d) +{ + unsigned int i, j, k, mu; + T f1, f2; + + if (u != a) + memcpy(u, a, d*d*sizeof(u[0])); + for (k = 0; k < d-1; k++) { + /* search pivot index */ + for (f1 = 0, i = mu = k; i < d; i++) { + f2 = fabs(u[i*d+k]); + if (f2 > f1) { + f1 = f2; + mu = i; + } + } + /* exchange rows */ + p[k] = mu; + for (i = k; i < d; i++) + swap(u[k*d+i], u[mu*d+i]); + f1 = u[k*d+k]; + if (f1 != 0) { + f1 = 1 / f1; + for (i = k+1; i < d; i++) + u[i*d+k] *= f1; + for (i = k+1; i < d; i++) + for (j = k+1; j < d; j++) + u[i*d+j] -= u[i*d+k] * u[k*d+j]; + } + } +} + +template void mlusolve(T *x, const T *b, const T *u, const unsigned int *p, unsigned int d) +{ + T *y, s; + unsigned int k, i; + + y = alloca(d * sizeof(y[0])); + memcpy(y, b, d * sizeof(y[0])); + for (k = 0; k < d-1; k++) { + i = p[k]; + if (i != k) + swap(y[k], y[i]); + if (y[k] == 0) + continue; + for (i = k+1; i < d; i++) + y[i] -= y[k] * u[i*d+k]; + } + /* solve Ux=y */ + for (k = d; k > 0; k--) { + s = y[k-1]; + for (i = k; i < d; i++) + s -= u[(k-1)*d+i] * x[i]; + x[k-1] = s / u[(k-1)*d+(k-1)]; + } +} + +template void minv(T *ainv, const T *a, unsigned int d) +{ + T *u, *y; + unsigned int *p; + unsigned int k; + + u = alloca(d * d * sizeof(u[0])); + p = alloca((d-1) * sizeof(p[0])); + mlufact(u, p, a, d); + for (k = 0; k < d; k++) { + y = &ainv[k*d]; + memset(y, 0, d * sizeof(y[0])); + y[k] = T(1); + mlusolve(y, y, u, p, d); + } + mtranspose(ainv, ainv, d, d); +} + +/* + * Gauss-Seidel iterative solver + */ + +/* + * This routine calculates A*c=b iteratively, using the Gauss-Seidel iteration method + */ + +template void mgaussseidel(const complex *a, const complex *b, complex *c, unsigned int d, unsigned int iter) +{ + complex *adiag; + unsigned int i, j, k; + complex s; + + adiag = alloca(d*sizeof(adiag[0])); + /* initial vector */ + for (i = 1; i < d; i++) + c[i] = T(0); + c[0] = T(1); + /* check for diagonal */ + for (i = 0; i < d; i++) { + if (a[i*d+i] == T(0)) { + ostringstream os; + os << "mgaussseidel: matrix diagonal zero a[" << i << "][" << i << "]=" << a[i*d+i] << "\n"; + throw matrix_exception(os.str()); + } + adiag[i] = T(1) / a[i*d+i]; + } + /* iteration */ + for (i = 0; i < iter; i++) { + for (j = 0; j < d; j++) { + s = b[j]; + for (k = 0; k < j; k++) + s -= a[j*d+k] * c[k]; + for (k = j+1; k < d; k++) + s -= a[j*d+k] * c[k]; + c[j] = s * adiag[j]; + } + } +} + +#endif /* _MAT_H */ diff --git a/matlib/randn.c b/matlib/randn.c new file mode 100644 index 0000000..0a468d3 --- /dev/null +++ b/matlib/randn.c @@ -0,0 +1,41 @@ +/* + * Matrix operations library + * + * Copyright (C) 1999-2000 + * Thomas Sailer, + * + * 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 + */ + +#include "mat.h" +#include + +/* + * Approximation of a normally distributed random number generator + * with unit variance + * + * division factor: randommax * sqrt(nrand / 12) + * with nrand = 16 and randommax = 0x1000 + */ + +float randn(void) +{ + int sum = 0, i; + + for (i = 0; i < 16; i++) + sum += random() & 0xfff; + return (sum - 0x8000) * (1.0 / 4729.7); +} + diff --git a/matlib/tests.c b/matlib/tests.c new file mode 100644 index 0000000..15c9d93 --- /dev/null +++ b/matlib/tests.c @@ -0,0 +1,251 @@ +/* + * Matrix operations library + * + * Copyright (C) 1999-2000 + * Thomas Sailer, + * + * 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 + */ + +/* Test matrix routines */ + +#include +#include +#include +#include +#include +#include "mat.h" + +static int frmatprintf(const char *name, unsigned int size1, unsigned int stride1, + unsigned int size2, unsigned int stride2, const float *m) +{ + unsigned int i, j; + int ret = 0; + + fprintf(stdout, "%s = [", name); + for (i = 0; i < size1; i++) { + for (j = 0; j < size2; j++) + ret += fprintf(stdout, " %g", m[i*stride1 + j*stride2]); + if (i+1 < size1) + ret += fprintf(stdout, " ; ...\n "); + } + ret += fprintf(stdout, " ];\n"); + return ret; +} + +static int fcmatprintf(const char *name, unsigned int size1, unsigned int stride1, + unsigned int size2, unsigned int stride2, const cplxfloat_t *m) +{ + unsigned int i, j; + int ret = 0; + + fprintf(stdout, "%s = [", name); + for (i = 0; i < size1; i++) { + for (j = 0; j < size2; j++) { + ret += fprintf(stdout, " %g", real(m[i*stride1 + j*stride2])); + if (imag(m[i*stride1 + j*stride2]) != 0) + ret += fprintf(stdout, "%+gi", imag(m[i*stride1 + j*stride2])); + } + if (i+1 < size1) + ret += fprintf(stdout, " ; ...\n "); + } + ret += fprintf(stdout, " ];\n"); + return ret; +} + +static int testfrgolub(void) +{ + static const float a[9] = { 3, 17, 10, 2, 4, -2, 6, 18, -12 }; + static const float uexp[9] = { 6, 18, -12, 1.0/3, 8, 16, 1.0/2, -1.0/4, 6 }; + float u[9]; + unsigned int p[2]; + unsigned int i, err = 0; + + frlufact(u, p, a, 3); + for (i = 0; i < 9; i++) + if (fabs(u[i] - uexp[i]) > 0.0001) + err |= 1; + if (err & 1) { + printf("LU factorization (Golub example) error!\n"); + frmatprintf("a", 3, 3, 3, 1, a); + frmatprintf("u", 3, 3, 3, 1, u); + frmatprintf("uexp", 3, 3, 3, 1, uexp); + } + return err ? 1 : 0; +} + + +static int testfrinv(void) +{ + unsigned int d; + float *a, *b, *c; + unsigned int i, j, err = 0; + + d = (random() & 15) + 1; + a = alloca(d * d * sizeof(a[0])); + b = alloca(d * d * sizeof(b[0])); + c = alloca(d * d * sizeof(c[0])); + for (i = 0; i < d*d; i++) + a[i] = (random() - RAND_MAX/2) * (4.0 / RAND_MAX); + /* check normal inversion */ + frinv(b, a, d); + frmul(c, a, b, d, d, d); + for (i = 0; i < d; i++) + for (j = 0; j < d; j++) + if (((i == j) && (fabs(c[i*d+j] - 1) > 0.0001)) || + ((i != j) && (fabs(c[i*d+j] - 0) > 0.0001))) + err |= 1; + if (err & 1) { + printf("LU inversion error!\n"); + frmatprintf("a", d, d, d, 1, a); + frmatprintf("b", d, d, d, 1, b); + frmatprintf("c", d, d, d, 1, c); + } + return err ? 1 : 0; +} + +static int testfrchol(void) +{ + unsigned int d; + float *a, *b, *c, *g, *z; + unsigned int i, j, err = 0; + + d = (random() & 15) + 1; + a = alloca(d * d * sizeof(a[0])); + b = alloca(d * d * sizeof(b[0])); + c = alloca(d * d * sizeof(c[0])); + g = alloca(d * d * sizeof(g[0])); + for (i = 0; i < d; i++) { + a[i*d+i] = (random() - RAND_MAX/2) * (4.0 / RAND_MAX); + a[i*d+i] *= a[i*d+i]; + for (j = i+1; j < d; j++) + a[i*d+i] += fabs(a[i*d+j] = a[j*d+i] = (random() - RAND_MAX/2) * (4.0 / RAND_MAX)); + } + if (frcholfactor(a, g, d)) + return 1; + for (i = 0; i < d; i++) { + z = &b[i*d]; + memset(z, 0, d * sizeof(z[0])); + z[i] = 1; + frcholapply(g, z, z, d); + } + frtranspose(b, b, d, d); + frmul(c, a, b, d, d, d); + for (i = 0; i < d; i++) + for (j = 0; j < d; j++) + if (((i == j) && (fabs(c[i*d+j] - 1) > 0.0001)) || + ((i != j) && (fabs(c[i*d+j] - 0) > 0.0001))) + err |= 1; + if (err & 1) { + printf("Cholesky inversion error!\n"); + frmatprintf("a", d, d, d, 1, a); + frmatprintf("b", d, d, d, 1, b); + frmatprintf("c", d, d, d, 1, c); + } + return err ? 1 : 0; +} + +static inline float cdiffsq(cplxfloat_t c, float r) +{ + real(c) -= r; + return real(c) * real(c) + imag(c) * imag(c); +} + +static int testfcinv(void) +{ + unsigned int d; + cplxfloat_t *a, *b, *c; + unsigned int i, j, err = 0; + + d = (random() & 15) + 1; + a = alloca(d * d * sizeof(a[0])); + b = alloca(d * d * sizeof(b[0])); + c = alloca(d * d * sizeof(c[0])); + for (i = 0; i < d*d; i++) + cplx(a[i], (random() - RAND_MAX/2) * (4.0 / RAND_MAX), + (random() - RAND_MAX/2) * (4.0 / RAND_MAX)); + /* check normal inversion */ + fcinv(b, a, d); + fcmul(c, a, b, d, d, d); + for (i = 0; i < d; i++) + for (j = 0; j < d; j++) + if (((i == j) && (cdiffsq(c[i*d+j], 1) > 0.0001)) || + ((i != j) && (cdiffsq(c[i*d+j], 0) > 0.0001))) + err |= 1; + if (err & 1) { + printf("Complex LU inversion error!\n"); + fcmatprintf("a", d, d, d, 1, a); + fcmatprintf("b", d, d, d, 1, b); + fcmatprintf("c", d, d, d, 1, c); + } + return err ? 1 : 0; +} + +static int testfcchol(void) +{ + unsigned int d; + cplxfloat_t *a, *b, *c, *g, *z; + float v; + unsigned int i, j, err = 0; + + d = (random() & 15) + 1; + a = alloca(d * d * sizeof(a[0])); + b = alloca(d * d * sizeof(b[0])); + c = alloca(d * d * sizeof(c[0])); + g = alloca(d * d * sizeof(g[0])); + for (i = 0; i < d; i++) { + v = (random() - RAND_MAX/2) * (4.0 / RAND_MAX); + cplx(a[i*d+i], v * v, 0); + for (j = i+1; j < d; j++) { + cplx(a[i*d+j], (random() - RAND_MAX/2) * (4.0 / RAND_MAX), + (random() - RAND_MAX/2) * (4.0 / RAND_MAX)); + conj(a[j*d+i], a[i*d+j]); + real(a[i*d+i]) += fabs(real(a[i*d+j])) + fabs(imag(a[i*d+j])); + } + } + if (fccholfactor(a, g, d)) + return 1; + for (i = 0; i < d; i++) { + z = &b[i*d]; + memset(z, 0, d * sizeof(z[0])); + cplx(z[i], 1, 0); + fccholapply(g, z, z, d); + } + fctranspose(b, b, d, d); + fcmul(c, a, b, d, d, d); + for (i = 0; i < d; i++) + for (j = 0; j < d; j++) + if (((i == j) && (cdiffsq(c[i*d+j], 1) > 0.0001)) || + ((i != j) && (cdiffsq(c[i*d+j], 0) > 0.0001))) + err |= 1; + if (err & 1) { + printf("Complex Cholesky inversion error!\n"); + fcmatprintf("a", d, d, d, 1, a); + fcmatprintf("b", d, d, d, 1, b); + fcmatprintf("c", d, d, d, 1, c); + } + return err ? 1 : 0; +} + +int main(int argc, char *argv[]) +{ + srandom(time(NULL)); + testfrgolub(); + testfrinv(); + testfrchol(); + testfcinv(); + testfcchol(); + return 0; +} diff --git a/missing b/missing new file mode 100755 index 0000000..09edd88 --- /dev/null +++ b/missing @@ -0,0 +1,357 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2005-02-08.22 + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# 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. + +# 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. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). +case "$1" in + lex|yacc) + # Not GNU programs, they don't have --version. + ;; + + tar) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + touch $file + ;; + + tar) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100755 index 0000000..4d517f9 --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +# $Id: mkinstalldirs,v 1.2 2002/08/09 20:15:31 sailer Exp $ + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/newqpsk/ChangeLog b/newqpsk/ChangeLog new file mode 100644 index 0000000..8425bdb --- /dev/null +++ b/newqpsk/ChangeLog @@ -0,0 +1,58 @@ +2001-01-19 Tomi Manninen + + * Implemented runtime configurable tune/sync length adjustment + +2000-09-16 Tomi Manninen + + * The modem now does variable sampling rates! + +2000-08-14 Tomi Manninen + + * Integrated to the new soundmodem code from Thomas. + +2000-07-02 Tomi Manninen + + * Version 0.0.4 + + * RPM spec file + + * Changed the default channel access parameters + +2000-03-11 Tomi Manninen + + * Some reordering in rxdata() + + * Implemented frequency and sync tracking in data phase + + * Implemented data carrier S/N reporting + + * Hopefully fixed the "modulate_calib error" problem + +2000-03-07 Tomi Manninen + + * Version 0.0.3 + + * The modem should now work with the standard kernel sound + drivers as well (I use ALSA drivers...) + + * Added BCH(15,7) error correction code. See the supplied + soundmodem.conf sample file for details. (The code is from + Charles Brain G4GUO, I hope he doesn't mind...) + + * Minor changes in the documentation + +2000-02-07 Tomi Manninen + + * Version 0.0.2 + + * Changed to using a config.h file + + * A small optimization in newqpskrx.c + + * The bug causing TX to hang should be squashed now (a typo in + newqpsktx.c...) + +1999-12-14 Tomi Manninen + + * First public release (0.0.1) + diff --git a/newqpsk/Makefile.am b/newqpsk/Makefile.am new file mode 100644 index 0000000..e44fdb5 --- /dev/null +++ b/newqpsk/Makefile.am @@ -0,0 +1,26 @@ +INCLUDES = -I$(top_srcdir)/soundcard + +noinst_LIBRARIES = libnewqpsk.a + +libnewqpsk_a_SOURCES = \ + modulator.c newqpsktx.c \ + demodulator.c newqpskrx.c \ + fec.c bch.c tbl.c filter.c + +noinst_HEADERS = \ + bch.h complex.h fec.h fectable.h filter-i386.h filter.h \ + misc.h modemconfig.h newqpskrx.h newqpsktx.h tbl.h + +if CROSSCOMP +else + +noinst_PROGRAMS = genfilt +genfilt_SOURCES = genfilt.c +# BUILT_SOURCES = filter-i386.h + +filter-i386.h: genfilt$(EXEEXT) + ./genfilt > filter-i386.h + +endif + +EXTRA_DIST = README.newqpsk diff --git a/newqpsk/Makefile.in b/newqpsk/Makefile.in new file mode 100644 index 0000000..f930623 --- /dev/null +++ b/newqpsk/Makefile.in @@ -0,0 +1,526 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +@CROSSCOMP_FALSE@noinst_PROGRAMS = genfilt$(EXEEXT) +subdir = newqpsk +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in ChangeLog +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +libnewqpsk_a_AR = $(AR) $(ARFLAGS) +libnewqpsk_a_LIBADD = +am_libnewqpsk_a_OBJECTS = modulator.$(OBJEXT) newqpsktx.$(OBJEXT) \ + demodulator.$(OBJEXT) newqpskrx.$(OBJEXT) fec.$(OBJEXT) \ + bch.$(OBJEXT) tbl.$(OBJEXT) filter.$(OBJEXT) +libnewqpsk_a_OBJECTS = $(am_libnewqpsk_a_OBJECTS) +PROGRAMS = $(noinst_PROGRAMS) +am__genfilt_SOURCES_DIST = genfilt.c +@CROSSCOMP_FALSE@am_genfilt_OBJECTS = genfilt.$(OBJEXT) +genfilt_OBJECTS = $(am_genfilt_OBJECTS) +genfilt_LDADD = $(LDADD) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libnewqpsk_a_SOURCES) $(genfilt_SOURCES) +DIST_SOURCES = $(libnewqpsk_a_SOURCES) $(am__genfilt_SOURCES_DIST) +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUDIOFILE_CFLAGS = @AUDIOFILE_CFLAGS@ +AUDIOFILE_LIBS = @AUDIOFILE_LIBS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +HAVE_ALSA = @HAVE_ALSA@ +HAVE_BITTYPES = @HAVE_BITTYPES@ +HAVE_DIRECTX = @HAVE_DIRECTX@ +HAVE_IFRNEWNAME = @HAVE_IFRNEWNAME@ +HAVE_MKISS = @HAVE_MKISS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTHREAD = @LIBTHREAD@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +M_PI = @M_PI@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USEMMX = @USEMMX@ +USEVIS = @USEVIS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WIN32 = @WIN32@ +WINDRES = @WINDRES@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CFLAGS = @XML_CFLAGS@ +XML_LIBS = @XML_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +INCLUDES = -I$(top_srcdir)/soundcard +noinst_LIBRARIES = libnewqpsk.a +libnewqpsk_a_SOURCES = \ + modulator.c newqpsktx.c \ + demodulator.c newqpskrx.c \ + fec.c bch.c tbl.c filter.c + +noinst_HEADERS = \ + bch.h complex.h fec.h fectable.h filter-i386.h filter.h \ + misc.h modemconfig.h newqpskrx.h newqpsktx.h tbl.h + +@CROSSCOMP_FALSE@genfilt_SOURCES = genfilt.c +EXTRA_DIST = README.newqpsk +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu newqpsk/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu newqpsk/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libnewqpsk.a: $(libnewqpsk_a_OBJECTS) $(libnewqpsk_a_DEPENDENCIES) + -rm -f libnewqpsk.a + $(libnewqpsk_a_AR) libnewqpsk.a $(libnewqpsk_a_OBJECTS) $(libnewqpsk_a_LIBADD) + $(RANLIB) libnewqpsk.a + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) +genfilt$(EXEEXT): $(genfilt_OBJECTS) $(genfilt_DEPENDENCIES) + @rm -f genfilt$(EXEEXT) + $(LINK) $(genfilt_OBJECTS) $(genfilt_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bch.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/demodulator.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fec.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genfilt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modulator.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newqpskrx.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newqpsktx.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tbl.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES clean-noinstPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am + +# BUILT_SOURCES = filter-i386.h + +@CROSSCOMP_FALSE@filter-i386.h: genfilt$(EXEEXT) +@CROSSCOMP_FALSE@ ./genfilt > filter-i386.h + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/newqpsk/README.newqpsk b/newqpsk/README.newqpsk new file mode 100644 index 0000000..d79eaf4 --- /dev/null +++ b/newqpsk/README.newqpsk @@ -0,0 +1,133 @@ +NEWQPSK modem for the Usermode Soundcard Modem driver +===================================================== + +This package implements the NEWQPSK protocol (also known as Q15X25) as +designed and defined by Pawel Jalocha, SP9VRC, . +Pawel's original modem is written in Motorola 56k assembler for the +DSP56002EVM evaluation module or the Alef Null DSP Card 4. This code +is a port of the original code to C. + +Most of the features of the original modem are implemented. The most +important feature still lacking is the support for tuning the transceiver. +The modem has been used for real life QSOs with performance comparable to +the original modem. + +Soundmodem configuration +======================== + +There is an IMPORTANT detail in soundmodem core configuration concerning +NEWQPSK. In the "Channel Access" section one should set "TxDelay" to a +non-zero value. The actual value does not matter, the modem will ignore +it. (If your transmitter is slow and you need to compensate that then you +can increase "Tune length" as explained later.) Equally important is that +one sets "TxTail" to zero. Failing to set these will cause the NEWQPSK +modem to behave erratically. + +The actual NEWQPSK modulator and demodulator are subject to five +configuration parameters that can be set with the `soundmodemconfig' tool: + + Bits per second + + This sets the modem raw bit rate. The available range is 1000 to + 5000. Rates 2500bps and 3000bps correspond to sample rates of + 8000sps and 9600sps in the original code respectively. + + Interleave depth + + Sets the interleave depth. Allowed range is 0...16. Zero + disables interleaving. + + FEC level + + Sets the used error correcting code. Possible values are: + + 0 no FEC + 1 simple (15,11) FEC + 2 BCH (15,7) FEC. + 3 Walsh (15,5) FEC + + Note that BCH (15,7) is NOT compatible with the original + EVM56K modem. + + The FEC overhead can be calculated from the figures in + parenthesis. For example Walsh (15,5) lowers the user data + rate to 2500*5/15 = 833.3 bps. + + Tune length + + On modulator side this sets the length of the tune preamble + in symbols. Allowed range is 0...64. + + On demodulator side this sets the minimum of received + tune preamble symbols needed to make a tuning decision. + Allowed range is 0...32. Zero means the demodulator will jump + directly to waiting sync state. + + Sync length + + On modulator side this sets the length of the sync preamble + in symbols. Allowed range is 16...64. + + On demodulator side this sets the minimum of received + sync preamble symbols needed to make a symbol sync decision. + Allowed range is 8...32. + +More detailed configuration of the modem parameters can be done at compile +time with the modemconfig.h file in this directory. The parameters there +are not to be changed unless you know what you are doing... :) + +NEWQPSK FEATURES +================ + +NEWQPSK modem was designed primarily with HF in mind. You are supposed to +connect it to a normal HF SSB rig. However NEWQPSK might also find some +use in VHF/UHF FM packet. As FM has no frequency ambiquity the tune +preamble can be disabled (tune length = 0). Also it might make sense to +shorten the sync preamble. + +NEWQPSK is an AX.25 packet modem and can be used for anything regular +packet can, including TCP/IP. Here is a short list of NEWQPSK highlights: + + - AX.25 compatible + + - 15 carriers spaced by 125 Hz (150 Hz) modulated with DQPSK + (differential 4-level phase shift keying) at 83.33 baud (100 baud) + + - Total raw data rate 2500 bps (3000 bps) + + - Two phase preamble for frequency shift correction and fast symbol + sync. The modem can correct frequency shift up to about 100 Hz. + + - Forward Error Correction: three simple schemes with different levels + of data redundancy + + - Time/frequency diversity (interleave) to de-localize burst errors + +(The figures in parenthesis above are for sample rate of 9600 sps.) + +Note that the envelope of the transmitted signal is NOT constant. The +modulation has a crest factor of about XX dB which means that with a 100W +transmitter and a power meter that reads average power you should adjust +the output reading to about YY Watts. Exceeding this will cause clipping +that will not only cause interference to other band users but also make +copy at the other end worse. + +Also keep in mind that this is a WIDE mode (about 2000...2400Hz wide). You +should be very careful not to transmit over other band users and you +should probably keep away from the narrow band digital segments. + +DISCLAIMER +========== + +The sole purpose for me to write this modem implementation was to learn +about DSP in general and Pawel's novel modem in particular. I'm fairly new +to DSP and this code is mostly a result of countless hours of staring at +the original Motorola 56K assembler source and banging my head against the +wall... I can't claim I understand all aspects and every detail in the +modem. There are probably misunderstandings and errors in the code and if +you spot one, please tell me. I want to learn more. Also if you have ideas +for further development please share them with me. I have already some +ideas of my own. + +-- +Tomi Manninen, OH2BNS diff --git a/newqpsk/bch.c b/newqpsk/bch.c new file mode 100644 index 0000000..28db19b --- /dev/null +++ b/newqpsk/bch.c @@ -0,0 +1,126 @@ +/* + * This program generates and decodes (15,7) BCH codes. + * + * Reference: + * + * MIL-STD-188-220B Appendix K + * + * C.H Brain G4GUO emailto:chbrain@dircon.co.uk + * + * A small modification by Tomi Manninen, OH2BNS + */ +#if 0 +#include +#include +#endif + +#include "bch.h" + +static unsigned char G[8]= +{ + 0x68, + 0x34, + 0x1A, + 0x0D, + 0x6E, + 0x37, + 0x73, + 0x51 +}; + +#define A1 0x080D +#define A2 0x2203 +#define A3 0x5101 +#define A4 0x00D1 + +static unsigned int parity(unsigned int word, int length) +{ + int i,count; + + for(i=0,count=0;i= 3) + { + bit = (code^1)&1; + } + else + { + bit = (code^0)&1; + } + code >>=1; + code |= bit?0x4000:0; + output >>=1; + output |= bit?0x4000:0; + } + *error = code ^ input; + return (unsigned char)(output&0x7F); +} +unsigned int encode_bch_codeword(unsigned char data) +{ + unsigned int word; + int i; + + for(i=0,word=0; i<8; i++) + { + word <<=1; + word |= parity((data&G[i]),8); + } + word = (word<<7)+data; + return word; +} +/* + * For test only. + */ +#if 0 +int main(int argc, char *argv[]) +{ + unsigned int test =0x42; + unsigned int error=0x1010; + + if(argc >= 3) + { + test = (int)strtol(argv[1],(char**)NULL,16); + error = (int)strtol(argv[2],(char**)NULL,16); + } + + printf("INPUT DATA %.2X\n",test); + + test = encode_bch_codeword(test); + + printf("ENCODED DATA %.4X - %.2X %.2X\n",test, test>>7, test&0x7F); + + printf("ERROR VECTOR %.4X\n",error); + + test ^=error; + + printf("ERROR + DATA %.4X - %.2X %.2X\n",test, test>>7, test&0x7F); + + test = decode_bch_codeword(test, &error); + + printf("DECODED DATA %.2X\n",test); + + printf("ERROR VECTOR %.4X\n",error); + + return test; +} +#endif +/**/ + diff --git a/newqpsk/bch.h b/newqpsk/bch.h new file mode 100644 index 0000000..611eb57 --- /dev/null +++ b/newqpsk/bch.h @@ -0,0 +1,23 @@ +/* + * This program generates and decodes (15,7) BCH code words. + * + * Reference: + * + * MIL-STD-188-220B Appendix K + * + * C.H Brain G4GUO emailto:chbrain@dircon.co.uk + * + * A small modification by Tomi Manninen, OH2BNS + */ +#ifndef __BCH_H__ +#define __BCH_H__ + +#define BCH_CODEWORD_SIZE 15 + +unsigned char decode_bch_codeword(unsigned int code, unsigned int *err); +unsigned int encode_bch_codeword(unsigned char data); + +#endif + + + diff --git a/newqpsk/complex.h b/newqpsk/complex.h new file mode 100644 index 0000000..2353865 --- /dev/null +++ b/newqpsk/complex.h @@ -0,0 +1,80 @@ +#ifndef _COMPLEX_H +#define _COMPLEX_H + +#include + +typedef struct { + float re, im; +#ifdef __ia64__ + int dummy; +#endif +} complex; + +/* + * Complex multiplication. + */ +extern __inline__ complex cmul(complex x, complex y) +{ + complex z; + + z.re = x.re * y.re - x.im * y.im; + z.im = x.re * y.im + x.im * y.re; + + return z; +} + +/* + * Complex ... yeah, what??? Returns a complex number that has the + * properties: |z| = |x| * |y| and arg(z) = arg(y) - arg(x) + */ +extern __inline__ complex ccor(complex x, complex y) +{ + complex z; + + z.re = x.re * y.re + x.im * y.im; + z.im = x.re * y.im - x.im * y.re; + + return z; +} + +/* + * Real part of the complex ??? + */ +extern __inline__ float ccorI(complex x, complex y) +{ + return x.re * y.re + x.im * y.im; +} + +/* + * Imaginary part of the complex ??? + */ +extern __inline__ float ccorQ(complex x, complex y) +{ + return x.re * y.im - x.im * y.re; +} + +/* + * Modulo (absolute value) of a complex number. + */ +extern __inline__ float cmod(complex x) +{ + return sqrt(x.re * x.re + x.im * x.im); +} + +/* + * Square of the absolute value (power). + */ +extern __inline__ float cpwr(complex x) +{ + return (x.re * x.re + x.im * x.im); +} + +/* + * Argument of a complex number. + */ +extern __inline__ float carg(complex x) +{ + return atan2(x.im, x.re); +} + +#endif diff --git a/newqpsk/demodulator.c b/newqpsk/demodulator.c new file mode 100644 index 0000000..e9a44d0 --- /dev/null +++ b/newqpsk/demodulator.c @@ -0,0 +1,176 @@ +/*****************************************************************************/ + +/* + * demodulator.c -- NEWQPSK demodulator. + * + * Copyright (C) 2000 Tomi Manninen (tomi.manninen@hut.fi) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE +#define _REENTRANT + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "modem.h" +#include "complex.h" +#include "modemconfig.h" +#include "fec.h" +#include "filter.h" +#include "newqpskrx.h" +#include "tbl.h" + +#include +#include + +/* --------------------------------------------------------------------- */ + +static const struct modemparams demodparams[] = { + { "bps", "Bits/s", "Bits per second", "2500", MODEMPAR_NUMERIC, { n: { 1000, 5000, 100, 500 } } }, + { "inlv", "Interleave", "Interleave depth", "8", MODEMPAR_NUMERIC, { n: { 0, 16, 1, 4 } } }, + { "fec", "FEC", "FEC level", "3", MODEMPAR_NUMERIC, { n: { 0, 3, 1, 1 } } }, + { "mintune", "Tune length", "Minimum tune preamble length", "16", MODEMPAR_NUMERIC, { n: { 0, 32, 1, 1 } } }, + { "minsync", "Sync length", "Minimum sync preamble length", "16", MODEMPAR_NUMERIC, { n: { 8, 32, 1, 1 } } }, + { NULL } +}; + +#define SAMPLERATE(x) ((float)(x)*SymbolLen/DataCarriers/SymbolBits) + +static void *demodconfig(struct modemchannel *chan, unsigned int *samplerate, const char *params[]) +{ + struct rxstate *s; + + if ((s = calloc(1, sizeof(struct rxstate))) == NULL) + logprintf(MLOG_FATAL, "out of memory"); + s->chan = chan; + if (params[0]) { + s->bps = strtoul(params[0], NULL, 0); + if (s->bps < 1000) + s->bps = 1000; + if (s->bps > 5000) + s->bps = 5000; + } else + s->bps = 2500; + if (params[1]) { + s->fec.inlv = strtoul(params[1], NULL, 0); + if (s->fec.inlv < 0) + s->fec.inlv = 0; + if (s->fec.inlv > 16) + s->fec.inlv = 16; + } else + s->fec.inlv = 8; + if (params[2]) { + s->fec.feclevel = strtoul(params[2], NULL, 0); + if (s->fec.feclevel < 0) + s->fec.feclevel = 0; + if (s->fec.feclevel > 3) + s->fec.feclevel = 3; + } else + s->fec.feclevel = 3; + if (params[3]) { + s->mintune = strtoul(params[3], NULL, 0); + if (s->mintune < 0) + s->mintune = 0; + if (s->mintune > 32) + s->mintune = 32; + } else + s->mintune = 16; + if (params[4]) { + s->minsync = strtoul(params[4], NULL, 0); + if (s->minsync < 8) + s->minsync = 8; + if (s->minsync > 32) + s->minsync = 32; + } else + s->mintune = 16; + *samplerate = (int) (3.0 * SAMPLERATE(s->bps) + 0.5); + return s; +} + +static void demodinit(void *state, unsigned int samplerate, unsigned int *bitrate) +{ + struct rxstate *s = (struct rxstate *)state; + float rate, f1, f2; + + s->srate = SAMPLERATE(s->bps); + rate = SAMPLERATE(s->bps) / samplerate; + f1 = 0.1 * rate; + f2 = 0.9 * rate; + init_tbl(); + init_fec(&s->fec); + init_filter(&s->filt, rate, f1, f2); + init_newqpskrx(state); + *bitrate = s->bps; +} + +static complex getsample(struct rxstate *s) +{ + int16_t samples[SymbolLen]; + complex csamples[SymbolLen]; + int i; + + if (s->bufptr >= s->buflen) { + audioread(s->chan, samples, SymbolLen, s->rxphase); + s->rxphase = (s->rxphase + SymbolLen) & 0xffff; + + for (i = 0; i < SymbolLen; i++) { + csamples[i].re = samples[i] * (1.0 / 32768.0); + csamples[i].im = csamples[i].re; + } + + s->buflen = filter(&s->filt, csamples, s->rxbuf); + s->bufptr = 0; + } + return s->rxbuf[s->bufptr++]; +} + +static void demoddemodulate(void *state) +{ + struct rxstate *s = (struct rxstate *)state; + complex buf[SymbolLen / 2]; + int i; + + s->rxphase = audiocurtime(s->chan); + for (;;) { + for (i = 0; i < s->skip; i++) + getsample(s); + s->skip = 0; + + for (i = 0; i < SymbolLen / 2; i++) + buf[i] = getsample(s); + + newqpskrx(state, buf); + } +} + +/* --------------------------------------------------------------------- */ + +struct demodulator newqpskdemodulator = { + NULL, + "newqpsk", + demodparams, + demodconfig, + demodinit, + demoddemodulate, + free +}; + +/* --------------------------------------------------------------------- */ diff --git a/newqpsk/fec.c b/newqpsk/fec.c new file mode 100644 index 0000000..68f003e --- /dev/null +++ b/newqpsk/fec.c @@ -0,0 +1,146 @@ +#include "modemconfig.h" +#include "fec.h" +#include "fectable.h" +#include "bch.h" +#include "misc.h" + +/* --------------------------------------------------------------------- */ + +unsigned deinlv(struct fecstate *f, unsigned in) +{ + unsigned i, ptr, out; + + if (!f->inlv) + return in; + + out = 0; + ptr = f->inlvptr; + + for (i = 0; i < DataCarriers; i++) { + out |= f->inlvpipe[ptr] & InterleavePattern[i]; + ptr = (ptr + f->inlv) % (f->inlv * DataCarriers); + } + + f->inlvpipe[f->inlvptr] = in; + f->inlvptr = (f->inlvptr + 1) % (f->inlv * DataCarriers); + + return out; +} + +unsigned inlv(struct fecstate *f, unsigned in) +{ + unsigned i, ptr, out; + + if (!f->inlv) + return in; + + ptr = f->inlvptr; + + for (i = 0; i < DataCarriers; i++) { + f->inlvpipe[ptr] |= in & InterleavePattern[i]; + ptr = (ptr + f->inlv) % (f->inlv * DataCarriers); + } + + out = f->inlvpipe[f->inlvptr]; + f->inlvpipe[f->inlvptr] = 0; + f->inlvptr = (f->inlvptr + 1) % (f->inlv * DataCarriers); + + return out; +} + +/* --------------------------------------------------------------------- */ + +static unsigned fec1511encode(unsigned in) +{ + unsigned i, out; + + in &= 0x7ff; + out = 0; + + for (i = 0; i < 11; i++) + if (in & (1 << i)) + out ^= FEC1511EncodeTable[i]; + + return in | out; +} + +static unsigned fec1511decode(unsigned in, unsigned *err) +{ + unsigned crc; + + crc = fec1511encode(in); + crc ^= in; + crc >>= 11; + *err = FEC1511DecodeTable[crc]; + + return *err ^ in; +} + +/* --------------------------------------------------------------------- */ + +static unsigned walshencode(unsigned in) +{ + return WalshTable[in & 0x1f]; +} + +static unsigned walshdecode(unsigned in, unsigned *err) +{ + unsigned i, out, diff, dist, best; + + out = 0; + best = 16; + + for (i = 0; i < 32; i++) { + diff = in ^ WalshTable[i]; + dist = hweight16(diff); + if (dist < best) { + out = i; + best = dist; + *err = diff; + } + } + + return out; +} + +/* --------------------------------------------------------------------- */ + +unsigned fecdecode(struct fecstate *f, unsigned data, unsigned *errors) +{ + switch (f->feclevel) { + case 0: + errors = 0; + break; + case 1: + data = fec1511decode(data, errors); + break; + case 2: + data = decode_bch_codeword(data, errors); + break; + case 3: + data = walshdecode(data, errors); + break; + } + return data; +} + +unsigned fecencode(struct fecstate *f, unsigned data) +{ + switch (f->feclevel) { + case 0: + break; + case 1: + data = fec1511encode(data); + break; + case 2: + data = encode_bch_codeword(data); + break; + case 3: + data = walshencode(data); + break; + } + return data; +} + +/* --------------------------------------------------------------------- */ + diff --git a/newqpsk/fec.h b/newqpsk/fec.h new file mode 100644 index 0000000..109ad51 --- /dev/null +++ b/newqpsk/fec.h @@ -0,0 +1,55 @@ +#ifndef _FEC_H +#define _FEC_H + +/* --------------------------------------------------------------------- */ + +struct fecstate { + int feclevel; + int bitbatchlen; + int inlv; + unsigned inlvpipe[MaxInlv * DataCarriers]; + unsigned inlvptr; +}; + +/* --------------------------------------------------------------------- */ + +extern inline void init_fec(struct fecstate *f) +{ + switch (f->feclevel) { + case 0: + f->bitbatchlen = 15; + break; + case 1: + f->bitbatchlen = 11; + break; + case 2: + f->bitbatchlen = 7; + break; + case 3: + f->bitbatchlen = 5; + break; + } +} + +/* --------------------------------------------------------------------- */ + +extern inline void init_inlv(struct fecstate *f) +{ + int i; + + for (i = 0; i < f->inlv * DataCarriers; i++) + f->inlvpipe[i] = 0; + f->inlvptr = 0; +} + +/* --------------------------------------------------------------------- */ + +extern unsigned deinlv(struct fecstate *, unsigned); +extern unsigned inlv(struct fecstate *, unsigned); + +extern unsigned fecencode(struct fecstate *, unsigned); +extern unsigned fecdecode(struct fecstate *, unsigned, unsigned *); + +/* --------------------------------------------------------------------- */ + +#endif diff --git a/newqpsk/fectable.h b/newqpsk/fectable.h new file mode 100644 index 0000000..7c7fea9 --- /dev/null +++ b/newqpsk/fectable.h @@ -0,0 +1,100 @@ +#ifndef _FECTABLE_H +#define _FECTABLE_H + +/* + * FEC and interleave related tables. + */ + +int InterleavePattern[] = +{ +#if 1 /* scrambled interleave */ + 1, /* 000000000000001 */ + 16, /* 000000000010000 */ + 256, /* 000000100000000 */ + 4096, /* 001000000000000 */ + 2, /* 000000000000010 */ + 32, /* 000000000100000 */ + 512, /* 000001000000000 */ + 8192, /* 010000000000000 */ + 4, /* 000000000000100 */ + 64, /* 000000001000000 */ + 1024, /* 000010000000000 */ + 16384, /* 100000000000000 */ + 8, /* 000000000001000 */ + 128, /* 000000010000000 */ + 2048 /* 000100000000000 */ +#else /* linear interleave */ + 1, /* 000000000000001 */ + 2, /* 000000000000010 */ + 4, /* 000000000000100 */ + 8, /* 000000000001000 */ + 16, /* 000000000010000 */ + 32, /* 000000000100000 */ + 64, /* 000000001000000 */ + 128, /* 000000010000000 */ + 256, /* 000000100000000 */ + 512, /* 000001000000000 */ + 1024, /* 000010000000000 */ + 2048, /* 000100000000000 */ + 4096, /* 001000000000000 */ + 8192, /* 010000000000000 */ + 16384 /* 100000000000000 */ +#endif +}; + +unsigned int WalshTable[] = +{ + 0x0000, 0x007F, 0x0787, 0x07F8, 0x1999, 0x19E6, 0x1E1E, 0x1E61, + 0x2AAA, 0x2AD5, 0x2D2D, 0x2D52, 0x3333, 0x334C, 0x34B4, 0x34CB, + 0x4B34, 0x4B4B, 0x4CB3, 0x4CCC, 0x52AD, 0x52D2, 0x552A, 0x5555, + 0x619E, 0x61E1, 0x6619, 0x6666, 0x7807, 0x7878, 0x7F80, 0x7FFF +}; + +unsigned int WHTable[] = +{ + 0x3FFFFFFF, 0x15555555, 0x26666666, 0x0CCCCCCC, + 0x38787878, 0x12D2D2D2, 0x21E1E1E1, 0x0B4B4B4B, + 0x3F807F80, 0x152AD52A, 0x2619E619, 0x0CB34CB3, + 0x3807F807, 0x12AD52AD, 0x219E619E, 0x0B34CB34, + 0x3FFF8000, 0x15552AAA, 0x26661999, 0x0CCCB333, + 0x38780787, 0x12D2AD2D, 0x21E19E1E, 0x0B4B34B4, + 0x3F80007F, 0x152AAAD5, 0x261999E6, 0x0CB3334C, + 0x380787F8, 0x12AD2D52, 0x219E1E61, 0x0B34B4CB +}; + +int FEC1511EncodeTable[] = +{ + 0x1800, /* 001100000000000 */ + 0x2800, /* 010100000000000 */ + 0x3000, /* 011000000000000 */ + 0x3800, /* 011100000000000 */ + 0x4800, /* 100100000000000 */ + 0x5000, /* 101000000000000 */ + 0x5800, /* 101100000000000 */ + 0x6000, /* 110000000000000 */ + 0x6800, /* 110100000000000 */ + 0x7000, /* 111000000000000 */ + 0x7800 /* 111100000000000 */ +}; + +int FEC1511DecodeTable[] = +{ + 0x0000, /* 000000000000000 */ + 0x0800, /* 000100000000000 */ + 0x1000, /* 001000000000000 */ + 0x0001, /* 000000000000001 */ + 0x2000, /* 010000000000000 */ + 0x0002, /* 000000000000010 */ + 0x0004, /* 000000000000100 */ + 0x0008, /* 000000000001000 */ + 0x4000, /* 100000000000000 */ + 0x0010, /* 000000000010000 */ + 0x0020, /* 000000000100000 */ + 0x0040, /* 000000001000000 */ + 0x0080, /* 000000010000000 */ + 0x0100, /* 000000100000000 */ + 0x0200, /* 000001000000000 */ + 0x0400 /* 000010000000000 */ +}; + +#endif diff --git a/newqpsk/filter-i386.h b/newqpsk/filter-i386.h new file mode 100644 index 0000000..01b3f5d --- /dev/null +++ b/newqpsk/filter-i386.h @@ -0,0 +1,264 @@ +#ifndef _FILTER_I386_H +#define _FILTER_I386_H +#define __HAVE_ARCH_MAC +extern inline float mac(const float *a, const float *b, unsigned int size) +{ + float f; + asm volatile ( + "flds (%1);\n\t" + "fmuls (%2);\n\t" + "flds 4(%1);\n\t" + "fmuls 4(%2);\n\t" + "flds 8(%1);\n\t" + "fmuls 8(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 12(%1);\n\t" + "fmuls 12(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 16(%1);\n\t" + "fmuls 16(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 20(%1);\n\t" + "fmuls 20(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 24(%1);\n\t" + "fmuls 24(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 28(%1);\n\t" + "fmuls 28(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 32(%1);\n\t" + "fmuls 32(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 36(%1);\n\t" + "fmuls 36(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 40(%1);\n\t" + "fmuls 40(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 44(%1);\n\t" + "fmuls 44(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 48(%1);\n\t" + "fmuls 48(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 52(%1);\n\t" + "fmuls 52(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 56(%1);\n\t" + "fmuls 56(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 60(%1);\n\t" + "fmuls 60(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 64(%1);\n\t" + "fmuls 64(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 68(%1);\n\t" + "fmuls 68(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 72(%1);\n\t" + "fmuls 72(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 76(%1);\n\t" + "fmuls 76(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 80(%1);\n\t" + "fmuls 80(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 84(%1);\n\t" + "fmuls 84(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 88(%1);\n\t" + "fmuls 88(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 92(%1);\n\t" + "fmuls 92(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 96(%1);\n\t" + "fmuls 96(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 100(%1);\n\t" + "fmuls 100(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 104(%1);\n\t" + "fmuls 104(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 108(%1);\n\t" + "fmuls 108(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 112(%1);\n\t" + "fmuls 112(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 116(%1);\n\t" + "fmuls 116(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 120(%1);\n\t" + "fmuls 120(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 124(%1);\n\t" + "fmuls 124(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 128(%1);\n\t" + "fmuls 128(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 132(%1);\n\t" + "fmuls 132(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 136(%1);\n\t" + "fmuls 136(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 140(%1);\n\t" + "fmuls 140(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 144(%1);\n\t" + "fmuls 144(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 148(%1);\n\t" + "fmuls 148(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 152(%1);\n\t" + "fmuls 152(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 156(%1);\n\t" + "fmuls 156(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 160(%1);\n\t" + "fmuls 160(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 164(%1);\n\t" + "fmuls 164(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 168(%1);\n\t" + "fmuls 168(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 172(%1);\n\t" + "fmuls 172(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 176(%1);\n\t" + "fmuls 176(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 180(%1);\n\t" + "fmuls 180(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 184(%1);\n\t" + "fmuls 184(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 188(%1);\n\t" + "fmuls 188(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 192(%1);\n\t" + "fmuls 192(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 196(%1);\n\t" + "fmuls 196(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 200(%1);\n\t" + "fmuls 200(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 204(%1);\n\t" + "fmuls 204(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 208(%1);\n\t" + "fmuls 208(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 212(%1);\n\t" + "fmuls 212(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 216(%1);\n\t" + "fmuls 216(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 220(%1);\n\t" + "fmuls 220(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 224(%1);\n\t" + "fmuls 224(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 228(%1);\n\t" + "fmuls 228(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 232(%1);\n\t" + "fmuls 232(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 236(%1);\n\t" + "fmuls 236(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 240(%1);\n\t" + "fmuls 240(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 244(%1);\n\t" + "fmuls 244(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 248(%1);\n\t" + "fmuls 248(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "flds 252(%1);\n\t" + "fmuls 252(%2);\n\t" + "fxch %%st(2);\n\t" + "faddp;\n\t" + "faddp;\n\t" + : "=t" (f) : "r" (a) , "r" (b) : "memory"); + return f; +} +#endif diff --git a/newqpsk/filter.c b/newqpsk/filter.c new file mode 100644 index 0000000..4ae10f0 --- /dev/null +++ b/newqpsk/filter.c @@ -0,0 +1,119 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "modem.h" +#include "modemconfig.h" +#include "filter.h" + +#include +#include + +#define FilterLen (AliasFilterLen * NumFilters) + +/* + * Sinc done properly. + */ +static inline double sinc(double x) +{ + return (fabs(x) < 1e-10) ? 1.0 : (sin(x) / x); +} + +/* + * Don't ask... + */ +static inline double cosc(double x) +{ + return (fabs(x) < 1e-10) ? 0.0 : (1 - cos(x)) / x; +} + +/* + * Hamming window function. + */ +static inline double hamming(double x) +{ + return 0.54 - 0.46 * cos(2 * M_PI * x); +} + +void init_filter(struct filter *f, float rate, float f1, float f2) +{ + float t, h, x, sum, max; + int i, j; + + f1 /= NumFilters; + f2 /= NumFilters; + + f->phase = 0.0; + f->phaseinc = 1.0 / rate; + + for (i = 0; i < FilterLen; i++) { + t = i - (FilterLen - 1.0) / 2.0; + h = i * (1.0 / (FilterLen - 1.0)); + + x = (2 * f2 * sinc(2 * M_PI * f2 * t) - + 2 * f1 * sinc(2 * M_PI * f1 * t)) * hamming(h); + f->filtI[i % NumFilters][i / NumFilters] = x; + + x = (2 * f2 * cosc(2 * M_PI * f2 * t) - + 2 * f1 * cosc(2 * M_PI * f1 * t)) * hamming(h); + f->filtQ[i % NumFilters][i / NumFilters] = -x; + } + + max = 0.0; + for (i = 0; i < NumFilters; i++) { + sum = 0.0; + for (j = 0; j < AliasFilterLen; j++) + sum += fabs(f->filtI[i][j]); + + max = (sum > max) ? sum : max; + + sum = 0.0; + for (j = 0; j < AliasFilterLen; j++) + sum += fabs(f->filtQ[i][j]); + + max = (sum > max) ? sum : max; + } + + for (i = 0; i < NumFilters; i++) { + for (j = 0; j < AliasFilterLen; j++) { + f->filtI[i][j] /= max; + f->filtQ[i][j] /= max; + } + } +} + +int filter(struct filter *f, complex *in, complex *out) +{ + float *iptr = f->bufI; + float *qptr = f->bufQ; + int i, o, idx; + + memmove(iptr, iptr + SymbolLen, AliasFilterLen * sizeof(float)); + memmove(qptr, qptr + SymbolLen, AliasFilterLen * sizeof(float)); + + iptr += AliasFilterLen; + qptr += AliasFilterLen; + for (i = 0; i < SymbolLen; i++) { + *iptr++ = in[i].re; + *qptr++ = in[i].im; + } + + i = 0; + o = 0; + iptr = f->bufI; + qptr = f->bufQ; + while (i < SymbolLen) { + if (f->phase >= 1.0) { + f->phase -= 1.0; + i++; + } else { + idx = NumFilters - 1 - (int) (f->phase * NumFilters); + out[o].re = mac(iptr + i, f->filtI[idx], AliasFilterLen); + out[o].im = mac(qptr + i, f->filtQ[idx], AliasFilterLen); + f->phase += f->phaseinc; + o++; + } + } + return o; +} + diff --git a/newqpsk/filter.h b/newqpsk/filter.h new file mode 100644 index 0000000..ae789fc --- /dev/null +++ b/newqpsk/filter.h @@ -0,0 +1,41 @@ +#ifndef _FILTER_H +#define _FILTER_H + +#include "complex.h" + +/* ---------------------------------------------------------------------- */ + +#ifdef __i386__ +#include "filter-i386.h" +#endif /* __i386__ */ + +/* ---------------------------------------------------------------------- */ + +#ifndef __HAVE_ARCH_MAC +extern inline float mac(const float *a, const float *b, unsigned int size) +{ + float sum = 0; + unsigned int i; + + for (i = 0; i < size; i++) + sum += (*a++) * (*b++); + return sum; +} +#endif /* __HAVE_ARCH_MAC */ + +/* ---------------------------------------------------------------------- */ + +struct filter { + float filtI[NumFilters][AliasFilterLen]; + float filtQ[NumFilters][AliasFilterLen]; + float bufI[AliasFilterLen + SymbolLen]; + float bufQ[AliasFilterLen + SymbolLen]; + float phase; + float phaseinc; +}; + +extern void init_filter(struct filter *, float, float, float); +extern int filter(struct filter *, complex *, complex *); + +/* ---------------------------------------------------------------------- */ +#endif /* _FILTER_H */ diff --git a/newqpsk/genfilt.c b/newqpsk/genfilt.c new file mode 100644 index 0000000..a2eb077 --- /dev/null +++ b/newqpsk/genfilt.c @@ -0,0 +1,47 @@ +/* + * Generate an inline assembler FIR filter optimized for the Pentium. + * This is inspired by the works of Phil Karn and Thomas Sailer. + */ + +#include + +#include "modemconfig.h" + +#define asmline(s) puts("\t\t\"" s ";\\n\\t\"") +#define asmline2(s1,d,s2) printf("\t\t\"%s%d%s;\\n\\t\"\n", s1, d, s2) + +int main(int argc, char **argv) +{ + int i; + + puts("#ifndef _FILTER_I386_H"); + puts("#define _FILTER_I386_H"); + puts("#define __HAVE_ARCH_MAC"); + + puts("extern inline float mac(const float *a, const float *b, unsigned int size)"); + puts("{"); + puts("\tfloat f;"); + puts("\tasm volatile ("); + + asmline("flds (%1)"); + asmline("fmuls (%2)"); + asmline("flds 4(%1)"); + asmline("fmuls 4(%2)"); + + for (i = 2; i < AliasFilterLen; i++) { + asmline2("flds ", i * 4, "(%1)"); + asmline2("fmuls ", i * 4, "(%2)"); + asmline("fxch %%st(2)"); + asmline("faddp"); + } + + asmline("faddp"); + + puts("\t\t: \"=t\" (f) : \"r\" (a) , \"r\" (b) : \"memory\");"); + puts("\treturn f;"); + puts("}"); + + puts("#endif"); + + return 0; +} diff --git a/newqpsk/misc.h b/newqpsk/misc.h new file mode 100644 index 0000000..aa3dfc5 --- /dev/null +++ b/newqpsk/misc.h @@ -0,0 +1,107 @@ +#ifndef _MISC_H +#define _MISC_H + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +/* ---------------------------------------------------------------------- */ + +/* + * Hamming weight (number of bits that are ones). + */ +extern inline unsigned int hweight32(unsigned int w) +{ + w = (w & 0x55555555) + ((w >> 1) & 0x55555555); + w = (w & 0x33333333) + ((w >> 2) & 0x33333333); + w = (w & 0x0F0F0F0F) + ((w >> 4) & 0x0F0F0F0F); + w = (w & 0x00FF00FF) + ((w >> 8) & 0x00FF00FF); + w = (w & 0x0000FFFF) + ((w >> 16) & 0x0000FFFF); + return w; +} + +extern inline unsigned int hweight16(unsigned short w) +{ + w = (w & 0x5555) + ((w >> 1) & 0x5555); + w = (w & 0x3333) + ((w >> 2) & 0x3333); + w = (w & 0x0F0F) + ((w >> 4) & 0x0F0F); + w = (w & 0x00FF) + ((w >> 8) & 0x00FF); + return w; +} + +extern inline unsigned int hweight8(unsigned char w) +{ + w = (w & 0x55) + ((w >> 1) & 0x55); + w = (w & 0x33) + ((w >> 2) & 0x33); + w = (w & 0x0F) + ((w >> 4) & 0x0F); + return w; +} + +/* ---------------------------------------------------------------------- */ + +/* + * Reverse order of bits. + */ +extern inline unsigned int rbits32(unsigned int w) +{ + w = ((w >> 1) & 0x55555555) | ((w << 1) & 0xaaaaaaaa); + w = ((w >> 2) & 0x33333333) | ((w << 2) & 0xcccccccc); + w = ((w >> 4) & 0x0f0f0f0f) | ((w << 4) & 0xf0f0f0f0); + w = ((w >> 8) & 0x00ff00ff) | ((w << 8) & 0xff00ff00); + w = ((w >> 16) & 0x0000ffff) | ((w << 16) & 0xffff0000); + return w; +} + +extern inline unsigned short rbits16(unsigned short w) +{ + w = ((w >> 1) & 0x5555) | ((w << 1) & 0xaaaa); + w = ((w >> 2) & 0x3333) | ((w << 2) & 0xcccc); + w = ((w >> 4) & 0x0f0f) | ((w << 4) & 0xf0f0); + w = ((w >> 8) & 0x00ff) | ((w << 8) & 0xff00); + return w; +} + +extern inline unsigned char rbits8(unsigned char w) +{ + w = ((w >> 1) & 0x55) | ((w << 1) & 0xaa); + w = ((w >> 2) & 0x33) | ((w << 2) & 0xcc); + w = ((w >> 4) & 0x0f) | ((w << 4) & 0xf0); + return w; +} + +/* ---------------------------------------------------------------------- */ + +extern inline float avg(float average, float input, int scale) +{ + int i; + + input -= average; + for (i = 0; i < scale; i++) + input /= 2; + + return (average + input); +} + +extern inline float avg2(float average, float input, float weight) +{ + return input * weight + average * (1.0 - weight); +} + +extern inline float phaseavg(float *data, int len) +{ + float sum = 0.0; + float min = M_PI; + float max = -M_PI; + int i; + + for (i = 0; i < len; i++) { + sum += data[i]; + min = min < data[i] ? min : data[i]; + max = max > data[i] ? max : data[i]; + } + return (sum - min - max) / (len - 2); +} + +/* ---------------------------------------------------------------------- */ + +#endif /* _MISC_H */ diff --git a/newqpsk/modemconfig.h b/newqpsk/modemconfig.h new file mode 100644 index 0000000..7d48854 --- /dev/null +++ b/newqpsk/modemconfig.h @@ -0,0 +1,52 @@ +#ifndef _MODEMCONFIG_H +#define _MODEMCONFIG_H + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +#define CarrierAmpl (1.0/8.0) + +#define WindowLenLog 6 +#define WindowLen (1< +#include + +/* --------------------------------------------------------------------- */ + +static const struct modemparams modparams[] = { + { "bps", "Bits/s", "Bits per second", "2500", MODEMPAR_NUMERIC, { n: { 1000, 5000, 100, 500 } } }, + { "inlv", "Interleave", "Interleave depth", "8", MODEMPAR_NUMERIC, { n: { 0, 16, 1, 4 } } }, + { "fec", "FEC", "FEC level", "3", MODEMPAR_NUMERIC, { n: { 0, 3, 1, 1 } } }, + { "tunelen", "Tune length", "Tune preamble length", "32", MODEMPAR_NUMERIC, { n: { 0, 64, 1, 1 } } }, + { "synclen", "Sync length", "Sync preamble length", "32", MODEMPAR_NUMERIC, { n: { 16, 64, 1, 1 } } }, + { NULL } +}; + +#define SAMPLERATE(x) ((float)(x)*SymbolLen/DataCarriers/SymbolBits) + +static void *modconfig(struct modemchannel *chan, unsigned int *samplerate, const char *params[]) +{ + struct txstate *s = calloc(1, sizeof(struct txstate)); + + if ((s = calloc(1, sizeof(struct txstate))) == NULL) + logprintf(MLOG_FATAL, "out of memory\n"); + s->chan = chan; + s->saved = -1; + if (params[0]) { + s->bps = strtoul(params[0], NULL, 0); + if (s->bps < 1000) + s->bps = 1000; + if (s->bps > 5000) + s->bps = 5000; + } else + s->bps = 2500; + if (params[1]) { + s->fec.inlv = strtoul(params[1], NULL, 0); + if (s->fec.inlv < 0) + s->fec.inlv = 0; + if (s->fec.inlv > 16) + s->fec.inlv = 16; + } else + s->fec.inlv = 8; + if (params[2]) { + s->fec.feclevel = strtoul(params[2], NULL, 0); + if (s->fec.feclevel < 0) + s->fec.feclevel = 0; + if (s->fec.feclevel > 3) + s->fec.feclevel = 3; + } else + s->fec.feclevel = 3; + if (params[3]) { + s->tunelen = strtoul(params[3], NULL, 0); + if (s->tunelen < 0) + s->tunelen = 0; + if (s->tunelen > 64) + s->tunelen = 64; + } else + s->tunelen = 32; + if (params[4]) { + s->synclen = strtoul(params[4], NULL, 0); + if (s->synclen < 16) + s->synclen = 16; + if (s->synclen > 64) + s->synclen = 64; + } else + s->synclen = 32; + *samplerate = (int) (3.0 * SAMPLERATE(s->bps) + 0.5); + return s; +} + +static void modinit(void *state, unsigned int samplerate) +{ + struct txstate *s = (struct txstate *)state; + float rate, f1, f2; + + rate = samplerate / SAMPLERATE(s->bps); + s->bufsize = rate * SymbolLen + 16; + f1 = 0.1; + f2 = 0.9; + init_tbl(); + init_filter(&s->filt, rate, f1, f2); + init_fec(&s->fec); + init_newqpsktx(state); +} + +static void modmodulate(void *state, unsigned int txdelay) +{ + struct txstate *s = (struct txstate *)state; + int16_t *samples; + complex *cbuf; + unsigned char buf; + int n, i; + + /* check if there is data to be transmitted... */ + if (!pktget(s->chan, &buf, 1)) + return; + + /* ...and save it */ + s->saved = buf; + + samples = alloca(s->bufsize * sizeof(int16_t)); + cbuf = alloca(s->bufsize * sizeof(complex)); + + s->txdone = 0; + while (!s->txdone) { + n = newqpsktx(state, cbuf); + for (i = 0; i < n; i++) + samples[i] = (cbuf[i].re + cbuf[i].im) * 32768.0; + audiowrite(s->chan, samples, n); + } +} + +/* --------------------------------------------------------------------- */ + +struct modulator newqpskmodulator = { + NULL, + "newqpsk", + modparams, + modconfig, + modinit, + modmodulate, + free +}; + +/* --------------------------------------------------------------------- */ diff --git a/newqpsk/newqpskrx.c b/newqpsk/newqpskrx.c new file mode 100644 index 0000000..1b2f816 --- /dev/null +++ b/newqpsk/newqpskrx.c @@ -0,0 +1,565 @@ +#include +#include +#include +#include +#include + +#include "modem.h" + +#include "complex.h" +#include "modemconfig.h" +#include "fec.h" +#include "filter.h" +#include "newqpskrx.h" +#include "tbl.h" +#include "misc.h" + +/* --------------------------------------------------------------------- */ + +static void rxidle(void *); +static void rxtune(void *); +static void rxdata(void *); + +/* --------------------------------------------------------------------- */ + +void init_newqpskrx(void *state) +{ + struct rxstate *s = (struct rxstate *)state; + int i; + + /* clear dcd */ + pktsetdcd(s->chan, 0); + if (s->mintune != 0) { + /* switch to idle mode */ + s->rxroutine = rxidle; + s->rxwindowfunc = ToneWindowInp; + s->carrfreq = 0.0; + s->acceptance = 0; + for (i = 0; i < TuneCarriers; i++) { + s->tunepower[i] = 0.0; + s->tunephase[i] = 0.0; + s->tunecorr[i].re = 0.0; + s->tunecorr[i].im = 0.0; + } + } else { + /* switch to tune mode */ + s->rxroutine = rxtune; + s->rxwindowfunc = DataWindowInp; + s->atsymbol = 1; + s->acceptance = 0; + for (i = 0; i < TuneCarriers; i++) { + s->power_at[i] = s->tunepower[i]; + s->corr1_at[i].re = s->tunepower[i]; + s->corr1_at[i].im = 0.0; + s->corr2_at[i].re = s->tunepower[i]; + s->corr2_at[i].im = 0.0; + + s->power_inter[i] = s->tunepower[i]; + s->corr1_inter[i].re = s->tunepower[i]; + s->corr1_inter[i].im = 0.0; + s->corr2_inter[i].re = s->tunepower[i]; + s->corr2_inter[i].im = 0.0; + } + } +} + +/* --------------------------------------------------------------------- */ + +static void putbitbatch(void *state, unsigned data) +{ + struct rxstate *s = (struct rxstate *)state; + unsigned int i, bit; + unsigned char buf; + + for (i = 0; i < s->fec.bitbatchlen; i++) { + bit = (data & (1 << i)) ? 1 : 0; + s->shreg |= bit << 9; + if (s->shreg & 1) { + buf = (s->shreg >> 1) & 0xff; + pktput(s->chan, &buf, 1); + s->shreg &= ~0xff; + s->shreg |= 0x100; + } + s->shreg >>= 1; + } +} + +/* --------------------------------------------------------------------- */ + +static void fft(complex *in, complex *out, float *window) +{ + int i, j, k; + int s, sep, width, top, bot; + float tr, ti; + + /* order the samples in bit reverse order and apply window */ + for (i = 0; i < WindowLen; i++) { + j = rbits8(i) >> (8 - WindowLenLog); + out[j].re = in[i].re * window[i]; + out[j].im = in[i].im * window[i]; + } + + /* in-place FFT */ + sep = 1; + for (s = 1; s <= WindowLenLog; s++) { + width = sep; /* butterfly width = 2^(s-1) */ + sep <<= 1; /* butterfly separation = 2^s */ + for (j = 0; j < width; j++) { + k = WindowLen * j / sep; + for (top = j; top < WindowLen; top += sep) { + bot = top + width; + tr = out[bot].re * CosTable[k] + out[bot].im * SinTable[k]; + ti = out[bot].im * CosTable[k] - out[bot].re * SinTable[k]; + out[bot].re = out[top].re - tr; + out[bot].im = out[top].im - ti; + out[top].re = out[top].re + tr; + out[top].im = out[top].im + ti; + } + } + } +} + +static void mixer(struct rxstate *s, complex *buf) +{ + complex z; + int i; + + for (i = 0; i < HalfSymbol; i++) { + s->carrphase += s->carrfreq; + + if (s->carrphase > M_PI) + s->carrphase -= 2 * M_PI; + if (s->carrphase < -M_PI) + s->carrphase += 2 * M_PI; + + z.re = cos(s->carrphase); + z.im = sin(s->carrphase); + + buf[i] = cmul(buf[i], z); + } +} + +/* --------------------------------------------------------------------- */ + +void newqpskrx(void *state, complex *in) +{ + struct rxstate *s = (struct rxstate *)state; + complex z; + int i, j; + + /* make room for new samples at the end of RX window */ + memmove(s->rxwin, s->rxwin + HalfSymbol, (WindowLen - HalfSymbol) * sizeof(complex)); + + /* copy the new samples */ + memcpy(s->rxwin + WindowLen - HalfSymbol, in, HalfSymbol * sizeof(complex)); + + /* mix the new samples with the internal NCO */ + mixer(s, s->rxwin + WindowLen - HalfSymbol); + + /* apply window function and fft */ + fft(s->rxwin, s->fftbuf, s->rxwindowfunc); + + /* select the wanted FFT bins and adjust the phases */ + s->rxphasecorr = (s->rxphasecorr + HalfSymbol) % WindowLen; + j = FirstDataCarr; + for (i = 0; i < DataCarriers; i++) { + z.re = CosTable[(j * s->rxphasecorr) % WindowLen]; + z.im = -SinTable[(j * s->rxphasecorr) % WindowLen]; + s->rxpipe[s->rxptr][i] = cmul(s->fftbuf[j], z); + j += DataCarrSepar; + } + + /* process the data */ + s->rxroutine(state); + + s->rxptr = (s->rxptr + 1) % RxPipeLen; +} + +/* --------------------------------------------------------------------- */ + +static void rxidle(void *state) +{ + struct rxstate *s = (struct rxstate *)state; + float x; + complex z; + int i, j, cntr; + unsigned int prev, curr; + char buf[256]; + + curr = s->rxptr; + prev = (curr - 1) % RxPipeLen; + + j = (FirstTuneCarr - FirstDataCarr) / DataCarrSepar; + + cntr = 0; + for (i = 0; i < TuneCarriers; i++) { + x = cpwr(s->rxpipe[curr][j]); + s->tunepower[i] = avg(s->tunepower[i], x, RxAverFollow); + + z = ccor(s->rxpipe[curr][j], s->rxpipe[prev][j]); + s->tunecorr[i].re = avg(s->tunecorr[i].re, z.re, RxAverFollow); + s->tunecorr[i].im = avg(s->tunecorr[i].im, z.im, RxAverFollow); + + if (2 * cmod(s->tunecorr[i]) > s->tunepower[i]) + cntr++; + + j += TuneCarrSepar / DataCarrSepar; + } + + if (cntr >= TuneCarriers - 1) + s->acceptance++; + else if (s->acceptance > 0) + s->acceptance--; + + if (s->acceptance < 2 * s->mintune) + return; + +#ifdef RxAvoidPTT + // if (sm_getptt(state)) + // return; +#endif + + /* ok, we have a carrier */ + pktsetdcd(s->chan, 1); + + for (i = 0; i < TuneCarriers; i++) + s->tunephase[i] = carg(s->tunecorr[i]); + + x = phaseavg(s->tunephase, TuneCarriers); + s->carrfreq += x * 4.0 / WindowLen; + + buf[0] = 0; + for (i = 0; i < TuneCarriers; i++) { + x = s->tunepower[i] / (s->tunepower[i] - cmod(s->tunecorr[i])); + sprintf(buf + strlen(buf), "%+.1fHz/%.1fdB ", + s->tunephase[i] * 4.0 / WindowLen / + (2.0 * M_PI / s->srate), + 10 * log10(x)); + } + logprintf(MLOG_INFO, "Tune tones: %s\n", buf); + + /* switch to tune mode */ + s->rxroutine = rxtune; + s->rxwindowfunc = DataWindowInp; + s->atsymbol = 1; + s->acceptance = 0; + s->statecntr = 2 * RxTuneTimeout; + for (i = 0; i < TuneCarriers; i++) { + s->power_at[i] = s->tunepower[i]; + s->corr1_at[i].re = s->tunepower[i]; + s->corr1_at[i].im = 0.0; + s->corr2_at[i].re = s->tunepower[i]; + s->corr2_at[i].im = 0.0; + + s->power_inter[i] = s->tunepower[i]; + s->corr1_inter[i].re = s->tunepower[i]; + s->corr1_inter[i].im = 0.0; + s->corr2_inter[i].re = s->tunepower[i]; + s->corr2_inter[i].im = 0.0; + } +} + +/* --------------------------------------------------------------------- */ + +static void rxtune(void *state) +{ + struct rxstate *s = (struct rxstate *)state; + int i, j, cntr; + unsigned int prev2, prev1, curr; + complex *cor1, *cor2, z; + float *pwr, x; + + /* timeout only if mintune not zero */ + if (s->mintune && s->statecntr-- <= 0) { + /* timeout waiting sync - go back to idling */ + init_newqpskrx(state); + return; + } + curr = s->rxptr; + prev1 = (curr - 1) % RxPipeLen; + prev2 = (curr - 2) % RxPipeLen; + + s->atsymbol ^= 1; + + if (s->atsymbol) { + pwr = s->power_at; + cor1 = s->corr1_at; + cor2 = s->corr2_at; + } else { + pwr = s->power_inter; + cor1 = s->corr1_inter; + cor2 = s->corr2_inter; + } + + j = (FirstTuneCarr - FirstDataCarr) / DataCarrSepar; + for (i = 0; i < TuneCarriers; i++) { + x = cpwr(s->rxpipe[curr][j]); + pwr[i] = avg(pwr[i], x, RxAverFollow - 1); + + z = ccor(s->rxpipe[curr][j], s->rxpipe[prev1][j]); + cor1[i].re = avg(cor1[i].re, z.re, RxAverFollow - 1); + cor1[i].im = avg(cor1[i].im, z.im, RxAverFollow - 1); + + z = ccor(s->rxpipe[curr][j], s->rxpipe[prev2][j]); + cor2[i].re = avg(cor2[i].re, z.re, RxAverFollow - 1); + cor2[i].im = avg(cor2[i].im, z.im, RxAverFollow - 1); + + j += TuneCarrSepar / DataCarrSepar; + } + + if (!s->atsymbol) + return; + + cntr = 0; + for (i = 0; i < TuneCarriers; i++) { + if (s->power_at[i] > s->power_inter[i]) { + x = s->power_at[i]; + z = s->corr2_at[i]; + } else { + x = s->power_inter[i]; + z = s->corr2_inter[i]; + } + + if (-z.re > x / 2) + cntr++; + } + + if (cntr >= TuneCarriers - 1) + s->acceptance++; + else if (s->acceptance > 0) + s->acceptance--; + + if (s->acceptance < s->minsync) + return; + + /* again, we have a carrier */ + pktsetdcd(s->chan, 1); + + cntr = 0; + for (i = 0; i < TuneCarriers; i++) { + if (s->corr2_at[i].re < s->corr2_inter[i].re) + cntr++; + else + cntr--; + } + + if (cntr < 0) { + s->atsymbol = 0; + pwr = s->power_inter; + cor1 = s->corr1_inter; + cor2 = s->corr2_inter; + } + + for (i = 0; i < TuneCarriers; i++) { + z.re = -cor2[i].re; + z.im = cor1[i].re - (pwr[i] + cor2[i].re) / 2; + + s->syncdelay[i] = carg(z); + + z.re = -cor2[i].re; + z.im = cor2[i].im; + s->syncphase[i] = carg(z); + } + + x = phaseavg(s->syncdelay, TuneCarriers) / M_PI; + s->skip = (0.5 - x) * SymbolLen; + + logprintf(MLOG_INFO, "Sync: %d (%s-symbol)\n", s->skip, s->atsymbol ? "at" : "inter"); + + x = phaseavg(s->syncphase, TuneCarriers); + s->carrfreq -= x * 2.0 / WindowLen; + logprintf(MLOG_INFO, "Preamble at: %+.2fHz\n", + s->carrfreq / (2.0 * M_PI / s->srate)); + + /* switch to data mode */ + s->rxroutine = rxdata; + s->atsymbol ^= 1; + s->acceptance = DCDMaxDrop / 2; + s->updhold = RxUpdateHold; + s->bitbatches = 0; + /* init deinterleaver */ + init_inlv(&s->fec); + for (i = 0; i < DataCarriers; i++) { + s->phesum[i] = 0.0; + s->pheavg[i] = 0.0; + s->dcdavg[i] = 0.0; + s->power[i] = 0.0; + s->correl[i] = 0.0; + s->fecerrors[i] = 0; + } + + s->phemax = 0.0; +} + +/* --------------------------------------------------------------------- */ + +static void rxdata(void *state) +{ + struct rxstate *s = (struct rxstate *)state; + int rxword[SymbolBits], errword[SymbolBits]; + int i, j, bits, data, dcd, errs, cor1, cor2; + unsigned int prev2, prev1, curr; + float pherr[DataCarriers]; + complex z; + float x; + char buf[256]; + + /* nothing to do if inter-symbol */ + if ((s->atsymbol ^= 1) == 0) + return; + + curr = s->rxptr; + prev1 = (curr - 1) % RxPipeLen; + prev2 = (curr - 2) % RxPipeLen; + + for (i = 0; i < SymbolBits; i++) { + rxword[i] = 0; + errword[i] = 0; + } + + /* + * Delay the dcd/pherror/power/sync updates for the first + * `RxUpdateHold´ symbols because tune phase hasn't + * necessarily ended yet. + */ + if (s->updhold) + s->updhold--; + + for (i = 0; i < DataCarriers; i++) { + /* get the angle and add bias */ + z = ccor(s->rxpipe[curr][i], s->rxpipe[prev2][i]); + x = carg(z) + M_PI / PhaseLevels; + + if (x < 0) + x += 2 * M_PI; + + /* work out the bits */ + bits = (int) (x * PhaseLevels / (2 * M_PI)); + bits &= (1 << SymbolBits) - 1; + + /* calculate phase error (`0.5´ compensates the bias) */ + pherr[i] = x - (bits + 0.5) * 2 * M_PI / PhaseLevels; + + /* flip the top bit back */ + bits ^= 1 << (SymbolBits - 1); + + /* gray decode */ + data = 0; + for (j = 0; j < SymbolBits; j++) + data ^= bits >> j; + + /* put the bits to rxword (top carrier first) */ + for (j = 0; j < SymbolBits; j++) + if (data & (1 << (SymbolBits - 1 - j))) + rxword[j] |= 1 << i; + + /* skip the rest if still holding updates */ + if (s->updhold) + continue; + + /* update phase error power average */ + s->dcdavg[i] = avg2(s->dcdavg[i], pherr[i] * pherr[i], DCDTuneAverWeight); + + /* update phase error average */ + s->pheavg[i] = avg2(s->pheavg[i], pherr[i], DCDTuneAverWeight); + + /* update carrier power average */ + x = cpwr(s->rxpipe[curr][i]); + s->power[i] = avg(s->power[i], x, RxDataSyncFollow); + + /* update sync correlation average */ + x = ccorI(s->rxpipe[prev1][i], s->rxpipe[curr][i]) - + ccorI(s->rxpipe[prev1][i], s->rxpipe[prev2][i]); + s->correl[i] = avg(s->correl[i], x, RxDataSyncFollow); + } + + /* feed the data to the decoder */ + for (i = 0; i < SymbolBits; i++) { + rxword[i] = deinlv(&s->fec, rxword[i]); + rxword[i] = fecdecode(&s->fec, rxword[i], &errword[i]); + putbitbatch(state, rxword[i]); + } + + /* count carriers that have small enough phase error */ + for (dcd = 0, i = 0; i < DataCarriers; i++) + if (s->dcdavg[i] < DCDThreshold) + dcd++; + + /* decide if this was a "good" symbol */ + if (dcd >= DataCarriers / 2) { + /* count FEC errors */ + for (i = 0; i < SymbolBits; i++) { + for (j = 0; j < DataCarriers; j++) + if (errword[i] & (1 << j)) + s->fecerrors[j]++; + s->bitbatches++; + } +#if 0 + /* sync tracking */ + for (cor1 = cor2 = i = 0; i < DataCarriers; i++) { + if (s->power[i] < fabs(s->correl[i]) * RxSyncCorrThres) { + if (s->correl[i] >= 0) + cor1++; + else + cor2++; + } + } + + if (cor1 > DataCarriers * 2 / 3) + s->skip--; + else if (cor2 > DataCarriers * 2 / 3) + s->skip++; + + if (s->skip != 0) { + for (i = 0; i < DataCarriers; i++) + s->correl[i] /= 2.0; + logprintf(MLOG_INFO, "Correcting sync: %+d\n", s->skip); + } +#endif + /* sum up phase errors */ + for (i = 0; i < DataCarriers; i++) + s->phesum[i] += pherr[i] * pherr[i]; + + /* sum up maximum possible error */ + s->phemax += M_PI * M_PI / PhaseLevels / PhaseLevels; + + /* correct frequency error */ + x = phaseavg(pherr, DataCarriers); + s->carrfreq += RxFreqFollowWeight * x * 2.0 / WindowLen; + + /* increase acceptance */ + if (s->acceptance < DCDMaxDrop) + s->acceptance++; + } else { + /* drop acceptance */ + if (s->acceptance > 0) + s->acceptance--; + } + + if (s->acceptance > 0) + return; + + /* DCDMaxDrop subsequent "bad" symbols, it's gone... */ + logprintf(MLOG_INFO, "Carrier lost at: %+.2fHz\n", + s->carrfreq / (2.0 * M_PI / s->srate)); + errs = 0; + buf[0] = 0; + for (i = 0; i < DataCarriers; i++) { + errs += s->fecerrors[i]; + sprintf(buf + strlen(buf), "%02d ", s->fecerrors[i]); + } + logprintf(MLOG_INFO, "FEC errors: %s: %03d / %03d\n", buf, errs, s->bitbatches); + + buf[0] = 0; + for (i = 0; i < DataCarriers; i++) { + sprintf(buf + strlen(buf), "%2.0f ", 10 * log10(s->phemax * 2 / s->phesum[i])); + } + logprintf(MLOG_INFO, "S/N ratio: %s dB\n", buf); + + /* go back to idling */ + init_newqpskrx(state); + return; +} + +/* --------------------------------------------------------------------- */ + diff --git a/newqpsk/newqpskrx.h b/newqpsk/newqpskrx.h new file mode 100644 index 0000000..c7ee586 --- /dev/null +++ b/newqpsk/newqpskrx.h @@ -0,0 +1,79 @@ +#ifndef _NEWQPSKRX_H +#define _NEWQPSKRX_H + +/* --------------------------------------------------------------------- */ + +struct rxstate { + struct modemchannel *chan; + struct fecstate fec; + struct filter filt; + unsigned int bps; + unsigned int shreg; + unsigned int mintune; + unsigned int minsync; + void (*rxroutine) (void *); + float *rxwindowfunc; + unsigned int rxphase; + + complex rxbuf[256]; + unsigned bufptr; + unsigned buflen; + + int skip; + + complex rxpipe[RxPipeLen][DataCarriers]; + unsigned rxptr; + + float srate; /* internal samplerate */ + + float carrfreq; /* current rx carrier frequency */ + float carrphase; /* current rx NCO phase */ + + complex rxwin[WindowLen]; + complex fftbuf[WindowLen]; + int rxphasecorr; + + int acceptance; + int atsymbol; + int statecntr; + int updhold; + int bitbatches; + + /* tune mode power and correlations */ + float tunepower[TuneCarriers]; + float tunephase[TuneCarriers]; + complex tunecorr[TuneCarriers]; + + /* sync mode at-symbol power and correlations */ + float power_at[TuneCarriers]; + complex corr1_at[TuneCarriers]; + complex corr2_at[TuneCarriers]; + + /* sync mode inter-symbol power and correlations */ + float power_inter[TuneCarriers]; + complex corr1_inter[TuneCarriers]; + complex corr2_inter[TuneCarriers]; + + float syncphase[TuneCarriers]; + float syncdelay[TuneCarriers]; + + /* data mode */ + float phesum[DataCarriers]; /* Phase error sum */ + float pheavg[DataCarriers]; /* Phase error average */ + float dcdavg[DataCarriers]; /* Phase error power average */ + float power[DataCarriers]; /* Carrier power average */ + float correl[DataCarriers]; /* Sync correlation average */ + + float phemax; /* maximum phase error sum */ + + int fecerrors[DataCarriers]; /* FEC errors per carrier */ +}; + +/* --------------------------------------------------------------------- */ + +extern void init_newqpskrx(void *); +extern void newqpskrx(void *, complex *); + +/* --------------------------------------------------------------------- */ + +#endif diff --git a/newqpsk/newqpsktx.c b/newqpsk/newqpsktx.c new file mode 100644 index 0000000..1e5304a --- /dev/null +++ b/newqpsk/newqpsktx.c @@ -0,0 +1,382 @@ +#include +#include +#include +#include +#include + +#include "modem.h" + +#include "modemconfig.h" +#include "complex.h" +#include "fec.h" +#include "filter.h" +#include "newqpsktx.h" +#include "tbl.h" +#include "misc.h" + +/* --------------------------------------------------------------------- */ + +static void txtune(void *); +static void txsync(void *); +static void txpredata(void *); +static void txdata(void *); +static void txpostdata(void *); +static void txjam(void *); +static void txflush(void *); + +/* --------------------------------------------------------------------- */ + +void init_newqpsktx(void *state) +{ + struct txstate *s = (struct txstate *)state; + int i; + + /* switch to tune mode */ + s->txroutine = txtune; + s->statecntr = s->tunelen; + s->txwindowfunc = ToneWindowOut; + + /* copy initial tune vectors */ + for (i = 0; i < TuneCarriers; i++) { + s->tunevect[i].re = TuneIniVectI[i]; + s->tunevect[i].im = TuneIniVectQ[i]; + } +} + +/* --------------------------------------------------------------------- */ + +static int getbyte(void *state, unsigned char *buf) +{ + struct txstate *s = (struct txstate *)state; + + if (s->saved != -1) { + *buf = (unsigned char) s->saved; + s->saved = -1; + return 1; + } + return pktget(s->chan, buf, 1); +} + +static unsigned int getbitbatch(void *state) +{ + struct txstate *s = (struct txstate *)state; + unsigned int i, bit, data = 0; + unsigned char buf; + + for (i = 0; i < s->fec.bitbatchlen; i++) { + if (s->shreg <= 1) { + if (!getbyte(s, &buf)) + break; + s->shreg = buf; + s->shreg |= 0x100; + } + bit = s->shreg & 1; + s->shreg >>= 1; + data |= bit << i; + } + + if (i == s->fec.bitbatchlen) + s->empty = 0; + else + s->empty = 1; + + return data; +} + +/* --------------------------------------------------------------------- */ + +static void fft(complex * in, complex * out) +{ + int i, j, k; + int s, sep, width, top, bot; + float tr, ti; + + /* order the samples in bit reverse order */ + for (i = 0; i < WindowLen; i++) { + j = rbits8(i) >> (8 - WindowLenLog); + out[j] = in[i]; + } + + /* in-place FFT */ + sep = 1; + for (s = 1; s <= WindowLenLog; s++) { + width = sep; /* butterfly width = 2^(s-1) */ + sep <<= 1; /* butterfly separation = 2^s */ + + for (j = 0; j < width; j++) { + + k = WindowLen * j / sep; + + for (top = j; top < WindowLen; top += sep) { + bot = top + width; + + tr = out[bot].re * CosTable[k] + out[bot].im * SinTable[k]; + ti = out[bot].im * CosTable[k] - out[bot].re * SinTable[k]; + + out[bot].re = out[top].re - tr; + out[bot].im = out[top].im - ti; + + out[top].re = out[top].re + tr; + out[top].im = out[top].im + ti; + } + } + } +} + +/* --------------------------------------------------------------------- */ + +int newqpsktx(void *state, complex *samples) +{ + struct txstate *s = (struct txstate *)state; + complex tmp[WindowLen]; + int i; + + /* clear all FFT bins */ + for (i = 0; i < WindowLen; i++) { + s->fftbuf[i].re = 0.0; + s->fftbuf[i].im = 0.0; + } + + /* process the data */ + if (!s->tuneonly) + s->txroutine(state); + else + txtune(state); + + /* fft */ + fft(s->fftbuf, tmp); + + /* overlap and apply the window function */ + i = 0; + while (i < WindowLen - SymbolLen) { + s->txwin[i] = s->txwin[i + SymbolLen]; + s->txwin[i].re += tmp[i].re * s->txwindowfunc[i]; + s->txwin[i].im += tmp[i].im * s->txwindowfunc[i]; + i++; + } + while (i < WindowLen) { + s->txwin[i].re = tmp[i].re * s->txwindowfunc[i]; + s->txwin[i].im = tmp[i].im * s->txwindowfunc[i]; + i++; + } + + /* output filter and interpolation */ + i = filter(&s->filt, s->txwin, samples); + + return i; +} + +/* --------------------------------------------------------------------- */ + +/* + * Send tune carriers (four continuous carriers spaced at 600Hz). + */ +static void txtune(void *state) +{ + struct txstate *s = (struct txstate *)state; + int i, j; + + j = FirstTuneCarr; + for (i = 0; i < TuneCarriers; i++) { + /* flip odd carriers -> continuous phase */ + if (j % 2) { + s->fftbuf[j].re = -s->tunevect[i].re; + s->fftbuf[j].im = -s->tunevect[i].im; + } else { + s->fftbuf[j].re = s->tunevect[i].re; + s->fftbuf[j].im = s->tunevect[i].im; + } + s->tunevect[i] = s->fftbuf[j]; + j += TuneCarrSepar; + } + + if (!s->tuneonly && --s->statecntr <= 0) { + /* switch to sync mode */ + s->txroutine = txsync; + s->statecntr = s->synclen; + s->txwindowfunc = DataWindowOut; + } +} + +/* --------------------------------------------------------------------- */ + +/* + * Send sync sequence (tune carriers turned by 180 degrees every symbol). + */ +static void txsync(void *state) +{ + struct txstate *s = (struct txstate *)state; + int i, j; + + j = FirstTuneCarr; + for (i = 0; i < TuneCarriers; i++) { + /* flip even carriers -> inverted phase */ + if (j % 2) { + s->fftbuf[j].re = s->tunevect[i].re; + s->fftbuf[j].im = s->tunevect[i].im; + } else { + s->fftbuf[j].re = -s->tunevect[i].re; + s->fftbuf[j].im = -s->tunevect[i].im; + } + s->tunevect[i] = s->fftbuf[j]; + j += TuneCarrSepar; + } + + if (--s->statecntr <= 0) { + /* switch to pre data mode */ + s->txroutine = txpredata; + s->statecntr = TxPreData; + /* copy initial data vectors */ + for (i = 0; i < DataCarriers; i++) { + s->datavect[i].re = DataIniVectI[i]; + s->datavect[i].im = DataIniVectQ[i]; + } + /* initialise the interleaver */ + init_inlv(&s->fec); + } +} + +/* --------------------------------------------------------------------- */ + +static void encodeword(void *state, int jam) +{ + struct txstate *s = (struct txstate *)state; + unsigned i, j, k, data; + complex z; + float phi; + + /* run through interleaver only if not jamming */ + if (!jam) { + for (i = 0; i < SymbolBits; i++) + s->txword[i] = inlv(&s->fec, s->txword[i]); + } + + j = FirstDataCarr; + for (i = 0; i < DataCarriers; i++) { + /* collect databits for this symbol */ + data = 0; + for (k = 0; k < SymbolBits; k++) { + data <<= 1; + if (s->txword[k] & (1 << i)) + data |= 1; + } + + /* gray encode */ + data ^= data >> 1; + + /* flip the top bit */ + data ^= 1 << (SymbolBits - 1); + + /* modulate */ + phi = data * 2 * M_PI / PhaseLevels; + + /* if jamming, turn by maximum phase error */ + if (jam) + phi += M_PI / PhaseLevels; + + z.re = cos(phi); + z.im = sin(phi); + s->fftbuf[j] = cmul(s->datavect[i], z); + + /* turn odd carriers by 180 degrees */ + if (j % 2) { + s->fftbuf[j].re = -s->fftbuf[j].re; + s->fftbuf[j].im = -s->fftbuf[j].im; + } + + s->datavect[i] = s->fftbuf[j]; + j += DataCarrSepar; + } +} + +static void txpredata(void *state) +{ + struct txstate *s = (struct txstate *)state; + int i; + + for (i = 0; i < SymbolBits; i++) + s->txword[i] = 0; + + encodeword(state, 0); + + if (--s->statecntr <= 0) { + /* switch to data mode */ + s->txroutine = txdata; + } +} + +static void txdata(void *state) +{ + struct txstate *s = (struct txstate *)state; + int i; + + for (i = 0; i < SymbolBits; i++) { + s->txword[i] = getbitbatch(state); + s->txword[i] = fecencode(&s->fec, s->txword[i]); + } + + encodeword(state, 0); + + if (s->empty) { + /* switch to post data mode */ + s->txroutine = txpostdata; + s->statecntr = TxPostData + (s->fec.inlv * DataCarriers + 1) / SymbolBits; + } +} + +static void txpostdata(void *state) +{ + struct txstate *s = (struct txstate *)state; + int i; + + for (i = 0; i < SymbolBits; i++) + s->txword[i] = 0; + + encodeword(state, 0); + +#if 0 + if (!hdlc_txempty(&s->hdlc)) { + /* there is new data - switch back to data mode */ + s->txroutine = txdata; + return; + } +#endif + + if (--s->statecntr <= 0) { + /* switch to jamming mode */ + s->txroutine = txjam; + s->statecntr = TxJamLen; + srand(time(NULL)); + } +} + +static void txjam(void *state) +{ + struct txstate *s = (struct txstate *)state; + int i; + + for (i = 0; i < SymbolBits; i++) + s->txword[i] = rand(); + + encodeword(state, 1); + + if (--s->statecntr <= 0) { + /* switch to buffer flush mode */ + s->txroutine = txflush; + s->statecntr = 3; + } +} + +static void txflush(void *state) +{ + struct txstate *s = (struct txstate *)state; + + if (--s->statecntr <= 0) { + /* get ready for the next transmission */ + init_newqpsktx(state); + /* signal the main routine we're done */ + s->txdone = 1; + } +} + +/* --------------------------------------------------------------------- */ diff --git a/newqpsk/newqpsktx.h b/newqpsk/newqpsktx.h new file mode 100644 index 0000000..f00ac09 --- /dev/null +++ b/newqpsk/newqpsktx.h @@ -0,0 +1,39 @@ +#ifndef _NEWQPSKTX_H +#define _NEWQPSKTX_H + +#include "complex.h" +#include "modemconfig.h" + +/* --------------------------------------------------------------------- */ + +struct txstate { + struct modemchannel *chan; + struct fecstate fec; + struct filter filt; + unsigned int bps; + unsigned int shreg; + unsigned int bufsize; + unsigned int tunelen; + unsigned int synclen; + void (*txroutine) (void *); + int statecntr; + int tuneonly; + int txdone; + int empty; + float *txwindowfunc; + complex tunevect[TuneCarriers]; + complex datavect[DataCarriers]; + unsigned txword[SymbolBits]; + complex txwin[WindowLen]; + complex fftbuf[WindowLen]; + int saved; +}; + +/* --------------------------------------------------------------------- */ + +extern void init_newqpsktx(void *); +extern int newqpsktx(void *, complex *); + +/* --------------------------------------------------------------------- */ + +#endif diff --git a/newqpsk/tbl.c b/newqpsk/tbl.c new file mode 100644 index 0000000..46a1498 --- /dev/null +++ b/newqpsk/tbl.c @@ -0,0 +1,170 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include "modemconfig.h" + +float CosTable[WindowLen]; +float SinTable[WindowLen]; + +float ToneWindowInp[WindowLen]; +float ToneWindowOut[WindowLen]; +float DataWindowOut[WindowLen]; +float DataWindowInp[WindowLen]; + +float DataIniVectI[DataCarriers]; +float DataIniVectQ[DataCarriers]; +float TuneIniVectI[TuneCarriers]; +float TuneIniVectQ[TuneCarriers]; + +static void init_sincos(void) +{ + int i; + + for (i = 0; i < WindowLen; i++) + CosTable[i] = cos(2 * M_PI * i / WindowLen); + + for (i = 0; i < WindowLen; i++) + SinTable[i] = sin(2 * M_PI * i / WindowLen); +} + +#define Bins (WindowLen/2) + +static void init_window(void) +{ + int i, j; + float t, win, k[9], sum; + + for (i = 0; i < 2 * Bins; i++) { + t = i - Bins + 0.5; + win = 0.5 + cos(M_PI * t / Bins) + + 0.589 * cos(M_PI * 2 * t / Bins) + + 0.100 * cos(M_PI * 3 * t / Bins); + + ToneWindowInp[i] = win / 2.189; /*/(WindowLen/2); */ + } + + for (i = 0; i < 2 * Bins; i++) { + t = i - Bins + 0.5; + win = cos(M_PI / 2 * t / Bins); + + ToneWindowOut[i] = win * win / 1.2; + } + + k[0] = 0.37353458; + k[1] = 0.56663815; + k[2] = 0.19436159; + k[3] = -0.06777465; + k[4] = -0.09404610; + k[5] = -0.01705343; + k[6] = 0.02536151; + k[7] = 0.01323943; + k[8] = -0.00416208; + + for (i = 0; i < 2 * Bins; i++) { + t = i - Bins + 0.5; + sum = k[0]; + for (j = 1; j < 9; j++) + sum += k[j] * cos(M_PI * j * t / Bins); + + DataWindowOut[i] = sum; + } + + for (i = 0; i < 2 * Bins; i++) { + t = i - Bins + 0.5; + sum = k[0]; + for (j = 1; j < 9; j++) + sum += k[j] * cos(M_PI * j * t / Bins); + + DataWindowInp[i] = sum / 1.7; /* /(WindowLen/2); */ + } + +} + +static void init_inivect(void) +{ + int i, j; + float phi; + + for (i = 1, j = 0; i <= DataCarriers; i++, j++) { + phi = 8 * M_PI * i * i / DataCarriers; + DataIniVectI[j] = CarrierAmpl * cos(phi); + DataIniVectQ[j] = CarrierAmpl * sin(phi); + } + + for (i = 2, j = 0; i <= DataCarriers; i += 4, j++) { + phi = 8 * M_PI * i * i / DataCarriers; + TuneIniVectI[j] = 2 * CarrierAmpl * cos(phi); + TuneIniVectQ[j] = 2 * CarrierAmpl * sin(phi); + } +} + +void init_tbl(void) +{ + init_sincos(); + init_window(); + init_inivect(); +} + +#ifdef STANDALONE + +static void print_data(float *x, int len) +{ + int i; + + for (i = 0; i < len; i++) { + printf("\t% .10f", x[i]); + if ((i + 1) == len) + printf("\n};\n\n"); + else if ((i + 1) % 4 == 0) + printf(",\n"); + else + printf(","); + } +} + +static void dump_tables(void) +{ + printf("#include \"modemconfig.h\"\n"); + printf("#include \"tbl.h\"\n\n"); + + printf("float ToneWindowInp[WindowLen] = {\n"); + print_data(ToneWindowInp, WindowLen); + + printf("float ToneWindowOut[WindowLen] = {\n"); + print_data(ToneWindowOut, WindowLen); + + printf("float DataWindowOut[WindowLen] = {\n"); + print_data(DataWindowOut, WindowLen); + + printf("float DataWindowInp[WindowLen] = {\n"); + print_data(DataWindowInp, WindowLen); + + printf("float DataIniVectI[DataCarriers] = {\n"); + print_data(DataIniVectI, DataCarriers); + printf("float DataIniVectQ[DataCarriers] = {\n"); + print_data(DataIniVectQ, DataCarriers); + + printf("float TuneIniVectI[TuneCarriers] = {\n"); + print_data(TuneIniVectI, TuneCarriers); + printf("float TuneIniVectQ[TuneCarriers] = {\n"); + print_data(TuneIniVectQ, TuneCarriers); + + printf("float CosTable[WindowLen] = {\n"); + print_data(CosTable, WindowLen); + + printf("float SinTable[WindowLen] = {\n"); + print_data(SinTable, WindowLen); +} + +int main(int argc, char **argv) +{ + init_tbl(); + dump_tables(); + return 0; +} + +#endif diff --git a/newqpsk/tbl.h b/newqpsk/tbl.h new file mode 100644 index 0000000..aaa6007 --- /dev/null +++ b/newqpsk/tbl.h @@ -0,0 +1,22 @@ +#ifndef _TBL_H +#define _TBL_H + +extern float AliasFilterInpI[AliasFilterLen]; +extern float AliasFilterInpQ[AliasFilterLen]; + +extern float CosTable[WindowLen]; +extern float SinTable[WindowLen]; + +extern float ToneWindowInp[WindowLen]; +extern float ToneWindowOut[WindowLen]; +extern float DataWindowOut[WindowLen]; +extern float DataWindowInp[WindowLen]; + +extern float DataIniVectI[DataCarriers]; +extern float DataIniVectQ[DataCarriers]; +extern float TuneIniVectI[TuneCarriers]; +extern float TuneIniVectQ[TuneCarriers]; + +extern void init_tbl(void); + +#endif diff --git a/p3dmodem/Makefile.am b/p3dmodem/Makefile.am new file mode 100644 index 0000000..552fde3 --- /dev/null +++ b/p3dmodem/Makefile.am @@ -0,0 +1,28 @@ +INCLUDES = -I$(top_srcdir)/soundcard -I$(top_srcdir)/libmisc -I$(top_srcdir)/matlib + +noinst_LIBRARIES = libp3d.a +#dnl sbin_PROGRAMS + +genp3dtbl_SOURCES = genp3dtbl.c +genp3dtbl_LDADD = ../matlib/libmat.a + +testcrc_SOURCES = testcrc.c + +libp3d_a_SOURCES = p3dmodem.c + +noinst_HEADERS = \ + p3d.h \ + p3dtbl.h + +if CROSSCOMP + +else + +noinst_PROGRAMS = genp3dtbl testcrc + +$(srcdir)/p3dtbl.h: genp3dtbl + ./genp3dtbl > $@ + +endif + +EXTRA_DIST = diff --git a/p3dmodem/Makefile.in b/p3dmodem/Makefile.in new file mode 100644 index 0000000..03d8359 --- /dev/null +++ b/p3dmodem/Makefile.in @@ -0,0 +1,522 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +@CROSSCOMP_FALSE@noinst_PROGRAMS = genp3dtbl$(EXEEXT) testcrc$(EXEEXT) +subdir = p3dmodem +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +libp3d_a_AR = $(AR) $(ARFLAGS) +libp3d_a_LIBADD = +am_libp3d_a_OBJECTS = p3dmodem.$(OBJEXT) +libp3d_a_OBJECTS = $(am_libp3d_a_OBJECTS) +PROGRAMS = $(noinst_PROGRAMS) +am_genp3dtbl_OBJECTS = genp3dtbl.$(OBJEXT) +genp3dtbl_OBJECTS = $(am_genp3dtbl_OBJECTS) +genp3dtbl_DEPENDENCIES = ../matlib/libmat.a +am_testcrc_OBJECTS = testcrc.$(OBJEXT) +testcrc_OBJECTS = $(am_testcrc_OBJECTS) +testcrc_LDADD = $(LDADD) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libp3d_a_SOURCES) $(genp3dtbl_SOURCES) $(testcrc_SOURCES) +DIST_SOURCES = $(libp3d_a_SOURCES) $(genp3dtbl_SOURCES) \ + $(testcrc_SOURCES) +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUDIOFILE_CFLAGS = @AUDIOFILE_CFLAGS@ +AUDIOFILE_LIBS = @AUDIOFILE_LIBS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +HAVE_ALSA = @HAVE_ALSA@ +HAVE_BITTYPES = @HAVE_BITTYPES@ +HAVE_DIRECTX = @HAVE_DIRECTX@ +HAVE_IFRNEWNAME = @HAVE_IFRNEWNAME@ +HAVE_MKISS = @HAVE_MKISS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTHREAD = @LIBTHREAD@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +M_PI = @M_PI@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USEMMX = @USEMMX@ +USEVIS = @USEVIS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WIN32 = @WIN32@ +WINDRES = @WINDRES@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CFLAGS = @XML_CFLAGS@ +XML_LIBS = @XML_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +INCLUDES = -I$(top_srcdir)/soundcard -I$(top_srcdir)/libmisc -I$(top_srcdir)/matlib +noinst_LIBRARIES = libp3d.a +#dnl sbin_PROGRAMS +genp3dtbl_SOURCES = genp3dtbl.c +genp3dtbl_LDADD = ../matlib/libmat.a +testcrc_SOURCES = testcrc.c +libp3d_a_SOURCES = p3dmodem.c +noinst_HEADERS = \ + p3d.h \ + p3dtbl.h + +EXTRA_DIST = +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu p3dmodem/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu p3dmodem/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libp3d.a: $(libp3d_a_OBJECTS) $(libp3d_a_DEPENDENCIES) + -rm -f libp3d.a + $(libp3d_a_AR) libp3d.a $(libp3d_a_OBJECTS) $(libp3d_a_LIBADD) + $(RANLIB) libp3d.a + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) +genp3dtbl$(EXEEXT): $(genp3dtbl_OBJECTS) $(genp3dtbl_DEPENDENCIES) + @rm -f genp3dtbl$(EXEEXT) + $(LINK) $(genp3dtbl_OBJECTS) $(genp3dtbl_LDADD) $(LIBS) +testcrc$(EXEEXT): $(testcrc_OBJECTS) $(testcrc_DEPENDENCIES) + @rm -f testcrc$(EXEEXT) + $(LINK) $(testcrc_OBJECTS) $(testcrc_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genp3dtbl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/p3dmodem.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testcrc.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES clean-noinstPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am + + +@CROSSCOMP_FALSE@$(srcdir)/p3dtbl.h: genp3dtbl +@CROSSCOMP_FALSE@ ./genp3dtbl > $@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/p3dmodem/genp3dtbl.c b/p3dmodem/genp3dtbl.c new file mode 100644 index 0000000..4d8fbd5 --- /dev/null +++ b/p3dmodem/genp3dtbl.c @@ -0,0 +1,107 @@ +/*****************************************************************************/ + +/* + * genp3dtbl.c -- Generate tables for the AO-40 P3D PSK modem. + * + * Copyright (C) 1999-2000 Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please note that the GPL allows you to use the driver, NOT the radio. + * In order to use the radio, you need a license from the communications + * authority of your country. + * + */ + +/*****************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "modem.h" +#include "p3d.h" +#include "mat.h" + +#include +#include +#include + +/* ---------------------------------------------------------------------- */ + +extern inline unsigned int hweight32(unsigned int w) +{ + unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555); + res = (res & 0x33333333) + ((res >> 2) & 0x33333333); + res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F); + res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF); + return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF); +} + +/* ---------------------------------------------------------------------- */ + +#define COSBITS 9 + +static void gencos(FILE *f) +{ + unsigned int i; + + fprintf(f, "static const int16_t costab[%u] = {", (1<<(COSBITS))); + for (i = 0; ; i++) { + if (!(i & 7)) + fprintf(f, "\n\t"); + fprintf(f, "%6d", (int)(32767*cos(i * (2.0 * M_PI / (1<<(COSBITS)))))); + if (i >= (1<<(COSBITS))-1) + break; + fprintf(f, ", "); + } + fprintf(f, "\n};\n\n#define COS(x) (costab[(((x)>>%u)&0x%x)])\n#define SIN(x) COS((x)+0xc000)\n\n", + 16-COSBITS, (1<<(COSBITS))-1); +} + +/* ---------------------------------------------------------------------- */ + +static void gencrc(FILE *f) +{ + unsigned int i, j, k; + + fprintf(f, "static const u_int16_t amsat_crc[256] = {"); + for (i = 0;; i++) { + j = 0; + for (k = 0; k < 8; k++) { + j = (j << 1) | (((j >> 15) ^ (i >> (7-k))) & 1); + if (j & 1) + j ^= (1 << 5) | (1 << 12); + } + if (!(i & 15)) + fprintf(f, "\n\t"); + fprintf(f, "0x%04x", j & 0xffff); + if (i >= 255) + break; + fprintf(f, ", "); + } + fprintf(f, "\n};\n\n"); +} + +/* ---------------------------------------------------------------------- */ + +int main(int argc, char *argv[]) +{ + printf("/*\n * automatically generated by %s, do not edit!\n */\n\n" + "#ifdef HAVE_CONFIG_H\n#include \"config.h\"\n#endif\n\n#include \"modem.h\"\n\n", argv[0]); + gencos(stdout); + gencrc(stdout); + return 0; +} diff --git a/p3dmodem/p3d.h b/p3dmodem/p3d.h new file mode 100644 index 0000000..71dcdae --- /dev/null +++ b/p3dmodem/p3d.h @@ -0,0 +1,64 @@ +/*****************************************************************************/ + +/* + * p3d.h -- Defines for the AO-40 P3D PSK modem. + * + * Copyright (C) 1999-2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please note that the GPL allows you to use the driver, NOT the radio. + * In order to use the radio, you need a license from the communications + * authority of your country. + * + */ + +/*****************************************************************************/ + +#ifndef _P3D_H +#define _P3D_H + +/* ---------------------------------------------------------------------- */ + +typedef struct { + short re; + short im; +} cplxshort_t; + +typedef struct { + int re; + int im; +} cplxint_t; + +/* ---------------------------------------------------------------------- */ + +#define FNUMBER 15 +#define FCENTER 1600 +#define FSPACING 50 +#define SYMRATE 400 + +#define SYNCWORD 0x3915ED30 + +/* RxFilter */ +#define RXFILTSPAN 4 +#define RXFILTLEN 256 +#define RXFILTOVERBITS 3 +#define RXFILTOVER (1<<(RXFILTOVERBITS)) +#define RXFILTFIDX(x) (((x)>>(16-(RXFILTOVERBITS)))&(RXFILTOVER-1)) +#define RXFILTFSAMP(x) ((x)>>16) + +/* ---------------------------------------------------------------------- */ +#endif /* _P3D_H */ diff --git a/p3dmodem/p3dmodem.c b/p3dmodem/p3dmodem.c new file mode 100644 index 0000000..4bd8ecc --- /dev/null +++ b/p3dmodem/p3dmodem.c @@ -0,0 +1,695 @@ +/*****************************************************************************/ + +/* + * p3dmodemsimple.c -- AO-40 P3D PSK modem. + * + * Copyright (C) 1999-2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please note that the GPL allows you to use the driver, NOT the radio. + * In order to use the radio, you need a license from the communications + * authority of your country. + * + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE +#define _REENTRANT + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +#include "modem.h" +#include "p3d.h" +#include "p3dtbl.h" +#include "simd.h" + +#include +#include +#include +#include +#include + +/* --------------------------------------------------------------------- */ + +static inline double sinc(double x) +{ + double arg = x * M_PI; + + if (fabs(arg) < 1e-10) + return 1; + return sin(arg) / arg; +} + +static inline double hamming(double x) +{ + return 0.54-0.46*cos(2*M_PI*x); +} + +/* ---------------------------------------------------------------------- */ + +struct txstate { + struct modemchannel *chan; +}; + +static const struct modemparams modparams[] = { + { NULL } + +}; + +static void *modconfig(struct modemchannel *chan, unsigned int *samplerate, const char *params[]) +{ + struct txstate *s; + + if (!(s = calloc(1, sizeof(struct txstate)))) + logprintf(MLOG_FATAL, "out of memory\n"); + s->chan = chan; + *samplerate = 8000; + return s; +} + +static void modinit(void *state, unsigned int samplerate) +{ + struct txstate *s = (struct txstate *)state; +} + +static void modmodulate(void *state, unsigned int txdelay) +{ + struct txstate *tx = (struct txstate *)state; +} + +struct modulator p3dmodulator = { + NULL, + "p3d", + modparams, + /*modconfig*/NULL, + /*modinit*/NULL, + /*modmodulate*/NULL, + free +}; + +/* ---------------------------------------------------------------------- */ + +struct rxfilter { + int16_t re[RXFILTOVER][RXFILTLEN]; + int16_t im[RXFILTOVER][RXFILTLEN]; +}; + +struct rxstate { + struct modemchannel *chan; + unsigned int srate; + unsigned int rxfiltlen; + int16_t basebandfilter[RXFILTOVER][RXFILTLEN]; +}; + +/* ---------------------------------------------------------------------- */ + +/* + * Compute the filter coefficients + */ +#define RCOSALPHA 0.4 +#define FILTERRELAX 1.4 + +static void compute_rxfilter_from_bb(struct rxstate *rx, struct rxfilter *filter, unsigned int phinc) +{ + unsigned int phase = 0, phase2, phinc2, i, j; + + memset(filter, 0, sizeof(struct rxfilter)); + phinc2 = phinc >> RXFILTOVERBITS; + //phase += (RXFILTOVER-1) * phinc2; + for (i = 0; i < rx->rxfiltlen; i++) { + phase2 = phase; + for (j = 0; j < RXFILTOVER; j++) { + filter->re[j][i] = (COS(phase2) * rx->basebandfilter[j][i]) >> 15; + filter->im[j][i] = -(SIN(phase2) * rx->basebandfilter[j][i]) >> 15; + phase2 -= phinc2; + } + phase += phinc; + } +} + +static inline void compute_rxfilter(struct rxstate *rx) +{ + float coeff[RXFILTOVER][RXFILTLEN] = { { 0, }, }; + float pulseen[RXFILTOVER] = { 0, }; + double tmul; + float max1, max2, t, tm, at, f1, f2, f3; + unsigned int i, j; + + memset(coeff, 0, sizeof(coeff)); + rx->rxfiltlen = (rx->srate * RXFILTSPAN + SYMRATE - 1) / SYMRATE; + /* round to next 4 because SIMD is more efficient with this */ + rx->rxfiltlen = (rx->rxfiltlen + 3) & ~3; + if (rx->rxfiltlen > RXFILTLEN) { + logprintf(MLOG_WARNING, "demodp3d: input filter length too long\n"); + rx->rxfiltlen = RXFILTLEN; + } + logprintf(257, "p3d: rxfilter length %u, sampling rate %u\n", rx->rxfiltlen, rx->srate); + tm = rx->rxfiltlen*RXFILTOVER*0.5; +#if 0 + tmul = FILTERRELAX * (2.0 * SYMRATE) / RXFILTOVER / ((double)rx->srate); + for (i = 0; i < RXFILTOVER*rx->rxfiltlen; i++) + coeff[i % RXFILTOVER][i / RXFILTOVER] = + sinc((i - tm) * tmul) + * hamming((double)i / (double)(RXFILTOVER*rx->rxfiltlen-1)); +#else + tmul = (2.0*SYMRATE) / RXFILTOVER / ((double)rx->srate); + for (i = 0; i < RXFILTOVER*rx->rxfiltlen; i++) { + t = (i - tm) * tmul; + at = t * RCOSALPHA; + f1 = 1 - 4 * at * at; + if (fabs(f1) < 1e-10) + f2 = M_PI * (1.0 / 8.0) * sin(M_PI * at) / at; + else + f2 = cos(M_PI * at) / f1; + f3 = f2 * sinc(t); +#if 0 + logprintf(258, "p3d: i %4u t %10g at %10g f1 %10g f3 %10g\n", i, t, at, f1, f3); +#endif + coeff[i % RXFILTOVER][i / RXFILTOVER] = f3; + } +#endif + if (logcheck(257)) { + char buf[32768]; + char *cp = buf; + for (i = 0; i < RXFILTOVER*rx->rxfiltlen; i++) + cp += sprintf(cp, " %g", coeff[i % RXFILTOVER][i / RXFILTOVER]); + logprintf(257, "p3d: pulse = [ %s ];\n", buf+1); + } + max1 = 0; + for (i = 0; i < RXFILTOVER; i++) { + max2 = 0; + for (j = 0; j < rx->rxfiltlen; j++) + max2 += fabs(coeff[i][j]); + if (max2 > max1) + max1 = max2; + } + max2 = ((float)0x7fffffff / (float)0x7fff) / max1; + for (i = 0; i < RXFILTOVER; i++) { + f1 = 0; + for (j = 0; j < rx->rxfiltlen; j++) { + rx->basebandfilter[i][j] = max2 * coeff[RXFILTOVER-1-i][j]; + f1 += rx->basebandfilter[i][j] * rx->basebandfilter[i][j]; + } + pulseen[i] = f1; + } + if (logcheck(257)) { + char buf[512]; + char *cp = buf; + for (i = 0; i < RXFILTOVER; i++) + cp += sprintf(cp, ", %6.2gdB", 10*M_LOG10E*log(pulseen[i]) - 10*M_LOG10E*log(32768.0 * (1<<16))); + logprintf(257, "p3d: pulse energies: %s\n", buf+2); + } +} + +static cplxint_t calc_rxfilter(const int16_t *val, const struct rxfilter *filter, unsigned int filtlen, unsigned int phase) +{ + const int16_t *re, *im; + cplxint_t r; + + re = filter->re[RXFILTFIDX(phase)]; + im = filter->im[RXFILTFIDX(phase)]; + val += RXFILTFSAMP(phase); + r.re = simdfir16(val, re, filtlen) >> 15; + r.im = simdfir16(val, im, filtlen) >> 15; + return r; +} + +static cplxint_t calc_baseband_rxfilter(const struct rxstate *rx, const int16_t *re, const int16_t *im, + unsigned int phase) +{ + unsigned int ph1, ph2; + cplxint_t r; + + ph1 = RXFILTFIDX(phase); + ph2 = RXFILTFSAMP(phase); + r.re = simdfir16(re + ph2, rx->basebandfilter[ph1], rx->rxfiltlen) >> 15; + r.im = simdfir16(im + ph2, rx->basebandfilter[ph1], rx->rxfiltlen) >> 15; + return r; +} + +/* ---------------------------------------------------------------------- */ + +#define CRXBLOCKSIZE 1024 +#define SYNCTIMEOUT (5*SYMRATE) + +static unsigned int contrx(struct rxstate *rx, unsigned int phase, unsigned int phinc, unsigned int freqinc) +{ + unsigned int bufphase = (phase - (10 << 16)) & ~0xffff, freq = 0, phearlylate = phinc >> 3, phcomp = phinc >> 7; + unsigned int sbufptr = 0, i, me, ml, shreg = 0, rxbufptr = (512+2)*8; + u_int16_t crc = 0xffff; + int16_t samp_re[CRXBLOCKSIZE+RXFILTLEN], samp_im[CRXBLOCKSIZE+RXFILTLEN]; + cplxint_t sbuf[32], lasts, news, earlys, lates, r1; + unsigned char rxbuf[512+2]; + + audioread(rx->chan, &samp_im[0], RXFILTLEN, bufphase >> 16); + for (i = 0; i < RXFILTLEN; i++) { + r1.re = samp_im[i] * COS(freq); + r1.im = - samp_im[i] * SIN(freq); + freq += freqinc; + samp_re[i] = r1.re >> 15; + samp_im[i] = r1.im >> 15; + } + lasts.re = lasts.im = 0; + for (;;) { + audioread(rx->chan, &samp_im[RXFILTLEN], CRXBLOCKSIZE, (bufphase >> 16) + RXFILTLEN); + for (i = RXFILTLEN; i < CRXBLOCKSIZE+RXFILTLEN; i++) { + r1.re = samp_im[i] * COS(freq); + r1.im = - samp_im[i] * SIN(freq); + freq += freqinc; + samp_re[i] = r1.re >> 15; + samp_im[i] = r1.im >> 15; + } + while ((phase - bufphase) < ((CRXBLOCKSIZE+10) << 16)) { + news = calc_baseband_rxfilter(rx, samp_re, samp_im, phase-bufphase); + earlys = calc_baseband_rxfilter(rx, samp_re, samp_im, phase-phearlylate-bufphase); + lates = calc_baseband_rxfilter(rx, samp_re, samp_im, phase+phearlylate-bufphase); + phase += phinc; + r1 = calc_baseband_rxfilter(rx, samp_re, samp_im, phase-bufphase); + news.re -= r1.re; + news.im -= r1.im; + r1 = calc_baseband_rxfilter(rx, samp_re, samp_im, phase-phearlylate-bufphase); + earlys.re -= r1.re; + earlys.im -= r1.im; + r1 = calc_baseband_rxfilter(rx, samp_re, samp_im, phase+phearlylate-bufphase); + lates.re -= r1.re; + lates.im -= r1.im; + phase += phinc; + me = earlys.re * earlys.re + earlys.im * earlys.im; + ml = lates.re * lates.re + lates.im * lates.im; + if (me > ml) + phase -= phcomp; + else + phase += phcomp; + r1.re = (news.re * lasts.re + news.im * lasts.im) >> 5; + r1.im = (news.im * lasts.re - news.re * lasts.im) >> 5; + sbuf[sbufptr] = r1; + sbufptr = (sbufptr + 1) & 31; + lasts = news; + shreg <<= 1; + shreg |= (r1.re < 0); + if (rxbufptr >= (512+2)*8) { + if ((shreg & 0xffffffff) == SYNCWORD) { + crc = 0xffff; + rxbufptr = 0; + r1.re = r1.im = 0; + for (i = 0; i < 32; i++) { + if (sbuf[i].re < 0) { + r1.re -= sbuf[i].re; + r1.im -= sbuf[i].im; + } else { + r1.re += sbuf[i].re; + r1.im += sbuf[i].im; + } + } + simdpreparefpu(); + freqinc += (0x8000 / M_PI * SYMRATE) * atan2(r1.im, r1.re) / rx->srate; + p3drxstate(rx->chan, 1, (rx->srate * freqinc + 0x8000) >> 16); + logprintf(256, "p3ddemod: SYNC word: phase 0x%08x finc: 0x%06x (%d%+di)\n", phase, freqinc, r1.re, r1.im); + continue; + } + rxbufptr++; + if (rxbufptr < (512+2)*8+SYNCTIMEOUT) + continue; + return phase; + } + if ((rxbufptr & 7) == 7) + rxbuf[rxbufptr >> 3] = shreg; + rxbufptr++; + if (rxbufptr < (512+2)*8) + continue; + crc = 0xffff; + for (i = 0; i < (512+2); i++) + crc = (crc << 8) ^ amsat_crc[((crc >> 8) ^ rxbuf[i]) & 0xff]; + p3dreceive(rx->chan, rxbuf, crc & 0xffff); + p3drxstate(rx->chan, 2, (rx->srate * freqinc + 0x8000) >> 16); + } + memcpy(&samp_re[0], &samp_re[CRXBLOCKSIZE], RXFILTLEN * sizeof(samp_re[0])); + memcpy(&samp_im[0], &samp_im[CRXBLOCKSIZE], RXFILTLEN * sizeof(samp_im[0])); + bufphase += CRXBLOCKSIZE << 16; + } +} + +/* ---------------------------------------------------------------------- */ + +static void rxblock(struct rxstate *rx, unsigned int phase, unsigned int phinc, unsigned int freqinc) +{ + unsigned int samplen, i, j, crc; + int16_t *samp_re, *samp_im; + cplxint_t sbuf[(512+2)*8*2+1], r1, r2, r3; + unsigned char rxbuf[512+2], *bp; + + samplen = ((((512+2)*8*2+1)*phinc) >> 16) + 1 + rx->rxfiltlen; + samp_re = alloca(samplen * sizeof(samp_re[0])); + samp_im = alloca(samplen * sizeof(samp_im[0])); + audioread(rx->chan, &samp_im[0], samplen, phase >> 16); + phase &= 0xffff; + /* downconvert */ + j = 0; + for (i = 0; i < samplen; i++) { + r1.re = samp_im[i] * COS(j); + r1.im = - samp_im[i] * SIN(j); + j += freqinc; + samp_re[i] = r1.re >> 15; + samp_im[i] = r1.im >> 15; + } + /* baseband filtering */ + for (i = 0; i < (512+2)*8*2+1; i++) { + sbuf[i] = calc_baseband_rxfilter(rx, samp_re, samp_im, phase); + phase += phinc; + } + /* "Manchester" PSK decode */ + memset(rxbuf, 0, sizeof(rxbuf)); + bp = rxbuf; + crc = 0xffff; + for (i = 0; i < (512+2)*8; i++) { + r1.re = sbuf[2*i].re - sbuf[2*i+1].re; + r1.im = sbuf[2*i].im - sbuf[2*i+1].im; + r2.re = sbuf[2*i+2].re - sbuf[2*i+3].re; + r2.im = sbuf[2*i+2].im - sbuf[2*i+3].im; + r3.re = (r2.re * r1.re + r2.im * r1.im) >> 15; + r3.im = (r2.im * r1.re - r2.re * r1.im) >> 15; + *bp <<= 1; + *bp |= (r3.re < 0); + if ((i & 7) == 7) + bp++; + crc <<= 1; + crc |= ((crc >> 16) ^ (r3.re < 0)) & 1; + if (crc & 1) + crc ^= (1 << 5) | (1 << 12); + } + p3dreceive(rx->chan, rxbuf, crc & 0xffff); +} + +/* ---------------------------------------------------------------------- */ + +static unsigned int finesync_corr(struct rxstate *rx, unsigned int phase, unsigned int phsamp, unsigned int phinc, + int16_t *samp_re, int16_t *samp_im, cplxint_t *freqr) +{ + unsigned int ph = phase - phsamp, i, j; + cplxint_t sbuf[33*2], r1, r2, r3, r4; + + for (i = 0; i < 33*2; i++) { + sbuf[i] = calc_baseband_rxfilter(rx, samp_re, samp_im, ph); + ph += phinc; + } + r4.re = r4.im = 0; + j = 0; + for (i = 0; i < 32; i++) { + r1.re = sbuf[2*i].re - sbuf[2*i+1].re; + r1.im = sbuf[2*i].im - sbuf[2*i+1].im; + r2.re = sbuf[2*i+2].re - sbuf[2*i+3].re; + r2.im = sbuf[2*i+2].im - sbuf[2*i+3].im; + r3.re = (r2.re * r1.re + r2.im * r1.im) >> 5; + r3.im = (r2.im * r1.re - r2.re * r1.im) >> 5; + j <<= 1; + j |= (r3.re < 0); + if (j & 1) { + r4.re -= r3.re; + r4.im -= r3.im; + } else { + r4.re += r3.re; + r4.im += r3.im; + } + } + *freqr = r4; + if ((j & 0xffffffff) != SYNCWORD) { + logprintf(256, "p3ddemod: finesync: phase 0x%08x word 0x%08x\n", phase, j); + return 0; + } + r3.re = r3.im = 0; + j = 0; + for (i = 0; i < 33; i++) { + r1.re = sbuf[2*i].re - sbuf[2*i+1].re; + r1.im = sbuf[2*i].im - sbuf[2*i+1].im; + if (j) { + r3.re -= r1.re; + r3.im -= r1.im; + } else { + r3.re += r1.re; + r3.im += r1.im; + } + if (SYNCWORD & (0x80000000 >> i)) + j = !j; + } + r3.re >>= 5; + r3.im >>= 5; + i = r3.re * r3.re + r3.im * r3.im; + logprintf(256, "p3ddemod: finesync: phase 0x%08x val %6u freqr %6d%+7di\n", phase, i, r4.re, r4.im); + return i; +} + +struct finesyncparams { + unsigned int phest; + unsigned int phinc; + unsigned int finc; + unsigned int maxen; +}; + +static struct finesyncparams fine_sync(struct rxstate *rx, const struct rxfilter *filter, + unsigned int phest, unsigned int freqest) +{ + unsigned int phase = phest, phsamp, phinc, finc, i, j, samplen, maxen; + int tmg, tmgmax; + cplxint_t r1, maxv, freqr; + int16_t *samp, *samp_re, *samp_im; + struct finesyncparams fsp; + + //printf("Sync Det: phest 0x%08x freqest 0x%08x\n", phest, freqest); + finc = ((freqest << 16) + rx->srate/2) / rx->srate; + phinc = ((rx->srate << 16) + SYMRATE) / (2 * SYMRATE); + samplen = (((36+2)*2*phinc) >> 16) + rx->rxfiltlen; + phsamp = (phest - 4*phinc) & ~0xffff; + samp = alloca(samplen * sizeof(samp[0])); + samp_re = alloca(samplen * sizeof(samp_re[0])); + samp_im = alloca(samplen * sizeof(samp_im[0])); + audioread(rx->chan, &samp[0], samplen, phsamp >> 16); + j = 0; + for (i = 0; i < samplen; i++) { + r1.re = samp[i] * COS(j); + r1.im = - samp[i] * SIN(j); + j += finc; + samp_re[i] = r1.re >> 15; + samp_im[i] = r1.im >> 15; + } +#if 0 + i = (0x7b8a-(phsamp >> 16)) & 0xffff; + if (i < samplen) { + printf("Samples:"); + for (j = 0; j < 16; j++) + printf(" %d%+di", samp_re[i+j], samp_im[i+j]); + printf("\n"); + } +#endif + maxen = 0; + maxv.re = maxv.im = 0; + for (tmgmax = tmg = -16; tmg <= 16; tmg++) { + phase = phest + tmg * (phinc >> 3); + if (((phase + 33*2*phinc - phsamp) >> 16)+rx->rxfiltlen > samplen) + abort(); + i = finesync_corr(rx, phase, phsamp, phinc, samp_re, samp_im, &r1); + if (i > maxen) { + maxen = i; + tmgmax = tmg; + freqr = r1; + } + } + phest += tmgmax * (phinc >> 3); + simdpreparefpu(); + finc += (0x8000 / M_PI * SYMRATE) * atan2(freqr.im, freqr.re) / rx->srate; + j = 0; + for (i = 0; i < samplen; i++) { + r1.re = samp[i] * COS(j); + r1.im = - samp[i] * SIN(j); + j += finc; + samp_re[i] = r1.re >> 15; + samp_im[i] = r1.im >> 15; + } + maxen = 0; + maxv.re = maxv.im = 0; + freqr.re = freqr.im = 0; + for (tmgmax = tmg = -8; tmg <= 8; tmg++) { + phase = phest + tmg * (phinc >> 6); + if (((phase + 33*2*phinc - phsamp) >> 16)+rx->rxfiltlen > samplen) + abort(); + i = finesync_corr(rx, phase, phsamp, phinc, samp_re, samp_im, &r1); + if (i > maxen) { + maxen = i; + tmgmax = tmg; + freqr = r1; + } + } + phest += tmgmax * (phinc >> 6); + simdpreparefpu(); + finc += (0x8000 / M_PI * SYMRATE) * atan2(freqr.im, freqr.re) / rx->srate; + fsp.phest = phest; + fsp.phinc = phinc; + fsp.finc = finc; + fsp.maxen = maxen; + return fsp; +} + +/* ---------------------------------------------------------------------- */ + +#define BLOCKSIZE 1024 +#define RBUFSIZE 512 +#define SAMPLESPERBIT 8 + +static void synchunt(struct rxstate *rx) +{ + int16_t samp[RXFILTLEN+BLOCKSIZE]; + struct { + unsigned int phase, phinc, freq; + struct rxfilter filter; + unsigned int bitstr[SAMPLESPERBIT]; + cplxint_t rbuf[RBUFSIZE]; + } carrier[FNUMBER]; + cplxint_t r1, r2, r3; + unsigned int phase = 0, phase2, phinc, syncph = 0, rptr, i, j; + struct finesyncparams fsp; + + memset(carrier, 0, sizeof(carrier)); + for (i = 0; i < FNUMBER; i++) { + carrier[i].freq = j = (FCENTER - (FNUMBER-1) * FSPACING / 2) + i * FSPACING; + carrier[i].phinc = ((j << 16) + (SAMPLESPERBIT * SYMRATE / 2)) / (SAMPLESPERBIT * SYMRATE); + compute_rxfilter_from_bb(rx, &carrier[i].filter, ((j << 16) + rx->srate/2) / rx->srate); + } + phinc = ((rx->srate << 16) + (SAMPLESPERBIT * SYMRATE / 2)) / (SAMPLESPERBIT * SYMRATE); + restart: + p3drxstate(rx->chan, 0, 0); + phase2 = phase & 0xffff; + audioread(rx->chan, &samp[0], RXFILTLEN, phase >> 16); + for (;;) { + audioread(rx->chan, &samp[RXFILTLEN], BLOCKSIZE, (phase >> 16) + RXFILTLEN); + for (rptr = 0; phase2 < (BLOCKSIZE << 16); phase2 += phinc, phase += phinc) { + for (i = 0; i < FNUMBER; i++) { + r1 = calc_rxfilter(samp, &carrier[i].filter, rx->rxfiltlen, phase2); + r2.re = COS(carrier[i].phase); + r2.im = -SIN(carrier[i].phase); + carrier[i].phase += carrier[i].phinc; + r3.re = (r2.re * r1.re - r2.im * r1.im) >> 15; + r3.im = (r2.im * r1.re + r2.re * r1.im) >> 15; + carrier[i].rbuf[rptr + 2*SAMPLESPERBIT] = r3; + } + rptr++; + } + /* do differential decode */ + for (i = 0; i < rptr; i++) { + for (j = 0; j < FNUMBER; j++) { + r1.re = carrier[j].rbuf[i].re - carrier[j].rbuf[i+SAMPLESPERBIT/2].re; + r1.im = carrier[j].rbuf[i].im - carrier[j].rbuf[i+SAMPLESPERBIT/2].im; + r2.re = carrier[j].rbuf[i+SAMPLESPERBIT].re - carrier[j].rbuf[i+3*SAMPLESPERBIT/2].re; + r2.im = carrier[j].rbuf[i+SAMPLESPERBIT].im - carrier[j].rbuf[i+3*SAMPLESPERBIT/2].im; + r3.re = (r2.re * r1.re + r2.im * r1.im) >> 15; + r3.im = (r2.im * r1.re - r2.re * r1.im) >> 15; + carrier[j].bitstr[syncph] <<= 1; + carrier[j].bitstr[syncph] |= (r3.re < 0); + if (SYNCWORD == (carrier[j].bitstr[syncph] & 0xffffffff)) { + //printf("\n\n====== SYNC DETECTED: phase %08x rbuf %u freq %u syncph %u\n\n\n", phase, i, j, syncph); + fsp = fine_sync(rx, &carrier[j].filter, phase - (rptr-i+33*SAMPLESPERBIT) * phinc, carrier[j].freq); + if (fsp.maxen > 10) { + p3drxstate(rx->chan, 1, (rx->srate * fsp.finc + 0x8000) >> 16); +#if 0 + rxblock(rx, fsp.phest+32*2*fsp.phinc, fsp.phinc, fsp.finc); + phase = fsp.phest + (4+512+2)*8*2*phinc; +#else + phase = contrx(rx, fsp.phest, fsp.phinc, fsp.finc); +#endif + goto restart; + } + } +#if 0 + if (!syncph) + printf("\n"); + printf("| %c ", '0'+(r3.re < 0)); +#endif + } + syncph++; + if (syncph >= SAMPLESPERBIT) + syncph = 0; + } + fflush(stdout); + /* prepare for next iteration */ + phase2 -= (BLOCKSIZE << 16); + memcpy(&samp[0], &samp[BLOCKSIZE], RXFILTLEN * sizeof(samp[0])); + for (i = 0; i < FNUMBER; i++) { + memcpy(&carrier[i].rbuf[0], &carrier[i].rbuf[rptr], + 2*SAMPLESPERBIT*sizeof(carrier[i].rbuf[0])); + } + } +} + +static void receiver(void *__rx) +{ + struct rxstate *rx = (struct rxstate *)__rx; + + synchunt(rx); +} + +static const struct modemparams demodparams[] = { + { NULL } + +}; + +static void *demodconfig(struct modemchannel *chan, unsigned int *samplerate, const char *params[]) +{ + struct rxstate *s; + + if (!(s = calloc(1, sizeof(struct rxstate)))) + logprintf(MLOG_FATAL, "out of memory\n"); + s->chan = chan; + *samplerate = 8000; + return s; +} + +static void demodinit(void *state, unsigned int samplerate, unsigned int *bitrate) +{ + struct rxstate *s = (struct rxstate *)state; + + s->srate = samplerate; + *bitrate = 400; + compute_rxfilter(s); +} + +struct demodulator p3ddemodulator = { + NULL, + "p3d", + demodparams, + demodconfig, + demodinit, + receiver, + free +}; + +/* ---------------------------------------------------------------------- */ diff --git a/p3dmodem/p3dtbl.h b/p3dmodem/p3dtbl.h new file mode 100644 index 0000000..f95d1a8 --- /dev/null +++ b/p3dmodem/p3dtbl.h @@ -0,0 +1,99 @@ +/* + * automatically generated by ./genp3dtbl, do not edit! + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "modem.h" + +static const int16_t costab[512] = { + 32767, 32764, 32757, 32744, 32727, 32705, 32678, 32646, + 32609, 32567, 32520, 32468, 32412, 32350, 32284, 32213, + 32137, 32056, 31970, 31880, 31785, 31684, 31580, 31470, + 31356, 31236, 31113, 30984, 30851, 30713, 30571, 30424, + 30272, 30116, 29955, 29790, 29621, 29446, 29268, 29085, + 28897, 28706, 28510, 28309, 28105, 27896, 27683, 27466, + 27244, 27019, 26789, 26556, 26318, 26077, 25831, 25582, + 25329, 25072, 24811, 24546, 24278, 24006, 23731, 23452, + 23169, 22883, 22594, 22301, 22004, 21705, 21402, 21096, + 20787, 20474, 20159, 19840, 19519, 19194, 18867, 18537, + 18204, 17868, 17530, 17189, 16845, 16499, 16150, 15799, + 15446, 15090, 14732, 14372, 14009, 13645, 13278, 12909, + 12539, 12166, 11792, 11416, 11038, 10659, 10278, 9895, + 9511, 9126, 8739, 8351, 7961, 7571, 7179, 6786, + 6392, 5997, 5601, 5205, 4807, 4409, 4011, 3611, + 3211, 2811, 2410, 2009, 1607, 1206, 804, 402, + 0, -402, -804, -1206, -1607, -2009, -2410, -2811, + -3211, -3611, -4011, -4409, -4807, -5205, -5601, -5997, + -6392, -6786, -7179, -7571, -7961, -8351, -8739, -9126, + -9511, -9895, -10278, -10659, -11038, -11416, -11792, -12166, + -12539, -12909, -13278, -13645, -14009, -14372, -14732, -15090, + -15446, -15799, -16150, -16499, -16845, -17189, -17530, -17868, + -18204, -18537, -18867, -19194, -19519, -19840, -20159, -20474, + -20787, -21096, -21402, -21705, -22004, -22301, -22594, -22883, + -23169, -23452, -23731, -24006, -24278, -24546, -24811, -25072, + -25329, -25582, -25831, -26077, -26318, -26556, -26789, -27019, + -27244, -27466, -27683, -27896, -28105, -28309, -28510, -28706, + -28897, -29085, -29268, -29446, -29621, -29790, -29955, -30116, + -30272, -30424, -30571, -30713, -30851, -30984, -31113, -31236, + -31356, -31470, -31580, -31684, -31785, -31880, -31970, -32056, + -32137, -32213, -32284, -32350, -32412, -32468, -32520, -32567, + -32609, -32646, -32678, -32705, -32727, -32744, -32757, -32764, + -32767, -32764, -32757, -32744, -32727, -32705, -32678, -32646, + -32609, -32567, -32520, -32468, -32412, -32350, -32284, -32213, + -32137, -32056, -31970, -31880, -31785, -31684, -31580, -31470, + -31356, -31236, -31113, -30984, -30851, -30713, -30571, -30424, + -30272, -30116, -29955, -29790, -29621, -29446, -29268, -29085, + -28897, -28706, -28510, -28309, -28105, -27896, -27683, -27466, + -27244, -27019, -26789, -26556, -26318, -26077, -25831, -25582, + -25329, -25072, -24811, -24546, -24278, -24006, -23731, -23452, + -23169, -22883, -22594, -22301, -22004, -21705, -21402, -21096, + -20787, -20474, -20159, -19840, -19519, -19194, -18867, -18537, + -18204, -17868, -17530, -17189, -16845, -16499, -16150, -15799, + -15446, -15090, -14732, -14372, -14009, -13645, -13278, -12909, + -12539, -12166, -11792, -11416, -11038, -10659, -10278, -9895, + -9511, -9126, -8739, -8351, -7961, -7571, -7179, -6786, + -6392, -5997, -5601, -5205, -4807, -4409, -4011, -3611, + -3211, -2811, -2410, -2009, -1607, -1206, -804, -402, + 0, 402, 804, 1206, 1607, 2009, 2410, 2811, + 3211, 3611, 4011, 4409, 4807, 5205, 5601, 5997, + 6392, 6786, 7179, 7571, 7961, 8351, 8739, 9126, + 9511, 9895, 10278, 10659, 11038, 11416, 11792, 12166, + 12539, 12909, 13278, 13645, 14009, 14372, 14732, 15090, + 15446, 15799, 16150, 16499, 16845, 17189, 17530, 17868, + 18204, 18537, 18867, 19194, 19519, 19840, 20159, 20474, + 20787, 21096, 21402, 21705, 22004, 22301, 22594, 22883, + 23169, 23452, 23731, 24006, 24278, 24546, 24811, 25072, + 25329, 25582, 25831, 26077, 26318, 26556, 26789, 27019, + 27244, 27466, 27683, 27896, 28105, 28309, 28510, 28706, + 28897, 29085, 29268, 29446, 29621, 29790, 29955, 30116, + 30272, 30424, 30571, 30713, 30851, 30984, 31113, 31236, + 31356, 31470, 31580, 31684, 31785, 31880, 31970, 32056, + 32137, 32213, 32284, 32350, 32412, 32468, 32520, 32567, + 32609, 32646, 32678, 32705, 32727, 32744, 32757, 32764 +}; + +#define COS(x) (costab[(((x)>>7)&0x1ff)]) +#define SIN(x) COS((x)+0xc000) + +static const u_int16_t amsat_crc[256] = { + 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, + 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, + 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, + 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, + 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, + 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, + 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, + 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, + 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, + 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, + 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, + 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, + 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, + 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, + 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, + 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 +}; + diff --git a/p3dmodem/testcrc.c b/p3dmodem/testcrc.c new file mode 100644 index 0000000..d7056fd --- /dev/null +++ b/p3dmodem/testcrc.c @@ -0,0 +1,91 @@ +/*****************************************************************************/ + +/* + * testcrc.c -- Test the AMSAT CRC table. + * + * Copyright (C) 2000 Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please note that the GPL allows you to use the driver, NOT the radio. + * In order to use the radio, you need a license from the communications + * authority of your country. + * + */ + +/*****************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "p3dtbl.h" +#include +#include +#include + +/* --------------------------------------------------------------------- */ + +#define BLOCKSZ 512 + +static int testone(void) +{ + unsigned char data[BLOCKSZ]; + unsigned int i, j; + u_int16_t crc1 = 0xffff, crc2 = 0xffff; + + /* fill block with random bytes */ + for (i = 0; i < BLOCKSZ; i++) + data[i] = random(); + /* compute conventional CRC */ + for (i = 0; i < BLOCKSZ; i++) + for (j = 0; j < 8; j++) { + crc1 = (crc1 << 1) | (((crc1 >> 15) ^ (data[i] >> (7-j))) & 1); + if (crc1 & 1) + crc1 ^= (1 << 5) | (1 << 12); + } + /* compute table CRC */ + for (i = 0; i < BLOCKSZ; i++) + crc2 = (crc2 << 8) ^ amsat_crc[((crc2 >> 8) ^ data[i]) & 0xff]; + if (crc1 == crc2) + return 0; + printf("CRC error! conventional CRC 0x%04x, table CRC 0x%04x\n", crc1, crc2); + for (i = 0; i < BLOCKSZ; i++) { + if (!(i & 15)) + printf("\n%04x:", i); + printf(" %02x", data[i]); + } + printf("\n"); + return -1; +} + +/* --------------------------------------------------------------------- */ + +int main(int argc, char *argv[]) +{ + unsigned int i; + + srandom(time(NULL)); + for (i = 0; i < 131072; i++) { + if (!(i & 1023)) { + printf("%u\r", i); + fflush(stdout); + } + if (testone()) + exit(1); + } + printf("OK\n"); + exit(0); +} diff --git a/pammodem/Makefile.am b/pammodem/Makefile.am new file mode 100644 index 0000000..0aae45f --- /dev/null +++ b/pammodem/Makefile.am @@ -0,0 +1,34 @@ +INCLUDES = -I$(top_srcdir)/soundcard -I$(top_srcdir)/libmisc -I$(top_srcdir)/matlib + +noinst_LIBRARIES = libpam.a +#dnl sbin_PROGRAMS + +libpam_a_SOURCES = pammodem.c + +meas_SOURCES = meas.c +meas_LDADD = ../libmisc/libmisc.a ../matlib/libmat.a + +genpamtbl_SOURCES = genpamtbl.c +genpamtbl_LDADD = ../matlib/libmat.a + +noinst_HEADERS = \ + meas.h \ + pam.h \ + pamtbl.h + +if WIN32 +MEASPROG = +else +MEASPROG = meas +endif + +if CROSSCOMP + +else + +noinst_PROGRAMS = $(MEASPROG) genpamtbl + +$(srcdir)/pamtbl.h: genpamtbl$(EXEEXT) + ./genpamtbl > $@ + +endif diff --git a/pammodem/Makefile.in b/pammodem/Makefile.in new file mode 100644 index 0000000..4affe19 --- /dev/null +++ b/pammodem/Makefile.in @@ -0,0 +1,526 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +@CROSSCOMP_FALSE@noinst_PROGRAMS = $(am__EXEEXT_1) genpamtbl$(EXEEXT) +subdir = pammodem +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +libpam_a_AR = $(AR) $(ARFLAGS) +libpam_a_LIBADD = +am_libpam_a_OBJECTS = pammodem.$(OBJEXT) +libpam_a_OBJECTS = $(am_libpam_a_OBJECTS) +@WIN32_FALSE@am__EXEEXT_1 = meas$(EXEEXT) +PROGRAMS = $(noinst_PROGRAMS) +am_genpamtbl_OBJECTS = genpamtbl.$(OBJEXT) +genpamtbl_OBJECTS = $(am_genpamtbl_OBJECTS) +genpamtbl_DEPENDENCIES = ../matlib/libmat.a +am_meas_OBJECTS = meas.$(OBJEXT) +meas_OBJECTS = $(am_meas_OBJECTS) +meas_DEPENDENCIES = ../libmisc/libmisc.a ../matlib/libmat.a +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libpam_a_SOURCES) $(genpamtbl_SOURCES) $(meas_SOURCES) +DIST_SOURCES = $(libpam_a_SOURCES) $(genpamtbl_SOURCES) \ + $(meas_SOURCES) +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUDIOFILE_CFLAGS = @AUDIOFILE_CFLAGS@ +AUDIOFILE_LIBS = @AUDIOFILE_LIBS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +HAVE_ALSA = @HAVE_ALSA@ +HAVE_BITTYPES = @HAVE_BITTYPES@ +HAVE_DIRECTX = @HAVE_DIRECTX@ +HAVE_IFRNEWNAME = @HAVE_IFRNEWNAME@ +HAVE_MKISS = @HAVE_MKISS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTHREAD = @LIBTHREAD@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +M_PI = @M_PI@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USEMMX = @USEMMX@ +USEVIS = @USEVIS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WIN32 = @WIN32@ +WINDRES = @WINDRES@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CFLAGS = @XML_CFLAGS@ +XML_LIBS = @XML_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +INCLUDES = -I$(top_srcdir)/soundcard -I$(top_srcdir)/libmisc -I$(top_srcdir)/matlib +noinst_LIBRARIES = libpam.a +#dnl sbin_PROGRAMS +libpam_a_SOURCES = pammodem.c +meas_SOURCES = meas.c +meas_LDADD = ../libmisc/libmisc.a ../matlib/libmat.a +genpamtbl_SOURCES = genpamtbl.c +genpamtbl_LDADD = ../matlib/libmat.a +noinst_HEADERS = \ + meas.h \ + pam.h \ + pamtbl.h + +@WIN32_FALSE@MEASPROG = meas +@WIN32_TRUE@MEASPROG = +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu pammodem/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu pammodem/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libpam.a: $(libpam_a_OBJECTS) $(libpam_a_DEPENDENCIES) + -rm -f libpam.a + $(libpam_a_AR) libpam.a $(libpam_a_OBJECTS) $(libpam_a_LIBADD) + $(RANLIB) libpam.a + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) +genpamtbl$(EXEEXT): $(genpamtbl_OBJECTS) $(genpamtbl_DEPENDENCIES) + @rm -f genpamtbl$(EXEEXT) + $(LINK) $(genpamtbl_OBJECTS) $(genpamtbl_LDADD) $(LIBS) +meas$(EXEEXT): $(meas_OBJECTS) $(meas_DEPENDENCIES) + @rm -f meas$(EXEEXT) + $(LINK) $(meas_OBJECTS) $(meas_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genpamtbl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/meas.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pammodem.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES clean-noinstPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am + + +@CROSSCOMP_FALSE@$(srcdir)/pamtbl.h: genpamtbl$(EXEEXT) +@CROSSCOMP_FALSE@ ./genpamtbl > $@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/pammodem/genpamtbl.c b/pammodem/genpamtbl.c new file mode 100644 index 0000000..a466f4d --- /dev/null +++ b/pammodem/genpamtbl.c @@ -0,0 +1,367 @@ +/*****************************************************************************/ + +/* + * genpamtbl.c -- Channel simulator for the PAM channel. + * + * Copyright (C) 1999-2000 Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please note that the GPL allows you to use the driver, NOT the radio. + * In order to use the radio, you need a license from the communications + * authority of your country. + * + */ + +/*****************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "pam.h" + +#include "mat.h" + +#include +#include + +/* ---------------------------------------------------------------------- */ + +/* + * Maximum length shift register connections + * (cf. Proakis, Digital Communications, p. 399 + * + * 2 1,2 + * 3 1,3 + * 4 1,4 + * 5 1,4 + * 6 1,6 + * 7 1,7 + * 8 1,5,6,7 + * 9 1,6 + * 10 1,8 + * 11 1,10 + * 12 1,7,9,12 + * 13 1,10,11,13 + * 14 1,5,9,14 + * 15 1,15 + * 16 1,5,14,16 + * 17 1,15 + * 18 1,12 + */ + +#define TAP_2 ((1<<1)|(1<<0)) +#define TAP_3 ((1<<2)|(1<<0)) +#define TAP_4 ((1<<3)|(1<<0)) +#define TAP_5 ((1<<4)|(1<<1)) +#define TAP_6 ((1<<5)|(1<<0)) +#define TAP_7 ((1<<6)|(1<<0)) +#define TAP_8 ((1<<7)|(1<<3)|(1<<2)|(1<<1)) +#define TAP_9 ((1<<8)|(1<<3)) +#define TAP_10 ((1<<9)|(1<<2)) +#define TAP_11 ((1<<10)|(1<<1)) +#define TAP_12 ((1<<11)|(1<<5)|(1<<3)|(1<<0)) +#define TAP_13 ((1<<12)|(1<<3)|(1<<2)|(1<<0)) +#define TAP_14 ((1<<13)|(1<<9)|(1<<5)|(1<<0)) +#define TAP_15 ((1<<14)|(1<<0)) +#define TAP_16 ((1<<15)|(1<<11)|(1<<2)|(1<<0)) +#define TAP_17 ((1<<16)|(1<<2)) +#define TAP_18 ((1<<17)|(1<<6)) + +#define MASK_2 ((1<<2)-1) +#define MASK_3 ((1<<3)-1) +#define MASK_4 ((1<<4)-1) +#define MASK_5 ((1<<5)-1) +#define MASK_6 ((1<<6)-1) +#define MASK_7 ((1<<7)-1) +#define MASK_8 ((1<<8)-1) +#define MASK_9 ((1<<9)-1) +#define MASK_10 ((1<<10)-1) +#define MASK_11 ((1<<11)-1) +#define MASK_12 ((1<<12)-1) +#define MASK_13 ((1<<13)-1) +#define MASK_14 ((1<<14)-1) +#define MASK_15 ((1<<15)-1) +#define MASK_16 ((1<<16)-1) +#define MASK_17 ((1<<17)-1) +#define MASK_18 ((1<<18)-1) + +#define TAPS TAP_5 +#define MASK MASK_5 + +/* ---------------------------------------------------------------------- */ + +extern __inline__ unsigned int hweight32(unsigned int w) +{ + unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555); + res = (res & 0x33333333) + ((res >> 2) & 0x33333333); + res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F); + res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF); + return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF); +} + +/* ---------------------------------------------------------------------- */ + +static int frmatprintf(FILE *f, const char *name, unsigned int size1, unsigned int stride1, + unsigned int size2, unsigned int stride2, const float *m) +{ + unsigned int i, j; + int ret = 0; + + fprintf(f, "%s = [", name); + for (i = 0; i < size1; i++) { + for (j = 0; j < size2; j++) + ret += fprintf(f, " %g", m[i*stride1 + j*stride2]); + if (i+1 < size1) + ret += fprintf(f, " ;\n "); + } + ret += fprintf(f, " ];\n"); + return ret; +} + +static void gentrain(FILE *f) +{ + unsigned int pn = 0xaaaaaaaa; + int trsym[2*TRAINBITS]; + int sum; + unsigned int i, j, new; + float ma[OBSTRAINBITS*CHANNELLEN], mat[CHANNELLEN*OBSTRAINBITS], mata[CHANNELLEN*CHANNELLEN]; + float matainv[CHANNELLEN*CHANNELLEN], matainvat[CHANNELLEN*OBSTRAINBITS]; + + fprintf(f, "/*\n trsym = ["); + for (sum = i = 0; i < TRAINBITS; i++) { + new = hweight32(pn & TAPS) & 1; + pn = ((pn << 1) | new) & MASK; + if (i == TRAINBITS-1) + new = sum < 0; + trsym[i+TRAINBITS] = trsym[i] = -((-new) | 1); + sum += trsym[i]; + fprintf(f, " %d", trsym[i]); + } + fprintf(f, " ];\n trsymcc = ["); + for (i = 0; i < TRAINBITS; i++) { + for (sum = 0, j = 0; j < TRAINBITS; j++) + sum += trsym[j] * trsym[i+j]; + fprintf(f, " %d", sum); + } + fprintf(f, " ];\n"); + for (i = 0; i < OBSTRAINBITS; i++) + for (j = 0; j < CHANNELLEN; j++) + ma[i*CHANNELLEN+j] = trsym[i+j]; + frmatprintf(f, "a", OBSTRAINBITS, CHANNELLEN, CHANNELLEN, 1, ma); + /* transpose it */ + frtranspose(mat, ma, OBSTRAINBITS, CHANNELLEN); + frmul(mata, mat, ma, CHANNELLEN, OBSTRAINBITS, CHANNELLEN); + frinv(matainv, mata, CHANNELLEN); + frmul(matainvat, matainv, mat, CHANNELLEN, CHANNELLEN, OBSTRAINBITS); + frmatprintf(f, "atainvat", CHANNELLEN, OBSTRAINBITS, OBSTRAINBITS, 1, matainvat); + fprintf(f, " */\n\n"); + /* generate C code */ + fprintf(f, "static const unsigned char trainsymbmap[%u] = {\n\t", (TRAINBITS+7) / 8); + for (i = 0;;) { + for (new = j = 0; j < 8; j++) + if (trsym[i+j] > 0) + new |= 1 << j; + fprintf(f, "0x%02x", new); + i += 8; + if (i >= TRAINBITS) + break; + fprintf(f, ", "); + } + fprintf(f, "\n};\n\nstatic const int trainsyms[%u] = {\n\t", TRAINBITS); + for (i = 0;;) { + fprintf(f, "%d", trsym[i]); + if ((++i) >= TRAINBITS) + break; + if (!(i & 15)) { + fprintf(f, ",\n\t"); + continue; + } + fprintf(f, ", "); + } + fprintf(f, "\n};\n\nstatic const int trainmat[%u] = {\n", CHANNELLEN*OBSTRAINBITS); + for (i = 0; i < CHANNELLEN; i++) { + fprintf(f, "\t"); + for (j = 0; j < OBSTRAINBITS; j++) { + fprintf(f, "%d", (int)((1 << 16) * matainvat[i*OBSTRAINBITS+j])); + if (i == CHANNELLEN-1 && j == OBSTRAINBITS-1) + continue; + if ((j & 7) == 7 && j != OBSTRAINBITS-1) { + fprintf(f, ",\n\t"); + continue; + } + fprintf(f, ", "); + } + fprintf(f, "\n"); + } + fprintf(f, "};\n\n"); + /* calculate MLSE root and toor node */ + for (i = j = 0; i < CHANNELLEN-1; i++) + if (trsym[TRAINBITS-1-i] > 0) + j |= 1 << i; + fprintf(f, "#define MLSEROOTNODE 0x%x\n", j); + for (i = j = 0; i < CHANNELLEN-1; i++) + if (trsym[CHANNELLEN-2-i] > 0) + j |= 1 << i; + fprintf(f, "#define MLSETOORNODE 0x%x\n\n", j); +} + +#define TXRCOSALPHA 0.4 +#define RXRCOSALPHA 0.4 + +#define TXFILTERRELAX 1.4 +#define RXFILTERRELAX 1.4 + +static inline double sinc(double x) +{ + double arg = x * M_PI; + + if (fabs(arg) < 1e-10) + return 1; + return sin(arg) / arg; +} + +static inline double hamming(double x) +{ + return 0.54-0.46*cos((2*M_PI)*x); +} + +static void gentxfilt(FILE *f) +{ + float coeff[TXFILTLEN * TXFILTOVER]; + double tmul, at, t, f1, f2; + int i, j; + + tmul = 1.0 / TXFILTOVER; +#if 0 + tmul *= TXFILTERRELAX; + for (i = 0; i < TXFILTLEN * TXFILTOVER; i++) + coeff[i] = sinc((i - 0.5 * TXFILTLEN * TXFILTOVER)*tmul) + * hamming(i * (1.0 / (TXFILTLEN * TXFILTOVER - 1))); +#else + for (i = 0; i < TXFILTLEN * TXFILTOVER; i++) { + t = (i - 0.5 * TXFILTLEN * TXFILTOVER) * tmul; + at = t * TXRCOSALPHA; + f1 = 1 - 4 * at * at; + if (fabs(f1) < 1e-10) + f2 = M_PI * (1.0 / 8.0) * sin(M_PI * at) / at; + else + f2 = cos(M_PI * at) / f1; + coeff[i] = sinc(t) * f2; + } +#endif + for (f1 = 0, i = 0; i < TXFILTOVER; i++) { + for (f2 = 0, j = 0; j < TXFILTLEN; j++) + f2 += fabs(coeff[j*TXFILTOVER+i]); + if (f2 > f1) + f1 = f2; + } + f2 = 32767 / f1; + fprintf(f, "/*\n txfilt = ["); + for (i = 0;;) { + fprintf(f, " %g ;", coeff[i]); + if ((++i) >= TXFILTLEN * TXFILTOVER) + break; + if (i & 3) + continue; + fprintf(f, "\n "); + } + fprintf(f, " ];\n abssum = %g;\n semilogy((0:%u)/%u,abs(fft(txfilt)))\n */\n\nstatic const int txfilter[%u][%u] = {", + f1, TXFILTLEN * TXFILTOVER - 1, TXFILTLEN * TXFILTOVER, TXFILTOVER, TXFILTLEN); + for (i = 0;;) { + fprintf(f, "\n\t{"); + for (j = 0;;) { + fprintf(f, " %d", (int)(f2 * coeff[j*TXFILTOVER+i])); + if ((++j) >= TXFILTLEN) + break; + fprintf(f, ","); + } + fprintf(f, " }"); + if ((++i) >= TXFILTOVER) + break; + fprintf(f, ","); + } + fprintf(f, "\n};\n\n"); +} + +static void genrxfilt(FILE *f) +{ + float coeff[RXFILTLEN * RXFILTOVER]; + double tmul, at, t, f1, f2; + int i, j; + + tmul = 1.0 * BITRATE / RXFILTOVER / SAMPLERATE; +#if 1 + tmul *= RXFILTERRELAX; + for (i = 0; i < RXFILTLEN * RXFILTOVER; i++) + coeff[i] = sinc((i - 0.5 * RXFILTLEN * RXFILTOVER)*tmul) + * hamming(i * (1.0 / (RXFILTLEN * RXFILTOVER - 1))); +#else + for (i = 0; i < RXFILTLEN * RXFILTOVER; i++) { + t = (i - 0.5 * RXFILTLEN * RXFILTOVER) * tmul; + at = t * RXRCOSALPHA; + f1 = 1 - 4 * at * at; + if (fabs(f1) < 1e-10) + f2 = M_PI * (1.0 / 8.0) * sin(M_PI * at) / at; + else + f2 = cos(M_PI * at) / f1; + coeff[i] = sinc(t) * f2; + } +#endif + for (f1 = 0, i = 0; i < RXFILTOVER; i++) { + for (f2 = 0, j = 0; j < RXFILTLEN; j++) + f2 += fabs(coeff[j*RXFILTOVER+i]); + if (f2 > f1) + f1 = f2; + } + f2 = 65535 / f1; + fprintf(f, "/*\n rxfilt = ["); + for (i = 0;;) { + fprintf(f, " %g ;", coeff[i]); + if ((++i) >= RXFILTLEN * RXFILTOVER) + break; + if (i & 3) + continue; + fprintf(f, "\n "); + } + fprintf(f, " ];\n abssum = %g;\n semilogy((0:%u)/%u,abs(fft(rxfilt)))\n */\n\nstatic const int rxfilter[%u][%u] = {", + f1, RXFILTLEN * RXFILTOVER - 1, RXFILTLEN * RXFILTOVER, RXFILTOVER, RXFILTLEN); + for (i = 0;;) { + fprintf(f, "\n\t{"); + for (j = 0;;) { + fprintf(f, " %d", (int)(f2 * coeff[j*RXFILTOVER+i])); + if ((++j) >= RXFILTLEN) + break; + fprintf(f, ","); + } + fprintf(f, " }"); + if ((++i) >= RXFILTOVER) + break; + fprintf(f, ","); + } + fprintf(f, "\n};\n\n"); +} + + +/* ---------------------------------------------------------------------- */ + +int main(int argc, char *argv[]) +{ + gentrain(stdout); + gentxfilt(stdout); + genrxfilt(stdout); + return 0; +} diff --git a/pammodem/meas.c b/pammodem/meas.c new file mode 100644 index 0000000..aac878f --- /dev/null +++ b/pammodem/meas.c @@ -0,0 +1,462 @@ +/*****************************************************************************/ + +/* + * meas.c -- Measurement utility for the PAM channel. + * + * Copyright (C) 1998 Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please note that the GPL allows you to use the driver, NOT the radio. + * In order to use the radio, you need a license from the communications + * authority of your country. + * + */ + +/*****************************************************************************/ + +#include "meas.h" + +#ifdef HAVE_STROPTS_H +#include +#endif +#ifdef HAVE_SYS_CONF_H +#include +#endif +#ifdef HAVE_SYS_IOCTL_H +#include +#endif +#ifdef HAVE_SYS_AUDIOIO_H +#include +#endif +#ifdef HAVE_SYS_SOUNDCARD_H +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "getopt.h" + +#include "mat.h" + +/* ---------------------------------------------------------------------- */ + +//#define SAMPLERATE 9600 +#define SAMPLERATE 11025 +//#define SAMPLERATE 19200 + +/* ---------------------------------------------------------------------- */ + +static int done = 0; + +/* ---------------------------------------------------------------------- */ +/* + * Linux OSS audio + */ + +#if defined(HAVE_SYS_SOUNDCARD_H) + +static char *soundpath = "/dev/dsp"; + +int sound_init(int sample_rate, int *sr) +{ + int fd, sndparam; + + fprintf(stderr, "sound: starting \"%s\"\n", soundpath); + if ((fd = open(soundpath, O_RDWR)) < 0) { + fprintf(stderr, "sound: Error, cannot open \"%s\"\n", soundpath); + return -1; + } + sndparam = AFMT_S16_LE; /* we want 16 bits/sample signed */ + /* little endian; works only on little endian systems! */ + if (ioctl(fd, SNDCTL_DSP_SETFMT, &sndparam) == -1) { + fprintf(stderr, "sound: Error, cannot set sample size\n"); + return -1; + } + if (sndparam != AFMT_S16_LE) { + fprintf(stderr, "sound: Error, cannot set sample size to 16 bits\n"); + return -1; + } + sndparam = 0; /* we want only 1 channel */ + if (ioctl(fd, SNDCTL_DSP_STEREO, &sndparam) == -1) { + fprintf(stderr, "sound: Error, cannot set the channel number\n"); + return -1; + } + if (sndparam != 0) { + fprintf(stderr, "sound: Error, cannot set the channel number to 1\n"); + return -1; + } + sndparam = sample_rate; + if(ioctl(fd, SNDCTL_DSP_SPEED, &sndparam) == -1) { + fprintf(stderr, "sound: Error, cannot set the sample " + "rate\n"); + return -1; + } + if (sr) + *sr = sndparam; + return fd; +} + +/* ---------------------------------------------------------------------- */ +/* + * Sun audio + */ + +#elif defined(HAVE_SYS_AUDIOIO_H) + +static char *soundpath = "/dev/audio"; + +int sound_init(int sample_rate, int *sr) +{ + audio_info_t audioinfo; + audio_info_t audioinfo2; + audio_device_t audiodev; + int fd; + + fprintf(stderr, "sound: starting \"%s\"\n", soundpath); + if ((fd = open(soundpath, O_RDWR)) < 0) { + fprintf(stderr, "sound: Error, cannot open \"%s\"\n", soundpath); + return -1; + } + if (ioctl(fd, AUDIO_GETDEV, &audiodev) == -1) { + fprintf(stderr, "sound: Error, cannot get audio dev\n"); + return -1; + } + fprintf(stderr, "sound: Audio device: name %s, ver %s, config %s\n", + audiodev.name, audiodev.version, audiodev.config); + AUDIO_INITINFO(&audioinfo); + audioinfo.play.sample_rate = audioinfo.record.sample_rate = sample_rate; + audioinfo.play.channels = audioinfo.record.channels = 1; + audioinfo.play.precision = audioinfo.record.precision = 16; + audioinfo.play.encoding = audioinfo.record.encoding = AUDIO_ENCODING_LINEAR; + //audioinfo.record.gain = 0x20; + audioinfo.record.port = AUDIO_LINE_IN; + //audioinfo.monitor_gain = 0; + if (ioctl(fd, AUDIO_SETINFO, &audioinfo) == -1) { + fprintf(stderr, "sound: Error, cannot set audio params\n"); + return -1; + } + if (ioctl(fd, I_FLUSH, FLUSHR) == -1) { + fprintf(stderr, "sound: Error, cannot flush\n"); + return -1; + } + if (ioctl(fd, AUDIO_GETINFO, &audioinfo2) == -1) { + fprintf(stderr, "sound: Error, cannot set audio params\n"); + return -1; + } + if (sr) + *sr = audioinfo.record.sample_rate; + return fd; +} + +#endif + +/* --------------------------------------------------------------------- */ +/* + * Maximum length shift register connections + * (cf. Proakis, Digital Communications, p. 399 + * + * 2 1,2 + * 3 1,3 + * 4 1,4 + * 5 1,4 + * 6 1,6 + * 7 1,7 + * 8 1,5,6,7 + * 9 1,6 + * 10 1,8 + * 11 1,10 + * 12 1,7,9,12 + * 13 1,10,11,13 + * 14 1,5,9,14 + * 15 1,15 + * 16 1,5,14,16 + * 17 1,15 + * 18 1,12 + */ + +#define TAP_2 ((1<<1)|(1<<0)) +#define TAP_3 ((1<<2)|(1<<0)) +#define TAP_4 ((1<<3)|(1<<0)) +#define TAP_5 ((1<<4)|(1<<1)) +#define TAP_6 ((1<<5)|(1<<0)) +#define TAP_7 ((1<<6)|(1<<0)) +#define TAP_8 ((1<<7)|(1<<3)|(1<<2)|(1<<1)) +#define TAP_9 ((1<<8)|(1<<3)) +#define TAP_10 ((1<<9)|(1<<2)) +#define TAP_11 ((1<<10)|(1<<1)) +#define TAP_12 ((1<<11)|(1<<5)|(1<<3)|(1<<0)) +#define TAP_13 ((1<<12)|(1<<3)|(1<<2)|(1<<0)) +#define TAP_14 ((1<<13)|(1<<9)|(1<<5)|(1<<0)) +#define TAP_15 ((1<<14)|(1<<0)) +#define TAP_16 ((1<<15)|(1<<11)|(1<<2)|(1<<0)) +#define TAP_17 ((1<<16)|(1<<2)) +#define TAP_18 ((1<<17)|(1<<6)) + +#define MASK_2 ((1<<2)-1) +#define MASK_3 ((1<<3)-1) +#define MASK_4 ((1<<4)-1) +#define MASK_5 ((1<<5)-1) +#define MASK_6 ((1<<6)-1) +#define MASK_7 ((1<<7)-1) +#define MASK_8 ((1<<8)-1) +#define MASK_9 ((1<<9)-1) +#define MASK_10 ((1<<10)-1) +#define MASK_11 ((1<<11)-1) +#define MASK_12 ((1<<12)-1) +#define MASK_13 ((1<<13)-1) +#define MASK_14 ((1<<14)-1) +#define MASK_15 ((1<<15)-1) +#define MASK_16 ((1<<16)-1) +#define MASK_17 ((1<<17)-1) +#define MASK_18 ((1<<18)-1) + +#define TAPS TAP_15 +#define MASK MASK_15 + +/* ---------------------------------------------------------------------- */ + +extern __inline__ unsigned int hweight32(unsigned int w) +{ + unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555); + res = (res & 0x33333333) + ((res >> 2) & 0x33333333); + res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F); + res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF); + return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF); +} + +/* ---------------------------------------------------------------------- */ + +#define TXBUFSZ 256 + +static struct txstate { + unsigned int scram; + unsigned int txwr, txrd; + int16_t txbuf[TXBUFSZ]; +} txstate = { 1, }; + +static void transmit(int fd, struct txstate *t) +{ + int ret; + unsigned int i, new; + + if (t->txrd >= t->txwr) { + t->txrd = 0; + t->txwr = TXBUFSZ; + for (i = 0; i < TXBUFSZ; i++) { + new = hweight32(t->scram & TAPS) & 1; + t->scram = ((t->scram << 1) | new) & MASK; + t->txbuf[i] = new ? 32000 : -32000; + } + } + ret = write(fd, &t->txbuf[t->txrd], (t->txwr - t->txrd) * sizeof(t->txbuf[0])); + if (ret < 0) { + perror("write"); + exit(1); + } + t->txrd += ret / sizeof(t->txbuf[0]); +} + +/* ---------------------------------------------------------------------- */ + +#define RXBUFSZ (4*TXBUFSZ) + +static struct rxstate { + unsigned int rxwr; + int16_t rxbuf[RXBUFSZ]; +} rxstate = { 0, }; + +static void receive(int fd, struct rxstate *r) +{ + int ret; + + ret = read(fd, &r->rxbuf[r->rxwr], (RXBUFSZ - r->rxwr) * sizeof(r->rxbuf[0])); + if (ret < 0) { + if (errno == EAGAIN || errno == EINTR) + return; + perror("read"); + exit(1); + } + r->rxwr = (r->rxwr + ret / sizeof(r->rxbuf[0])) % RXBUFSZ; +} + +/* ---------------------------------------------------------------------- */ + +RETSIGTYPE sigterm() +{ + done = 1; +} + +/* ---------------------------------------------------------------------- */ + +static int frmatprintf(const char *name, unsigned int size1, unsigned int stride1, + unsigned int size2, unsigned int stride2, const float *m) +{ + unsigned int i, j; + int ret = 0; + + fprintf(stdout, "%s = [", name); + for (i = 0; i < size1; i++) { + for (j = 0; j < size2; j++) + ret += fprintf(stdout, " %g", m[i*stride1 + j*stride2]); + if (i+1 < size1) + ret += fprintf(stdout, " ;\n "); + } + ret += fprintf(stdout, " ];\n"); + return ret; +} + +static int crosscorr(int16_t *data, unsigned int scram) +{ + unsigned int i, new, sum = 0; + + for (i = 0; i < RXBUFSZ; i++, data++) { + new = hweight32(scram & TAPS) & 1; + scram = ((scram << 1) | new) & MASK; + if (new) + sum += *data; + else + sum -= *data; + } + return sum; +} + +#define CHLEN 64 +#define OBSLEN 512 + +static void processrx(struct rxstate *rxs) +{ + int16_t rxbuf[RXBUFSZ]; + unsigned int i, j, new, pnreg, pnreg2; + int maxv, corrv; + float ma[OBSLEN*CHLEN], mat[CHLEN*OBSLEN], mata[CHLEN*CHLEN], matainv[CHLEN*CHLEN], mr[OBSLEN], matr[CHLEN], mc[CHLEN]; + + memcpy(rxbuf, &rxs->rxbuf[rxs->rxwr], (RXBUFSZ-rxs->rxwr) * sizeof(rxbuf[0])); + memcpy(rxbuf + (RXBUFSZ-rxs->rxwr), rxs->rxbuf, rxs->rxwr * sizeof(rxbuf[0])); + /* print received vector */ + printf("rxvec = [\n"); + for (i = 0; i < RXBUFSZ; i++) + printf(" %6d\n", (int)rxbuf[i]); + printf("];\n\n"); + /* calculate and print code correlation */ + printf("codecorr = [\n"); + maxv = 0; + pnreg2 = pnreg = 1; + do { + corrv = crosscorr(rxbuf, pnreg); + if (abs(corrv) > abs(maxv)) { + maxv = corrv; + pnreg2 = pnreg; + } + printf(" %d\n", corrv); + new = hweight32(pnreg & TAPS) & 1; + pnreg = ((pnreg << 1) | new) & MASK; + } while (pnreg != 1); + printf("];\n\n"); + if (maxv < 0) + printf("%% channel seems to be inverted\n\n"); + /* build and print A matrix */ + for (i = 0; i < OBSLEN; i++) { + pnreg = pnreg2; + for (j = 0; j < CHLEN; j++) { + new = hweight32(pnreg & TAPS) & 1; + pnreg = ((pnreg << 1) | new) & MASK; + ma[i*CHLEN+j] = new ? 1 : -1; + } + new = hweight32(pnreg2 & TAPS) & 1; + pnreg2 = ((pnreg2 << 1) | new) & MASK; + } + frmatprintf("a", OBSLEN, CHLEN, CHLEN, 1, ma); + /* transpose it */ + frtranspose(mat, ma, OBSLEN, CHLEN); + frmatprintf("at", CHLEN, OBSLEN, OBSLEN, 1, mat); + frmul(mata, mat, ma, CHLEN, OBSLEN, CHLEN); + frmatprintf("ata", CHLEN, CHLEN, CHLEN, 1, mata); + frinv(matainv, mata, CHLEN); + frmatprintf("atainv", CHLEN, CHLEN, CHLEN, 1, matainv); + /* build received vector */ + for (i = 0; i < OBSLEN; i++) + mr[i] = rxbuf[CHLEN/2+i]; + frmatprintf("r", 1, 0, OBSLEN, 1, mr); + frmul(matr, mat, mr, CHLEN, OBSLEN, 1); + frmatprintf("atr", 1, 0, CHLEN, 1, matr); + frmul(mc, matainv, matr, CHLEN, CHLEN, 1); + frmatprintf("mc", 1, 0, CHLEN, 1, mc); + printf("%%\nmcf = fft(mc) / sqrt(sum(mc .* mc));\nsemilogy((0:size(mcf,2)-1)/size(mcf,2)*9600,abs(mcf));\n"); +} + +/* ---------------------------------------------------------------------- */ + +#define OUTBUFSIZE 1024 +#define INBUFSIZE 65536 + +int main(int argc, char *argv[]) +{ + static const struct option long_options[] = { + {0, 0, 0, 0} + }; + struct pollfd pfd[1]; + int fd, i, c; + + while ((c = getopt_long (argc, argv, "", long_options, NULL)) != EOF) { + switch (c) { + default: + fprintf(stderr, "usage: meas \n"); + exit(1); + } + } + if ((fd = sound_init(SAMPLERATE, &c)) == -1) { + fprintf(stderr, "Cannot open sound interface\n"); + exit(1); + } + fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK); + printf("%% Sampling rate requested %d, actual %d\n", SAMPLERATE, c); + signal(SIGTERM, sigterm); + signal(SIGHUP, sigterm); + signal(SIGINT, sigterm); + signal(SIGQUIT, sigterm); + do { + pfd[0].fd = fd; + pfd[0].events = POLLIN | POLLOUT; + i = poll(pfd, 1, 1000); + if (i < 0) { + if (errno == EINTR) + break; + perror("poll"); + exit(1); + } + if (!i || !(pfd[0].revents & (POLLIN | POLLOUT))) { + fprintf(stderr, "poll timeout\n"); + exit(1); + } + if (pfd[0].revents & POLLIN) + receive(fd, &rxstate); + if (pfd[0].revents & POLLOUT) + transmit(fd, &txstate); + } while (!done); + processrx(&rxstate); + close(fd); + exit(0); +} diff --git a/pammodem/meas.h b/pammodem/meas.h new file mode 100644 index 0000000..09b3bf2 --- /dev/null +++ b/pammodem/meas.h @@ -0,0 +1,72 @@ +/*****************************************************************************/ + +/* + * meas.h -- Measurement utility. + * + * Copyright (C) 1999 Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please note that the GPL allows you to use the driver, NOT the radio. + * In order to use the radio, you need a license from the communications + * authority of your country. + * + */ + +/*****************************************************************************/ + +#ifndef _MEAS_H +#define _MEAS_H + +/* ---------------------------------------------------------------------- */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +/* ---------------------------------------------------------------------- */ + +/* + * Bittypes + */ + +#ifndef HAVE_BITTYPES + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) +typedef int int8_t __attribute__((__mode__(__QI__))); +typedef unsigned int u_int8_t __attribute__((__mode__(__QI__))); +typedef int int16_t __attribute__((__mode__(__HI__))); +typedef unsigned int u_int16_t __attribute__((__mode__(__HI__))); +typedef int int32_t __attribute__((__mode__(__SI__))); +typedef unsigned int u_int32_t __attribute__((__mode__(__SI__))); +typedef int int64_t __attribute__((__mode__(__DI__))); +typedef unsigned int u_int64_t __attribute__((__mode__(__DI__))); +#else +typedef char /* deduced */ int8_t __attribute__((__mode__(__QI__))); +typedef unsigned char /* deduced */ u_int8_t __attribute__((__mode__(__QI__))); +typedef short /* deduced */ int16_t __attribute__((__mode__(__HI__))); +typedef unsigned short /* deduced */ u_int16_t __attribute__((__mode__(__HI__))); +typedef long /* deduced */ int32_t __attribute__((__mode__(__SI__))); +typedef unsigned long /* deduced */ u_int32_t __attribute__((__mode__(__SI__))); +typedef long long /* deduced */ int64_t __attribute__((__mode__(__DI__))); +typedef unsigned long long /* deduced */ u_int64_t __attribute__((__mode__(__DI__))); +#endif + +#endif /* !HAVE_BITTYPES */ + +/* ---------------------------------------------------------------------- */ +#endif /* _MEAS_H */ diff --git a/pammodem/pam.h b/pammodem/pam.h new file mode 100644 index 0000000..2b7f78c --- /dev/null +++ b/pammodem/pam.h @@ -0,0 +1,63 @@ +/*****************************************************************************/ + +/* + * pam.h -- Defines for the PAM modem. + * + * Copyright (C) 1999 Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please note that the GPL allows you to use the driver, NOT the radio. + * In order to use the radio, you need a license from the communications + * authority of your country. + * + */ + +/*****************************************************************************/ + +#ifndef _PAM_H +#define _PAM_H + +/* ---------------------------------------------------------------------- */ + +#include "modem.h" + +/* ---------------------------------------------------------------------- */ + +#define SAMPLERATE 22050 +//#define SAMPLERATE 19200 +#define BITRATE 9600 +#define TRAINBITS 32 +#define OBSTRAINBITS (TRAINBITS-CHANNELLEN+1) +#define DATABYTES 64 +#define DATABITS (DATABYTES * 8) +#define CHANNELLEN 8 + +/* TxFilter */ +#define TXFILTLEN 16 +#define TXFILTOVERBITS 4 +#define TXFILTOVER (1<<(TXFILTOVERBITS)) +#define TXFILTFIDX(x) (((x)>>(16-(TXFILTOVERBITS)))&(TXFILTOVER-1)) +#define TXFILTFSAMP(x) ((x)>>16) + +/* RxFilter */ +#define RXFILTLEN 32 +#define RXFILTOVERBITS 3 +#define RXFILTOVER (1<<(RXFILTOVERBITS)) +#define RXFILTFIDX(x) (((x)>>(16-(RXFILTOVERBITS)))&(RXFILTOVER-1)) +#define RXFILTFSAMP(x) ((x)>>16) + +/* ---------------------------------------------------------------------- */ +#endif /* _PAM_H */ diff --git a/pammodem/pammodem.c b/pammodem/pammodem.c new file mode 100644 index 0000000..92077a3 --- /dev/null +++ b/pammodem/pammodem.c @@ -0,0 +1,468 @@ +/*****************************************************************************/ + +/* + * pammodem.c -- PAM modem. + * + * Copyright (C) 1999-2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please note that the GPL allows you to use the driver, NOT the radio. + * In order to use the radio, you need a license from the communications + * authority of your country. + * + */ + +/*****************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "pam.h" + +#include "pamtbl.h" + +#include +#include +#include +#include +#include + +/* ---------------------------------------------------------------------- */ + +struct txstate { + struct modemchannel *chan; + unsigned int txphinc; + unsigned int txphase; + unsigned int filter; +}; + +static void txsendbits(struct txstate *tx, unsigned int bits, unsigned int nrbits) +{ + int16_t sbuf[(32*SAMPLERATE+BITRATE-1)/BITRATE]; + int16_t *sptr = sbuf; + unsigned int i, j; + int sum; + const int *coeff; + + while (nrbits > 0) { + if (tx->txphase >= 0x10000) { + tx->txphase &= 0xffff; + tx->filter <<= 1; + tx->filter |= bits & 1; + bits >>= 1; + nrbits--; + } + coeff = txfilter[TXFILTFIDX(tx->txphase)]; + for (j = tx->filter, sum = i = 0; i < TXFILTLEN; i++, j >>= 1, coeff++) + if (j & 1) + sum += *coeff; + else + sum -= *coeff; + //sum -= *coeff ^ (-(j & 1)); + *sptr++ = sum; + tx->txphase += tx->txphinc; + } + audiowrite(tx->chan, sbuf, sptr - sbuf); +} + +static void txsendtrain(struct txstate *tx) +{ + const unsigned char *b = trainsymbmap; + unsigned int cnt = TRAINBITS; + + while (cnt > 8) { + txsendbits(tx, *b++, 8); + cnt -= 8; + } + txsendbits(tx, *b, cnt); +} + +static int txsenddata(struct txstate *tx) +{ + unsigned char buf[DATABYTES]; + unsigned int i; + + if (!pktget(tx->chan, buf, DATABYTES)) + return -1; + for (i = 0; i < DATABYTES; i++) + txsendbits(tx, buf[i], 8); + txsendtrain(tx); + return 0; +} + +static const struct modemparams modparams[] = { + { NULL } + +}; + +static void *modconfig(struct modemchannel *chan, unsigned int *samplerate, const char *params[]) +{ + struct txstate *s; + + if (!(s = calloc(1, sizeof(struct txstate)))) + logprintf(MLOG_FATAL, "out of memory\n"); + s->chan = chan; + *samplerate = SAMPLERATE; + return s; +} + +static void modinit(void *state, unsigned int samplerate) +{ + struct txstate *s = (struct txstate *)state; + + s->txphinc = ((BITRATE << 16) + samplerate / 2) / samplerate; +} + +static void modmodulate(void *state, unsigned int txdelay) +{ + struct txstate *s = (struct txstate *)state; + + txsendtrain(s); + while (!txsenddata(s)); +} + +struct modulator pammodulator = { + NULL, + "pam", + modparams, + modconfig, + modinit, + modmodulate, + free +}; + +/* ---------------------------------------------------------------------- */ + +#define OVERLAP 128 +#define SBUFSIZE 512 + +struct rxstate { + struct modemchannel *chan; + u_int16_t stime; + int16_t rxbuf[SBUFSIZE]; + unsigned int rxphase; + unsigned int rxphaseinc; + unsigned int rxptr; +}; + +extern inline int rxgsfir(const int16_t *buf, const int *coeff) +{ + unsigned int i; + int s; + + for (s = 0, i = 0; i < RXFILTLEN; i++) + s += (*buf--) * (*coeff++); + return s >> 16; +} + +static void rxgetsamples(struct rxstate *rx, int16_t *samples, unsigned int nr, unsigned int tspaced) +{ + unsigned int reqph = (nr * rx->rxphaseinc) << tspaced; + unsigned int endph = rx->rxphase + reqph; + unsigned int phptr = RXFILTFSAMP(rx->rxphase); + unsigned int endptr; + + if ((endph >= (SBUFSIZE << 16)) && (phptr > OVERLAP)) { + phptr -= OVERLAP; + rx->rxptr -= phptr; + memmove(rx->rxbuf, rx->rxbuf + phptr, rx->rxptr * sizeof(rx->rxbuf[0])); + rx->rxphase -= phptr << 16; + endph = rx->rxphase + reqph; + } + if (endph >= (SBUFSIZE << 16)) + logprintf(MLOG_FATAL, "rxgetsamples: too many samples requested\n"); + endptr = RXFILTFSAMP(endph) + 1; + if (endptr > rx->rxptr) { + audioread(rx->chan, rx->rxbuf + rx->rxptr, endptr - rx->rxptr, rx->stime); + rx->stime += endptr - rx->rxptr; + rx->rxptr = endptr; + } + for (; nr > 0; nr--, samples++) { + rx->rxphase += rx->rxphaseinc << tspaced; + *samples = rxgsfir(rx->rxbuf + RXFILTFSAMP(rx->rxphase), rxfilter[RXFILTFIDX(rx->rxphase)]); + } +} + +static void rxrewindsamples(struct rxstate *rx, unsigned int nr, unsigned int tspaced) +{ + unsigned int ph = (nr * rx->rxphaseinc) << tspaced; + + if (ph > rx->rxphase) + logprintf(MLOG_FATAL, "rxrewindsamples: too many samples requested\n"); + rx->rxphase -= ph; +} + +extern inline int calcsync(int *toten, int *corren, int16_t *samples) +{ + const int *tr = trainsyms; + unsigned int i; + int acc1, acc2; + + for (acc1 = acc2 = 0, i = 0; i < TRAINBITS; i++, samples += 2, tr++) { + acc1 += (*tr) * (*samples); + acc2 += ((*samples) * (*samples)) >> 10; + } + acc1 >>= 5; + acc1 *= acc1; + acc1 /= TRAINBITS; + if (toten) + *toten = acc2; + if (corren) + *corren = acc1; + //fprintf(stderr, "Sync energy %d correlation %d\n", acc2, acc1); + if (acc2 < 16*TRAINBITS || acc1*3 < acc2) + return 0; + logprintf(256, "Sync found, energy %d correlation %d\n", acc2, acc1); + return 1; +} + +static void synchunt(struct rxstate *rx, int *channel, int *chenergy, unsigned int dcdcnt) +{ + int16_t syncbuf[4*TRAINBITS+1]; + unsigned int i, j; + int trseq[OBSTRAINBITS], sum, en; + int toten1, toten2, syncen1, syncen2; + const int *p1, *p2; + + rxgetsamples(rx, syncbuf, 4*TRAINBITS+1, 0); + for (;;) { + for (i = 0; i < 2*TRAINBITS; i++) { + if (calcsync(&toten1, &syncen1, syncbuf+i)) { + if (!calcsync(&toten2, &syncen2, syncbuf+i+1) || syncen2 < syncen1) { + rxrewindsamples(rx, 4*TRAINBITS-2*(OBSTRAINBITS-1)-(CHANNELLEN & ~1)-i, 0); + for (j = 0; j < OBSTRAINBITS; j++) + trseq[j] = syncbuf[i+2*j+(CHANNELLEN & ~1)]; + goto syncfound; + } + } + if (dcdcnt > 0) { + dcdcnt--; + if (!dcdcnt) + pktsetdcd(rx->chan, 0); + } + } + memmove(syncbuf, syncbuf+2*TRAINBITS, (2*TRAINBITS+1)*sizeof(syncbuf[0])); + rxgetsamples(rx, syncbuf+(2*TRAINBITS+1), 2*TRAINBITS, 0); + } + syncfound: + for (p1 = trainmat, en = 0, i = 0; i < CHANNELLEN; i++) { + for (sum = 0, p2 = trseq, j = 0; j < OBSTRAINBITS; j++) + sum += (*p1++) * (*p2++); + sum >>= 16; + channel[i] = sum; + en += sum * sum; + } + *chenergy = en; + pktsetdcd(rx->chan, 1); + if (logcheck(256)) { + char buf[512]; + char *sptr; + sptr = buf + sprintf(buf, "Sync found, chenergy %d, dcd %u, channel", en, dcdcnt); + for (i = 0; i < CHANNELLEN; i++) + sptr += sprintf(sptr, " %d", channel[i]); + logprintf(256, "%s\n", buf); + } +} + +/* + * Maximum Likelyhood Sequence Estimation + */ + +#define MLSEENERGYSHIFT 6 +#define MLSENRNODES (1<<((CHANNELLEN)-1)) +#define MLSEHALFNRNODES ((MLSENRNODES)>>1) + +struct mlsenode { + unsigned int metric; +}; + +static inline unsigned int mlsemetric(int diff) +{ + return (diff * diff) >> MLSEENERGYSHIFT; +} + +static void mlsetrellis(struct mlsenode *nptr1, struct mlsenode *nptr2, int16_t *metrictab, unsigned char *backtrack, int val) +{ + unsigned int x0, x1, y0, y1, xm00, xm01, xm10, xm11; + unsigned int m00, m01, m10, m11; + + for (x0 = 0; x0 < MLSEHALFNRNODES; x0++) { + x1 = x0 + MLSEHALFNRNODES; + y0 = x0 << 1; + y1 = y0 | 1; + xm00 = x0 << 1; + xm10 = x1 << 1; + xm01 = xm00 | 1; + xm11 = xm10 | 1; + m00 = nptr1[x0].metric + mlsemetric(val - metrictab[xm00]); + m01 = nptr1[x0].metric + mlsemetric(val - metrictab[xm01]); + m10 = nptr1[x1].metric + mlsemetric(val - metrictab[xm10]); + m11 = nptr1[x1].metric + mlsemetric(val - metrictab[xm11]); +#if 0 + printf("x0 %02x x1 %02x y0 %02x y1 %02x m00 %10u m10 %10u m01 %10u m11 %10u\n", + x0, x1, y0, y1, m00, m10, m01, m11); +#endif + if (m00 < m10) { + nptr2[y0].metric = m00; + backtrack[y0] = x0; + } else { + nptr2[y0].metric = m10; + backtrack[y0] = x1; + } + if (m01 < m11) { + nptr2[y1].metric = m01; + backtrack[y1] = x0; + } else { + nptr2[y1].metric = m11; + backtrack[y1] = x1; + } + } +} + +static unsigned int mlsebacktrack(unsigned char *byte, unsigned int nrbits, unsigned int startnode, unsigned char *backtrack) +{ + unsigned int bshreg = 0; + + for (; nrbits > 0; nrbits--, backtrack -= MLSENRNODES) { + bshreg <<= 1; + bshreg |= startnode & 1; + startnode = backtrack[startnode]; + } + if (byte) + *byte = bshreg; + return startnode; +} + +static void mlseblock(struct rxstate *rx, int *channel) +{ + unsigned int energy = 0; + struct mlsenode nodes[2*MLSENRNODES], *nptr1, *nptr2, *nptr3; + int16_t metrictab[1<> 1; + nptr1[MLSEROOTNODE].metric = 0; + /* MLSE decoder loop */ + for (i = DATABITS+CHANNELLEN-1; i > 0;) { + j = i; + if (j > 8) + j = 8; + i -= j; + rxgetsamples(rx, samp, j, 1); + for (k = 0; k < j; k++) { + energy += mlsemetric(samp[k]); + mlsetrellis(nptr1, nptr2, metrictab, btptr, samp[k]); + nptr3 = nptr1; + nptr1 = nptr2; + nptr2 = nptr3; + btptr += MLSENRNODES; + } + } + rxrewindsamples(rx, CHANNELLEN, 1); + /* backtracking */ + btptr -= MLSENRNODES; + k = mlsebacktrack(msg, (CHANNELLEN-1), MLSETOORNODE, btptr); + btptr -= (CHANNELLEN-1) * MLSENRNODES; + for (i = DATABYTES-1; (signed)i >= 0; i--) { + k = mlsebacktrack(msg+i, 8, k, btptr); + btptr -= 8 * MLSENRNODES; + } + if (k != MLSEROOTNODE) + logprintf(258, "MLSE: uhoh surviving path does not end in root node 0x%x, 0x%x\n", + MLSEROOTNODE, k); +#if 0 + j = 0; + for (i = 1; i < MLSENRNODES; i++) + if (nptr1[i].metric < nptr1[j].metric) + j = i; + if (j != MLSETOORNODE) + logprintf(258, "MLSE: uhoh best metric not at toor node 0x%x, 0x%x (en %u, %u)\n", + MLSETOORNODE, j, nptr1[MLSETOORNODE].metric, nptr1[j].metric); +#endif + pktput(rx->chan, msg, DATABYTES); + logprintf(257, "MLSE: signal energy %u, error energy %u S/(N+D) %5.1fdB\n", + energy, nptr1[MLSETOORNODE].metric, + -10*log10(nptr1[MLSETOORNODE].metric / (double)(energy ? energy : 1))); +} + +static void demoddemodulate(void *state) +{ + struct rxstate *rx = state; + + rx->stime = audiocurtime(rx->chan); + for (;;) { + int chan[CHANNELLEN], en; + synchunt(rx, chan, &en, 20); + mlseblock(rx, chan); + } +} + +static const struct modemparams demodparams[] = { + { NULL } + +}; + +static void *demodconfig(struct modemchannel *chan, unsigned int *samplerate, const char *params[]) +{ + struct rxstate *s; + + if (!(s = calloc(1, sizeof(struct rxstate)))) + logprintf(MLOG_FATAL, "out of memory\n"); + s->chan = chan; + *samplerate = SAMPLERATE; + return s; +} + +static void demodinit(void *state, unsigned int samplerate, unsigned int *bitrate) +{ + struct rxstate *s = (struct rxstate *)state; + + s->rxphaseinc = ((samplerate << 16) + BITRATE) / (2 * BITRATE); + s->rxphase = OVERLAP << 16; + s->rxptr = OVERLAP; + *bitrate = 9600; +} + +struct demodulator pamdemodulator = { + NULL, + "pam", + demodparams, + demodconfig, + demodinit, + demoddemodulate, + free +}; + +/* ---------------------------------------------------------------------- */ diff --git a/pammodem/pamtbl.h b/pammodem/pamtbl.h new file mode 100644 index 0000000..cdfa2c9 --- /dev/null +++ b/pammodem/pamtbl.h @@ -0,0 +1,253 @@ +/* + trsym = [ 1 1 1 -1 1 1 -1 -1 -1 1 1 1 1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 -1 -1 -1 1 -1 1 -1 -1 ]; + trsymcc = [ 32 0 -4 0 -4 4 -4 4 0 -4 4 -4 0 -8 -4 4 0 4 -4 -8 0 -4 4 -4 0 4 -4 4 -4 0 -4 0 ]; +a = [ 1 1 1 -1 1 1 -1 -1 ; + 1 1 -1 1 1 -1 -1 -1 ; + 1 -1 1 1 -1 -1 -1 1 ; + -1 1 1 -1 -1 -1 1 1 ; + 1 1 -1 -1 -1 1 1 1 ; + 1 -1 -1 -1 1 1 1 1 ; + -1 -1 -1 1 1 1 1 1 ; + -1 -1 1 1 1 1 1 -1 ; + -1 1 1 1 1 1 -1 -1 ; + 1 1 1 1 1 -1 -1 1 ; + 1 1 1 1 -1 -1 1 1 ; + 1 1 1 -1 -1 1 1 -1 ; + 1 1 -1 -1 1 1 -1 1 ; + 1 -1 -1 1 1 -1 1 -1 ; + -1 -1 1 1 -1 1 -1 -1 ; + -1 1 1 -1 1 -1 -1 1 ; + 1 1 -1 1 -1 -1 1 -1 ; + 1 -1 1 -1 -1 1 -1 -1 ; + -1 1 -1 -1 1 -1 -1 -1 ; + 1 -1 -1 1 -1 -1 -1 -1 ; + -1 -1 1 -1 -1 -1 -1 1 ; + -1 1 -1 -1 -1 -1 1 -1 ; + 1 -1 -1 -1 -1 1 -1 1 ; + -1 -1 -1 -1 1 -1 1 -1 ; + -1 -1 -1 1 -1 1 -1 -1 ]; +atainvat = [ 0.0572165 0.035571 0.0434153 -0.0443537 0.0151366 0.0507619 -0.0518015 -0.0172795 -0.0453469 0.0400477 0.0324898 0.0496586 0.0226944 0.0636385 -0.0419792 -0.0367959 0.0280132 0.0605841 -0.0412725 0.0389387 -0.0334282 -0.0488303 0.0260621 -0.0132051 -0.0614785 ; + 0.0193683 0.0409242 -0.0516993 0.0314468 0.0573939 -0.0583612 -0.0130789 -0.0403294 0.0646506 0.0269611 0.0377362 0.0301434 0.0466188 -0.0640558 -0.0140098 0.0206717 0.0516993 -0.0592921 0.0346348 -0.0377362 -0.0579886 0.0454099 -0.0320416 -0.0703452 0.006597 ; + 0.0537376 -0.042435 0.0388938 0.0325406 -0.0525663 -0.014739 -0.0472295 0.0626156 0.0212471 0.0355076 0.0390488 0.0572788 -0.0561075 -0.00106646 0.0246333 0.0289994 -0.0388938 0.0571238 -0.0489431 -0.0390488 0.0323857 -0.0454019 -0.0527213 -0.00757458 -0.0692605 ; + -0.0522436 0.0351837 0.0273114 -0.0279467 -0.00926656 -0.0449048 0.06094 0.0268965 0.0536012 0.0432448 0.0521783 -0.04331 -0.0182001 0.00847892 0.0376678 -0.0368802 0.0441172 -0.0681769 -0.0449413 0.0192503 -0.0528136 -0.0360078 -0.0341335 -0.071646 0.050659 ; + 0.0485725 0.0310051 -0.0228655 -0.0400468 -0.0506442 0.0551137 0.0291324 0.048781 0.0225913 0.0457976 -0.0337705 -0.0309956 0.0289239 0.0571948 -0.0460719 0.0395213 -0.048563 -0.0200906 0.0247287 -0.0376581 -0.0291419 -0.0548394 -0.0397392 0.0509185 -0.0632924 ; + 0.027829 -0.0316789 -0.0492649 -0.0322535 0.0565143 0.022172 0.0514346 0.0322646 0.0570916 -0.0339338 -0.0244185 0.0373442 0.046999 -0.056506 0.0417605 -0.0417688 -0.0221637 0.0124978 -0.0395139 -0.0470101 -0.0570999 -0.0299987 0.0316679 -0.064341 0.0524729 ; + -0.0243519 -0.0460423 -0.0316508 0.0382603 0.0260792 0.0414939 0.032004 0.0592659 -0.0338418 -0.0317807 0.0459124 0.0533411 -0.0516138 0.0470654 -0.0337119 -0.0394327 0.0316508 -0.024222 -0.0536943 -0.0459124 -0.0393028 0.0239987 -0.0514839 0.0394134 -0.0544737 ; + -0.0605078 -0.0319618 0.036034 0.0301479 0.0395341 0.0304624 0.0665374 -0.0375767 -0.0244328 0.0402497 0.0361775 -0.0645799 0.0436063 -0.0451057 -0.0286485 0.0342201 -0.036034 -0.0647235 -0.0379914 -0.0361775 0.0300044 -0.0420636 0.0393906 -0.0511353 -0.0126972 ]; + */ + +static const unsigned char trainsymbmap[4] = { + 0x37, 0x3e, 0x4b, 0x28 +}; + +static const int trainsyms[32] = { + 1, 1, 1, -1, 1, 1, -1, -1, -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 const int trainmat[200] = { + 3749, 2331, 2845, -2906, 991, 3326, -3394, -1132, + -2971, 2624, 2129, 3254, 1487, 4170, -2751, -2411, + 1835, 3970, -2704, 2551, -2190, -3200, 1708, -865, + -4029, + 1269, 2682, -3388, 2060, 3761, -3824, -857, -2643, + 4236, 1766, 2473, 1975, 3055, -4197, -918, 1354, + 3388, -3885, 2269, -2473, -3800, 2975, -2099, -4610, + 432, + 3521, -2781, 2548, 2132, -3444, -965, -3095, 4103, + 1392, 2327, 2559, 3753, -3677, -69, 1614, 1900, + -2548, 3743, -3207, -2559, 2122, -2975, -3455, -496, + -4539, + -3423, 2305, 1789, -1831, -607, -2942, 3993, 1762, + 3512, 2834, 3419, -2838, -1192, 555, 2468, -2416, + 2891, -4468, -2945, 1261, -3461, -2359, -2236, -4695, + 3319, + 3183, 2031, -1498, -2624, -3319, 3611, 1909, 3196, + 1480, 3001, -2213, -2031, 1895, 3748, -3019, 2590, + -3182, -1316, 1620, -2467, -1909, -3593, -2604, 3336, + -4147, + 1823, -2076, -3228, -2113, 3703, 1453, 3370, 2114, + 3741, -2223, -1600, 2447, 3080, -3703, 2736, -2737, + -1452, 819, -2589, -3080, -3742, -1965, 2075, -4216, + 3438, + -1595, -3017, -2074, 2507, 1709, 2719, 2097, 3884, + -2217, -2082, 3008, 3495, -3382, 3084, -2209, -2584, + 2074, -1587, -3518, -3008, -2575, 1572, -3374, 2582, + -3569, + -3965, -2094, 2361, 1975, 2590, 1996, 4360, -2462, + -1601, 2637, 2370, -4232, 2857, -2956, -1877, 2242, + -2361, -4241, -2489, -2370, 1966, -2756, 2581, -3351, + -832 +}; + +#define MLSEROOTNODE 0x14 +#define MLSETOORNODE 0x76 + +/* + txfilt = [ -7.89211e-19 ; -0.000169639 ; -0.000356223 ; -0.000549436 ; + -0.000737741 ; -0.000909138 ; -0.001052 ; -0.00115595 ; + -0.00121261 ; -0.00121637 ; -0.00116487 ; -0.00105933 ; + -0.000904593 ; -0.000708972 ; -0.000483741 ; -0.000242448 ; + 1.03876e-18 ; 0.000228389 ; 0.000428328 ; 0.000587364 ; + 0.000696013 ; 0.000748609 ; 0.000743905 ; 0.000685371 ; + 0.000581136 ; 0.000443577 ; 0.000288539 ; 0.000134254 ; + -4.59404e-19 ; -9.5412e-05 ; -0.000135207 ; -0.00010617 ; + 5.46552e-19 ; 0.000185619 ; 0.000446326 ; 0.00077085 ; + 0.00114129 ; 0.0015339 ; 0.00192042 ; 0.00226978 ; + 0.00255019 ; 0.00273144 ; 0.00278726 ; 0.00269755 ; + 0.00245035 ; 0.00204336 ; 0.00148485 ; 0.000793942 ; + -2.59878e-18 ; -0.000858639 ; -0.00173676 ; -0.00258502 ; + -0.00335312 ; -0.00399341 ; -0.0044645 ; -0.00473465 ; + -0.0047848 ; -0.00461084 ; -0.00422493 ; -0.00365583 ; + -0.00294782 ; -0.00215855 ; -0.00135555 ; -0.000611731 ; + 1.30368e-18 ; 0.000412633 ; 0.000571146 ; 0.000438343 ; + -1.37821e-18 ; -0.000731099 ; -0.00171266 ; -0.00287225 ; + -0.00410874 ; -0.00529605 ; -0.00628909 ; -0.00693185 ; + -0.00706721 ; -0.00654822 ; -0.00525007 ; -0.00308225 ; + 6.62539e-18 ; 0.00398561 ; 0.00879986 ; 0.0142994 ; + 0.0202711 ; 0.0264345 ; 0.032449 ; 0.0379254 ; + 0.0424413 ; 0.045561 ; 0.0468577 ; 0.0459391 ; + 0.0424728 ; 0.0362128 ; 0.027024 ; 0.0149038 ; + -2.02159e-17 ; -0.0173775 ; -0.0367505 ; -0.0574747 ; + -0.0787489 ; -0.0996327 ; -0.119072 ; -0.135932 ; + -0.149035 ; -0.157207 ; -0.159322 ; -0.154354 ; + -0.141421 ; -0.119838 ; -0.0891489 ; -0.0491676 ; + 3.34611e-17 ; 0.0579397 ; 0.123925 ; 0.196924 ; + 0.275621 ; 0.358446 ; 0.443618 ; 0.529196 ; + 0.613138 ; 0.693369 ; 0.767845 ; 0.834623 ; + 0.891929 ; 0.938215 ; 0.97222 ; 0.993006 ; + 1 ; 0.993006 ; 0.97222 ; 0.938215 ; + 0.891929 ; 0.834623 ; 0.767845 ; 0.693369 ; + 0.613138 ; 0.529196 ; 0.443618 ; 0.358446 ; + 0.275621 ; 0.196924 ; 0.123925 ; 0.0579397 ; + 3.34611e-17 ; -0.0491676 ; -0.0891489 ; -0.119838 ; + -0.141421 ; -0.154354 ; -0.159322 ; -0.157207 ; + -0.149035 ; -0.135932 ; -0.119072 ; -0.0996327 ; + -0.0787489 ; -0.0574747 ; -0.0367505 ; -0.0173775 ; + -2.02159e-17 ; 0.0149038 ; 0.027024 ; 0.0362128 ; + 0.0424728 ; 0.0459391 ; 0.0468577 ; 0.045561 ; + 0.0424413 ; 0.0379254 ; 0.032449 ; 0.0264345 ; + 0.0202711 ; 0.0142994 ; 0.00879986 ; 0.00398561 ; + 6.62539e-18 ; -0.00308225 ; -0.00525007 ; -0.00654822 ; + -0.00706721 ; -0.00693185 ; -0.00628909 ; -0.00529605 ; + -0.00410874 ; -0.00287225 ; -0.00171266 ; -0.000731099 ; + -1.37821e-18 ; 0.000438343 ; 0.000571146 ; 0.000412633 ; + 1.30368e-18 ; -0.000611731 ; -0.00135555 ; -0.00215855 ; + -0.00294782 ; -0.00365583 ; -0.00422493 ; -0.00461084 ; + -0.0047848 ; -0.00473465 ; -0.0044645 ; -0.00399341 ; + -0.00335312 ; -0.00258502 ; -0.00173676 ; -0.000858639 ; + -2.59878e-18 ; 0.000793942 ; 0.00148485 ; 0.00204336 ; + 0.00245035 ; 0.00269755 ; 0.00278726 ; 0.00273144 ; + 0.00255019 ; 0.00226978 ; 0.00192042 ; 0.0015339 ; + 0.00114129 ; 0.00077085 ; 0.000446326 ; 0.000185619 ; + 5.46552e-19 ; -0.00010617 ; -0.000135207 ; -9.5412e-05 ; + -4.59404e-19 ; 0.000134254 ; 0.000288539 ; 0.000443577 ; + 0.000581136 ; 0.000685371 ; 0.000743905 ; 0.000748609 ; + 0.000696013 ; 0.000587364 ; 0.000428328 ; 0.000228389 ; + 1.03876e-18 ; -0.000242448 ; -0.000483741 ; -0.000708972 ; + -0.000904593 ; -0.00105933 ; -0.00116487 ; -0.00121637 ; + -0.00121261 ; -0.00115595 ; -0.001052 ; -0.000909138 ; + -0.000737741 ; -0.000549436 ; -0.000356223 ; -0.000169639 ; ]; + abssum = 1.6357; + semilogy((0:255)/256,abs(fft(txfilt))) + */ + +static const int txfilter[16][16] = { + { 0, 0, 0, 0, 0, 0, 0, 0, 20032, 0, 0, 0, 0, 0, 0, 0 }, + { -3, 4, 3, -17, 8, 79, -348, 1160, 19892, -984, 298, -61, -12, 15, -2, -4 }, + { -7, 8, 8, -34, 11, 176, -736, 2482, 19475, -1785, 541, -105, -27, 29, -2, -9 }, + { -11, 11, 15, -51, 8, 286, -1151, 3944, 18794, -2400, 725, -131, -43, 40, -1, -14 }, + { -14, 13, 22, -67, 0, 406, -1577, 5521, 17867, -2833, 850, -141, -59, 49, 0, -18 }, + { -18, 14, 30, -79, -14, 529, -1995, 7180, 16719, -3092, 920, -138, -73, 54, 2, -21 }, + { -21, 14, 38, -89, -34, 650, -2385, 8886, 15381, -3191, 938, -125, -84, 55, 5, -23 }, + { -23, 13, 45, -94, -57, 759, -2723, 10601, 13889, -3149, 912, -106, -92, 54, 8, -24 }, + { -24, 11, 51, -95, -82, 850, -2985, 12282, 12282, -2985, 850, -82, -95, 51, 11, -24 }, + { -24, 8, 54, -92, -106, 912, -3149, 13889, 10601, -2723, 759, -57, -94, 45, 13, -23 }, + { -23, 5, 55, -84, -125, 938, -3191, 15381, 8886, -2385, 650, -34, -89, 38, 14, -21 }, + { -21, 2, 54, -73, -138, 920, -3092, 16719, 7180, -1995, 529, -14, -79, 30, 14, -18 }, + { -18, 0, 49, -59, -141, 850, -2833, 17867, 5521, -1577, 406, 0, -67, 22, 13, -14 }, + { -14, -1, 40, -43, -131, 725, -2400, 18794, 3944, -1151, 286, 8, -51, 15, 11, -11 }, + { -9, -2, 29, -27, -105, 541, -1785, 19475, 2482, -736, 176, 11, -34, 8, 8, -7 }, + { -4, -2, 15, -12, -61, 298, -984, 19892, 1160, -348, 79, 8, -17, 3, 4, -3 } +}; + +/* + rxfilt = [ -0.00183249 ; -0.00224264 ; -0.00254037 ; -0.00270819 ; + -0.00273315 ; -0.00260751 ; -0.0023295 ; -0.00190399 ; + -0.00134302 ; -0.000666167 ; 9.94485e-05 ; 0.000919496 ; + 0.00175326 ; 0.00255495 ; 0.00327563 ; 0.00386552 ; + 0.00427687 ; 0.00446707 ; 0.00440189 ; 0.00405866 ; + 0.00342917 ; 0.00252195 ; 0.00136374 ; -2.7396e-17 ; + -0.00150586 ; -0.00307449 ; -0.00461389 ; -0.00602407 ; + -0.00720258 ; -0.00805101 ; -0.00848182 ; -0.00842518 ; + -0.00783541 ; -0.00669643 ; -0.00502577 ; -0.00287682 ; + -0.000338826 ; 0.00246541 ; 0.00538431 ; 0.00824467 ; + 0.0108608 ; 0.0130455 ; 0.0146218 ; 0.0154355 ; + 0.0153672 ; 0.0143427 ; 0.0123418 ; 0.00940433 ; + 0.00563274 ; 0.00119066 ; -0.00370232 ; -0.00877998 ; + -0.0137426 ; -0.0182731 ; -0.0220557 ; -0.024796 ; + -0.0262411 ; -0.0261987 ; -0.0245537 ; -0.0212817 ; + -0.0164569 ; -0.0102554 ; -0.00295155 ; 0.00509153 ; + 0.013438 ; 0.0216007 ; 0.0290676 ; 0.0353316 ; + 0.0399217 ; 0.0424348 ; 0.0425649 ; 0.040129 ; + 0.035087 ; 0.0275541 ; 0.0178046 ; 0.00626695 ; + -0.00649166 ; -0.0197897 ; -0.0328643 ; -0.0449114 ; + -0.055131 ; -0.0627751 ; -0.0671964 ; -0.0678933 ; + -0.0645501 ; -0.0570689 ; -0.0455902 ; -0.0305021 ; + -0.0124346 ; 0.00775961 ; 0.0290392 ; 0.0502208 ; + 0.0700369 ; 0.0872029 ; 0.100489 ; 0.108795 ; + 0.11122 ; 0.107132 ; 0.0962197 ; 0.0785352 ; + 0.0545209 ; 0.0250144 ; -0.00876542 ; -0.0452525 ; + -0.0825884 ; -0.118694 ; -0.151359 ; -0.178337 ; + -0.197457 ; -0.206726 ; -0.204437 ; -0.189263 ; + -0.160341 ; -0.117335 ; -0.0604796 ; 0.00940584 ; + 0.0909221 ; 0.182127 ; 0.280599 ; 0.383516 ; + 0.487767 ; 0.590067 ; 0.687091 ; 0.775607 ; + 0.85261 ; 0.91545 ; 0.961938 ; 0.990444 ; + 0.999965 ; 0.990167 ; 0.9614 ; 0.914683 ; + 0.851658 ; 0.774524 ; 0.685939 ; 0.588913 ; + 0.486676 ; 0.38255 ; 0.279813 ; 0.181566 ; + 0.0906162 ; 0.00937153 ; -0.0602418 ; -0.116841 ; + -0.159619 ; -0.188356 ; -0.203399 ; -0.205617 ; + -0.19634 ; -0.177277 ; -0.150414 ; -0.117919 ; + -0.0820243 ; -0.04493 ; -0.00870032 ; 0.0248211 ; + 0.0540831 ; 0.0778807 ; 0.0953883 ; 0.106174 ; + 0.110191 ; 0.107754 ; 0.0994956 ; 0.0863131 ; + 0.0692999 ; 0.0496761 ; 0.0287148 ; 0.00767039 ; + -0.0122876 ; -0.0301312 ; -0.0450204 ; -0.0563363 ; + -0.0636993 ; -0.066975 ; -0.066264 ; -0.0618819 ; + -0.0543269 ; -0.0442402 ; -0.0323612 ; -0.0194794 ; + -0.00638747 ; 0.006164 ; 0.0175053 ; 0.0270803 ; + 0.0344701 ; 0.0394076 ; 0.0417826 ; 0.0416378 ; + 0.0391556 ; 0.034639 ; 0.0284856 ; 0.021159 ; + 0.0131574 ; 0.00498301 ; -0.00288734 ; -0.0100277 ; + -0.0160841 ; -0.0207898 ; -0.0239748 ; -0.0255687 ; + -0.0255976 ; -0.024176 ; -0.0214935 ; -0.0177983 ; + -0.0133787 ; -0.00854307 ; -0.00360053 ; 0.00115732 ; + 0.00547208 ; 0.00913117 ; 0.0119768 ; 0.013911 ; + 0.0148965 ; 0.0149544 ; 0.0141582 ; 0.0126249 ; + 0.0105049 ; 0.00797008 ; 0.00520214 ; 0.00238071 ; + -0.00032701 ; -0.00277505 ; -0.0048455 ; -0.00645304 ; + -0.00754703 ; -0.00811142 ; -0.00816249 ; -0.00774486 ; + -0.00692624 ; -0.00579115 ; -0.00443436 ; -0.00295427 ; + -0.00144679 ; -2.63199e-17 ; 0.00131023 ; 0.00242331 ; + 0.00329584 ; 0.00390228 ; 0.0042344 ; 0.0042999 ; + 0.00412016 ; 0.00372756 ; 0.00316243 ; 0.00247005 ; + 0.00169768 ; 0.00089195 ; 9.66641e-05 ; -0.000648966 ; + -0.00131156 ; -0.00186435 ; -0.00228754 ; -0.00256834 ; + -0.0027007 ; -0.00268494 ; -0.00252716 ; -0.00223873 ; ]; + abssum = 3.02625; + semilogy((0:255)/256,abs(fft(rxfilt))) + */ + +static const int rxfilter[8][32] = { + { -39, -29, 92, -32, -169, 235, 121, -568, 291, 759, -1193, -269, 2408, -1788, -3472, 10562, 21654, 10539, -3456, -1776, 2386, -266, -1176, 746, 284, -554, 118, 227, -163, -31, 89, -28 }, + { -48, -14, 96, -66, -145, 282, 25, -567, 467, 596, -1359, 168, 2320, -2570, -2540, 12778, 21442, 8284, -4078, -972, 2333, -652, -958, 853, 107, -523, 197, 172, -175, 0, 80, -40 }, + { -55, 2, 95, -99, -108, 316, -80, -531, 629, 385, -1455, 628, 2083, -3277, -1309, 14879, 20819, 6059, -4404, -188, 2154, -974, -700, 904, -62, -465, 259, 112, -176, 28, 68, -49 }, + { -58, 19, 87, -130, -62, 334, -190, -460, 765, 135, -1470, 1087, 1700, -3861, 203, 16796, 19807, 3931, -4452, 537, 1869, -1219, -421, 901, -217, -385, 301, 51, -167, 52, 53, -55 }, + { -59, 37, 74, -155, -7, 332, -297, -356, 864, -140, -1397, 1516, 1180, -4276, 1968, 18463, 18443, 1962, -4251, 1171, 1500, -1379, -138, 847, -348, -289, 322, -7, -149, 71, 36, -58 }, + { -56, 55, 54, -174, 53, 310, -395, -222, 918, -428, -1235, 1888, 541, -4476, 3944, 19824, 16772, 202, -3839, 1686, 1075, -1450, 133, 750, -450, -185, 323, -60, -125, 84, 19, -58 }, + { -50, 70, 29, -183, 116, 267, -477, -63, 921, -711, -987, 2176, -189, -4427, 6076, 20831, 14854, -1304, -3257, 2065, 621, -1434, 379, 616, -519, -77, 306, -104, -96, 91, 2, -54 }, + { -41, 83, 0, -182, 178, 203, -536, 110, 869, -972, -660, 2356, -979, -4098, 8305, 21448, 12753, -2530, -2553, 2299, 166, -1340, 586, 458, -553, 25, 273, -139, -63, 93, -14, -48 } +}; + diff --git a/po/ChangeLog b/po/ChangeLog new file mode 100644 index 0000000..80b913f --- /dev/null +++ b/po/ChangeLog @@ -0,0 +1,18 @@ +2011-06-18 gettextize + + * Makefile.in.in: Upgrade to gettext-0.18.1. + * Rules-quot: Upgrade to gettext-0.18.1. + +2008-12-14 gettextize + + * Makefile.in.in: Upgrade to gettext-0.17. + * boldquot.sed: New file, from gettext-0.17. + * en@boldquot.header: New file, from gettext-0.17. + * en@quot.header: New file, from gettext-0.17. + * insert-header.sin: New file, from gettext-0.17. + * quot.sed: New file, from gettext-0.17. + * remove-potcdate.sin: New file, from gettext-0.17. + * Rules-quot: New file, from gettext-0.17. + * cat-id-tbl.c: Remove file. + * stamp-cat-id: Remove file. + diff --git a/po/Makefile.in.in b/po/Makefile.in.in new file mode 100644 index 0000000..83d8838 --- /dev/null +++ b/po/Makefile.in.in @@ -0,0 +1,444 @@ +# Makefile for PO directory in any package using GNU gettext. +# Copyright (C) 1995-1997, 2000-2007, 2009-2010 by Ulrich Drepper +# +# This file can be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU General Public +# License but which still want to provide support for the GNU gettext +# functionality. +# Please note that the actual code of GNU gettext is covered by the GNU +# General Public License and is *not* in the public domain. +# +# Origin: gettext-0.18 +GETTEXT_MACRO_VERSION = 0.18 + +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ + +SHELL = /bin/sh +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +datarootdir = @datarootdir@ +datadir = @datadir@ +localedir = @localedir@ +gettextsrcdir = $(datadir)/gettext/po + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ + +# We use $(mkdir_p). +# In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as +# "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions, +# @install_sh@ does not start with $(SHELL), so we add it. +# In automake >= 1.10, @mkdir_p@ is derived from ${MKDIR_P}, which is defined +# either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake +# versions, $(mkinstalldirs) and $(install_sh) are unused. +mkinstalldirs = $(SHELL) @install_sh@ -d +install_sh = $(SHELL) @install_sh@ +MKDIR_P = @MKDIR_P@ +mkdir_p = @mkdir_p@ + +GMSGFMT_ = @GMSGFMT@ +GMSGFMT_no = @GMSGFMT@ +GMSGFMT_yes = @GMSGFMT_015@ +GMSGFMT = $(GMSGFMT_$(USE_MSGCTXT)) +MSGFMT_ = @MSGFMT@ +MSGFMT_no = @MSGFMT@ +MSGFMT_yes = @MSGFMT_015@ +MSGFMT = $(MSGFMT_$(USE_MSGCTXT)) +XGETTEXT_ = @XGETTEXT@ +XGETTEXT_no = @XGETTEXT@ +XGETTEXT_yes = @XGETTEXT_015@ +XGETTEXT = $(XGETTEXT_$(USE_MSGCTXT)) +MSGMERGE = msgmerge +MSGMERGE_UPDATE = @MSGMERGE@ --update +MSGINIT = msginit +MSGCONV = msgconv +MSGFILTER = msgfilter + +POFILES = @POFILES@ +GMOFILES = @GMOFILES@ +UPDATEPOFILES = @UPDATEPOFILES@ +DUMMYPOFILES = @DUMMYPOFILES@ +DISTFILES.common = Makefile.in.in remove-potcdate.sin \ +$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3) +DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \ +$(POFILES) $(GMOFILES) \ +$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3) + +POTFILES = \ + +CATALOGS = @CATALOGS@ + +# Makevars gets inserted here. (Don't remove this line!) + +.SUFFIXES: +.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update + +.po.mo: + @echo "$(MSGFMT) -c -o $@ $<"; \ + $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@ + +.po.gmo: + @lang=`echo $* | sed -e 's,.*/,,'`; \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.po"; \ + cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo + +.sin.sed: + sed -e '/^#/d' $< > t-$@ + mv t-$@ $@ + + +all: check-macro-version all-@USE_NLS@ + +all-yes: stamp-po +all-no: + +# Ensure that the gettext macros and this Makefile.in.in are in sync. +check-macro-version: + @test "$(GETTEXT_MACRO_VERSION)" = "@GETTEXT_MACRO_VERSION@" \ + || { echo "*** error: gettext infrastructure mismatch: using a Makefile.in.in from gettext version $(GETTEXT_MACRO_VERSION) but the autoconf macros are from gettext version @GETTEXT_MACRO_VERSION@" 1>&2; \ + exit 1; \ + } + +# $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no +# internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because +# we don't want to bother translators with empty POT files). We assume that +# LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty. +# In this case, stamp-po is a nop (i.e. a phony target). + +# stamp-po is a timestamp denoting the last time at which the CATALOGS have +# been loosely updated. Its purpose is that when a developer or translator +# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS, +# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent +# invocations of "make" will do nothing. This timestamp would not be necessary +# if updating the $(CATALOGS) would always touch them; however, the rule for +# $(POFILES) has been designed to not touch files that don't need to be +# changed. +stamp-po: $(srcdir)/$(DOMAIN).pot + test ! -f $(srcdir)/$(DOMAIN).pot || \ + test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES) + @test ! -f $(srcdir)/$(DOMAIN).pot || { \ + echo "touch stamp-po" && \ + echo timestamp > stamp-poT && \ + mv stamp-poT stamp-po; \ + } + +# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update', +# otherwise packages like GCC can not be built if only parts of the source +# have been downloaded. + +# This target rebuilds $(DOMAIN).pot; it is an expensive operation. +# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed. +$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed + if LC_ALL=C grep 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null | grep -v 'libtool:' >/dev/null; then \ + package_gnu='GNU '; \ + else \ + package_gnu=''; \ + fi; \ + if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \ + msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \ + else \ + msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \ + fi; \ + case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \ + $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ + --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \ + --files-from=$(srcdir)/POTFILES.in \ + --copyright-holder='$(COPYRIGHT_HOLDER)' \ + --msgid-bugs-address="$$msgid_bugs_address" \ + ;; \ + *) \ + $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \ + --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \ + --files-from=$(srcdir)/POTFILES.in \ + --copyright-holder='$(COPYRIGHT_HOLDER)' \ + --package-name="$${package_gnu}@PACKAGE@" \ + --package-version='@VERSION@' \ + --msgid-bugs-address="$$msgid_bugs_address" \ + ;; \ + esac + test ! -f $(DOMAIN).po || { \ + if test -f $(srcdir)/$(DOMAIN).pot; then \ + sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \ + sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \ + if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \ + rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \ + else \ + rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \ + mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ + fi; \ + else \ + mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \ + fi; \ + } + +# This rule has no dependencies: we don't need to update $(DOMAIN).pot at +# every "make" invocation, only create it when it is missing. +# Only "make $(DOMAIN).pot-update" or "make dist" will force an update. +$(srcdir)/$(DOMAIN).pot: + $(MAKE) $(DOMAIN).pot-update + +# This target rebuilds a PO file if $(DOMAIN).pot has changed. +# Note that a PO file is not touched if it doesn't need to be changed. +$(POFILES): $(srcdir)/$(DOMAIN).pot + @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \ + if test -f "$(srcdir)/$${lang}.po"; then \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot"; \ + cd $(srcdir) \ + && { case `$(MSGMERGE_UPDATE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \ + $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \ + *) \ + $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot;; \ + esac; \ + }; \ + else \ + $(MAKE) $${lang}.po-create; \ + fi + + +install: install-exec install-data +install-exec: +install-data: install-data-@USE_NLS@ + if test "$(PACKAGE)" = "gettext-tools"; then \ + $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \ + for file in $(DISTFILES.common) Makevars.template; do \ + $(INSTALL_DATA) $(srcdir)/$$file \ + $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + for file in Makevars; do \ + rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + else \ + : ; \ + fi +install-data-no: all +install-data-yes: all + @catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + dir=$(localedir)/$$lang/LC_MESSAGES; \ + $(mkdir_p) $(DESTDIR)$$dir; \ + if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \ + $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \ + echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \ + for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ + if test -n "$$lc"; then \ + if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ + link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ + mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ + for file in *; do \ + if test -f $$file; then \ + ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ + fi; \ + done); \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + else \ + if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ + :; \ + else \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + fi; \ + fi; \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ + ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \ + cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \ + fi; \ + done; \ + done + +install-strip: install + +installdirs: installdirs-exec installdirs-data +installdirs-exec: +installdirs-data: installdirs-data-@USE_NLS@ + if test "$(PACKAGE)" = "gettext-tools"; then \ + $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \ + else \ + : ; \ + fi +installdirs-data-no: +installdirs-data-yes: + @catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + dir=$(localedir)/$$lang/LC_MESSAGES; \ + $(mkdir_p) $(DESTDIR)$$dir; \ + for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \ + if test -n "$$lc"; then \ + if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \ + link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \ + mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \ + for file in *; do \ + if test -f $$file; then \ + ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \ + fi; \ + done); \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \ + else \ + if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \ + :; \ + else \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \ + mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \ + fi; \ + fi; \ + fi; \ + done; \ + done + +# Define this as empty until I found a useful application. +installcheck: + +uninstall: uninstall-exec uninstall-data +uninstall-exec: +uninstall-data: uninstall-data-@USE_NLS@ + if test "$(PACKAGE)" = "gettext-tools"; then \ + for file in $(DISTFILES.common) Makevars.template; do \ + rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \ + done; \ + else \ + : ; \ + fi +uninstall-data-no: +uninstall-data-yes: + catalogs='$(CATALOGS)'; \ + for cat in $$catalogs; do \ + cat=`basename $$cat`; \ + lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ + for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \ + rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \ + done; \ + done + +check: all + +info dvi ps pdf html tags TAGS ctags CTAGS ID: + +mostlyclean: + rm -f remove-potcdate.sed + rm -f stamp-poT + rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po + rm -fr *.o + +clean: mostlyclean + +distclean: clean + rm -f Makefile Makefile.in POTFILES *.mo + +maintainer-clean: distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + rm -f stamp-po $(GMOFILES) + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) +dist distdir: + $(MAKE) update-po + @$(MAKE) dist2 +# This is a separate target because 'update-po' must be executed before. +dist2: stamp-po $(DISTFILES) + dists="$(DISTFILES)"; \ + if test "$(PACKAGE)" = "gettext-tools"; then \ + dists="$$dists Makevars.template"; \ + fi; \ + if test -f $(srcdir)/$(DOMAIN).pot; then \ + dists="$$dists $(DOMAIN).pot stamp-po"; \ + fi; \ + if test -f $(srcdir)/ChangeLog; then \ + dists="$$dists ChangeLog"; \ + fi; \ + for i in 0 1 2 3 4 5 6 7 8 9; do \ + if test -f $(srcdir)/ChangeLog.$$i; then \ + dists="$$dists ChangeLog.$$i"; \ + fi; \ + done; \ + if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \ + for file in $$dists; do \ + if test -f $$file; then \ + cp -p $$file $(distdir) || exit 1; \ + else \ + cp -p $(srcdir)/$$file $(distdir) || exit 1; \ + fi; \ + done + +update-po: Makefile + $(MAKE) $(DOMAIN).pot-update + test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES) + $(MAKE) update-gmo + +# General rule for creating PO files. + +.nop.po-create: + @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \ + echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \ + exit 1 + +# General rule for updating PO files. + +.nop.po-update: + @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \ + if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \ + tmpdir=`pwd`; \ + echo "$$lang:"; \ + test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \ + echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \ + cd $(srcdir); \ + if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \ + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \ + $(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \ + *) \ + $(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \ + esac; \ + }; then \ + if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ + rm -f $$tmpdir/$$lang.new.po; \ + else \ + if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ + :; \ + else \ + echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ + exit 1; \ + fi; \ + fi; \ + else \ + echo "msgmerge for $$lang.po failed!" 1>&2; \ + rm -f $$tmpdir/$$lang.new.po; \ + fi + +$(DUMMYPOFILES): + +update-gmo: Makefile $(GMOFILES) + @: + +# Recreate Makefile by invoking config.status. Explicitly invoke the shell, +# because execution permission bits may not work on the current file system. +# Use @SHELL@, which is the shell determined by autoconf for the use by its +# scripts, not $(SHELL) which is hardwired to /bin/sh and may be deficient. +Makefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@ + cd $(top_builddir) \ + && @SHELL@ ./config.status $(subdir)/$@.in po-directories + +force: + +# Tell versions [3.59,3.63) of GNU make not to export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/po/Makevars b/po/Makevars new file mode 100644 index 0000000..32692ab --- /dev/null +++ b/po/Makevars @@ -0,0 +1,41 @@ +# Makefile variables for PO directory in any package using GNU gettext. + +# Usually the message domain is the same as the package name. +DOMAIN = $(PACKAGE) + +# These two variables depend on the location of this directory. +subdir = po +top_builddir = .. + +# These options get passed to xgettext. +XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ + +# This is the copyright holder that gets inserted into the header of the +# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding +# package. (Note that the msgstr strings, extracted from the package's +# sources, belong to the copyright holder of the package.) Translators are +# expected to transfer the copyright for their translations to this person +# or entity, or to disclaim their copyright. The empty string stands for +# the public domain; in this case the translators are expected to disclaim +# their copyright. +COPYRIGHT_HOLDER = Free Software Foundation, Inc. + +# This is the email address or URL to which the translators shall report +# bugs in the untranslated strings: +# - Strings which are not entire sentences, see the maintainer guidelines +# in the GNU gettext documentation, section 'Preparing Strings'. +# - Strings which use unclear terms or require additional context to be +# understood. +# - Strings which make invalid assumptions about notation of date, time or +# money. +# - Pluralisation problems. +# - Incorrect English spelling. +# - Incorrect formatting. +# It can be your email address, or a mailing list address where translators +# can write to without being subscribed, or the URL of a web page through +# which the translators can contact you. +MSGID_BUGS_ADDRESS = + +# This is the list of locale categories, beyond LC_MESSAGES, for which the +# message catalogs shall be used. It is usually empty. +EXTRA_LOCALE_CATEGORIES = diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 0000000..f6dbda9 --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1,7 @@ +# List of source files containing translatable strings. + +configapp/src/app.c +configapp/src/diag.c +configapp/src/interface.c +configapp/src/main.c +configapp/src/support.c diff --git a/po/Rules-quot b/po/Rules-quot new file mode 100644 index 0000000..af52487 --- /dev/null +++ b/po/Rules-quot @@ -0,0 +1,47 @@ +# Special Makefile rules for English message catalogs with quotation marks. + +DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot + +.SUFFIXES: .insert-header .po-update-en + +en@quot.po-create: + $(MAKE) en@quot.po-update +en@boldquot.po-create: + $(MAKE) en@boldquot.po-update + +en@quot.po-update: en@quot.po-update-en +en@boldquot.po-update: en@boldquot.po-update-en + +.insert-header.po-update-en: + @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \ + if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \ + tmpdir=`pwd`; \ + echo "$$lang:"; \ + ll=`echo $$lang | sed -e 's/@.*//'`; \ + LC_ALL=C; export LC_ALL; \ + cd $(srcdir); \ + if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$lang -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \ + if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ + rm -f $$tmpdir/$$lang.new.po; \ + else \ + if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ + :; \ + else \ + echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ + exit 1; \ + fi; \ + fi; \ + else \ + echo "creation of $$lang.po failed!" 1>&2; \ + rm -f $$tmpdir/$$lang.new.po; \ + fi + +en@quot.insert-header: insert-header.sin + sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header + +en@boldquot.insert-header: insert-header.sin + sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header + +mostlyclean: mostlyclean-quot +mostlyclean-quot: + rm -f *.insert-header diff --git a/po/boldquot.sed b/po/boldquot.sed new file mode 100644 index 0000000..4b937aa --- /dev/null +++ b/po/boldquot.sed @@ -0,0 +1,10 @@ +s/"\([^"]*\)"/“\1â€/g +s/`\([^`']*\)'/‘\1’/g +s/ '\([^`']*\)' / ‘\1’ /g +s/ '\([^`']*\)'$/ ‘\1’/g +s/^'\([^`']*\)' /‘\1’ /g +s/“â€/""/g +s/“/“/g +s/â€/â€/g +s/‘/‘/g +s/’/’/g diff --git a/po/en@boldquot.header b/po/en@boldquot.header new file mode 100644 index 0000000..fedb6a0 --- /dev/null +++ b/po/en@boldquot.header @@ -0,0 +1,25 @@ +# All this catalog "translates" are quotation characters. +# The msgids must be ASCII and therefore cannot contain real quotation +# characters, only substitutes like grave accent (0x60), apostrophe (0x27) +# and double quote (0x22). These substitutes look strange; see +# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html +# +# This catalog translates grave accent (0x60) and apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019). +# It also translates pairs of apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019) +# and pairs of quotation mark (0x22) to +# left double quotation mark (U+201C) and right double quotation mark (U+201D). +# +# When output to an UTF-8 terminal, the quotation characters appear perfectly. +# When output to an ISO-8859-1 terminal, the single quotation marks are +# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to +# grave/acute accent (by libiconv), and the double quotation marks are +# transliterated to 0x22. +# When output to an ASCII terminal, the single quotation marks are +# transliterated to apostrophes, and the double quotation marks are +# transliterated to 0x22. +# +# This catalog furthermore displays the text between the quotation marks in +# bold face, assuming the VT100/XTerm escape sequences. +# diff --git a/po/en@quot.header b/po/en@quot.header new file mode 100644 index 0000000..a9647fc --- /dev/null +++ b/po/en@quot.header @@ -0,0 +1,22 @@ +# All this catalog "translates" are quotation characters. +# The msgids must be ASCII and therefore cannot contain real quotation +# characters, only substitutes like grave accent (0x60), apostrophe (0x27) +# and double quote (0x22). These substitutes look strange; see +# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html +# +# This catalog translates grave accent (0x60) and apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019). +# It also translates pairs of apostrophe (0x27) to +# left single quotation mark (U+2018) and right single quotation mark (U+2019) +# and pairs of quotation mark (0x22) to +# left double quotation mark (U+201C) and right double quotation mark (U+201D). +# +# When output to an UTF-8 terminal, the quotation characters appear perfectly. +# When output to an ISO-8859-1 terminal, the single quotation marks are +# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to +# grave/acute accent (by libiconv), and the double quotation marks are +# transliterated to 0x22. +# When output to an ASCII terminal, the single quotation marks are +# transliterated to apostrophes, and the double quotation marks are +# transliterated to 0x22. +# diff --git a/po/fr.gmo b/po/fr.gmo new file mode 100644 index 0000000000000000000000000000000000000000..7be80ed744b7f665e7bf85c8c4682524d62968bb GIT binary patch literal 2869 zcmZ{kO>7%Q6vwCZiyCNY`DzO-!$(O%SjTos72FTiv6D6;iH+@2skhB~Y%f{QZf9nb zrs4o6I8{g$AR%$9)CLuhDx@ANIA9@=5E4QN38^4dI1~XA2M`A?{NL_6PNOo~+279W zyf^bc=KZ*1! z;J4sb@H%)G_#1c+_z$=P+z2J~eH9sI{}Uwp{s!qh z|AHjH2?LVf3Xkk$=?WOo`wSeS)Q{wE(lg-$Yb&IiybPFZwn zbl*5S*$C0-4gir(IuG3eYD4IBFDVE2q4(M#J~F*Q!n?uYRdZy|W9Uz#(;0W6lW(X| zOa{w{0yrCab~`?td-q; zH7gbwI=|Jf^7E`b&&pD0Rw>kKh3RQN*zhBzPFpzh@yROnI*X6Yp}yj~(g?*~2wlT^ zQAsQs8F!8DO*Z(gqu2qBp7s4@iEw|SYA>!`rFhNQCe*Cv_<>;m7xG#l9HYVx>wWN& zs{_woV)eG)u{E#R@StLK-`E~IC6o`#mH!f?tf_|eqEH&~&T~yEg+Pc7&!n^2R8<7N zGS-Z4xeaSPY-y|R=Xt79u3JSVYy%;yWE(^~m&sBM_9W&~6EU8a$P!YeyAblTw7XRHY2TOG*)ARp{xmsjCW-#&&TFm zld5>Qm!380tB%fd8AL;UICqf8pNHju=xqPJ>ut_1i?-?a{wY%(yfLz`Co74tY z;D}*>Q1(7}BV3i~B1HDA)Cg9Pl2Tw&b(f=hAb16_74Roj42irT2#+@gP#C(GkkExw zP}d1?J)M;TgLAN1zr%5-J$uz|G{2@e%nBZe(C`2WXp|o=pc;7s<-uuFVT!9ozfizV zsuXoU)L5o*6>v@}7pN0lpbp6HvL0f!FbI^}fhnc#a#A#4DqB-EXlgRvi5=@+!oH_N zn`#segI%b26kJpc6px9K+HI-_DVU{0+hI%(I&N1-PRO{7)XOL8e9#V^5NW&6T~;nE zjqXUlo?xrQuB4z~6RIdwSrU7rV#2GUdlA>3N=fg#=MR_-N5L0sek}R3&&-o imrP_^Tv7T4VQzK0#Fa#_2?u#i9_vlqwxYmV, 2008 +# +msgid "" +msgstr "" +"Project-Id-Version: soundmodem 0.11\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2011-06-18 09:26+0200\n" +"PO-Revision-Date: 2008-12-14 21:23+0100\n" +"Last-Translator: Stéphane Fillod \n" +"Language-Team: French \n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n>1;\n" + +#: configapp/src/app.c:139 +msgid "Mode" +msgstr "Mode" + +#: configapp/src/app.c:389 +msgid "IO" +msgstr "E/S" + +#: configapp/src/app.c:404 +msgid "Channel Access" +msgstr "Cannel d'Accès" + +#: configapp/src/app.c:527 +msgid "Modulator" +msgstr "Modulateur" + +#: configapp/src/app.c:552 +msgid "Demodulator" +msgstr "Démodulateur" + +#: configapp/src/app.c:578 +msgid "Packet IO" +msgstr "E/S Paquet" + +#: configapp/src/interface.c:73 configapp/src/interface.c:339 +msgid "SoundModem Configurator" +msgstr "Configurateur SoundModem" + +#: configapp/src/interface.c:88 +msgid "File" +msgstr "Fichier" + +#: configapp/src/interface.c:95 +msgid "New" +msgstr "Nouveau" + +#: configapp/src/interface.c:102 configapp/src/interface.c:117 +msgid "Configuration" +msgstr "configuration" + +#: configapp/src/interface.c:106 configapp/src/interface.c:121 +msgid "Channel" +msgstr "Cannal" + +#: configapp/src/interface.c:110 +msgid "Delete" +msgstr "Supprimer" + +#: configapp/src/interface.c:130 +msgid "Quit" +msgstr "Quitter" + +#: configapp/src/interface.c:134 +msgid "Diagnostics" +msgstr "Diagnostics" + +#: configapp/src/interface.c:141 configapp/src/interface.c:648 +#: configapp/src/interface.c:707 +msgid "Scope" +msgstr "Scope" + +#: configapp/src/interface.c:145 configapp/src/interface.c:597 +msgid "Spectrum" +msgstr "Spectre" + +#: configapp/src/interface.c:149 +msgid "Modem" +msgstr "Modem" + +#: configapp/src/interface.c:153 +msgid "AO-40 P3D Modem" +msgstr "Modem AO-40 P3D" + +#: configapp/src/interface.c:157 +msgid "PASSALL (do not check CRC)" +msgstr "PASSTOUT (aucune vérification CRC)" + +#: configapp/src/interface.c:161 +msgid "Help" +msgstr "Aide" + +#: configapp/src/interface.c:168 +msgid "About" +msgstr "A Propos" + +#: configapp/src/interface.c:313 +msgid "About SoundModem Configurator" +msgstr "A Propos du Configurateur SoundModem" + +#: configapp/src/interface.c:329 +msgid "Copyright 2000" +msgstr "Copyright 2000" + +#: configapp/src/interface.c:334 +msgid "Thomas Sailer" +msgstr "Thomas Sailer" + +#: configapp/src/interface.c:352 +msgid "Ok" +msgstr "Ok" + +#: configapp/src/interface.c:389 +msgid "New Configuration" +msgstr "Nouvelle Configuration" + +#: configapp/src/interface.c:399 +msgid "Configuration Name" +msgstr "Nom de la Configuration" + +#: configapp/src/interface.c:419 +msgid "Cancel" +msgstr "Annler" + +#: configapp/src/interface.c:427 configapp/src/interface.c:488 +msgid "OK" +msgstr "OK" + +#: configapp/src/interface.c:465 configapp/src/interface.c:472 +msgid "Error" +msgstr "Erreur" + +#: configapp/src/interface.c:528 +msgid "Spectrum Display" +msgstr "Ecran de Spectre" + +#: configapp/src/interface.c:539 +msgid "Pointer" +msgstr "Pointeur" + +#: configapp/src/interface.c:556 configapp/src/interface.c:561 +#: configapp/src/interface.c:668 configapp/src/interface.c:672 +#: configapp/src/interface.c:828 configapp/src/interface.c:832 +msgid "PTT" +msgstr "PTT" + +#: configapp/src/interface.c:573 configapp/src/interface.c:684 +#: configapp/src/interface.c:844 +msgid "DCD" +msgstr "DCD" + +#: configapp/src/interface.c:659 +msgid "Freeze when not DCD" +msgstr "Gèle quand pas de DCD" + +#: configapp/src/interface.c:769 +msgid "Receive Packets/Bits" +msgstr "Paquets/Bits Reçus" + +#: configapp/src/interface.c:780 +msgid "Clear Count" +msgstr "RAZ Compte" + +#: configapp/src/interface.c:784 +msgid "Zeros" +msgstr "Zéros" + +#: configapp/src/interface.c:797 +msgid "Ones" +msgstr "Uns" + +#: configapp/src/interface.c:810 +msgid "Total" +msgstr "Total" + +#: configapp/src/interface.c:879 +msgid "Received Packets" +msgstr "Paquets Reçus" + +#: configapp/src/interface.c:901 +msgid "Received Bits" +msgstr "Bits Reçus" + +#: configapp/src/interface.c:968 +msgid "AO-40 Phase 3D Receive Window" +msgstr "Fenêtre Réception AO-40 Phase 3D" + +#: configapp/src/interface.c:979 +msgid "Receiver Status" +msgstr "Status Récepteur" + +#: configapp/src/interface.c:992 +msgid "Carrier Frequency" +msgstr "Fréquence Porteuse" + +#: configapp/src/interface.c:1005 +msgid "Hz" +msgstr "Hz" + +#: configapp/src/interface.c:1010 +msgid "Decode All Packets (Faulty CRC)" +msgstr "Décode Tous les Paquets (CRC erronés)" + +#: configapp/src/interface.c:1037 +msgid "Received Decoded Packets" +msgstr "Paquets Décodés Reçus" + +#: configapp/src/interface.c:1059 +msgid "Received Raw Packets" +msgstr "Paquets Bruts Reçus" + +#: configapp/src/support.c:90 configapp/src/support.c:114 +#, c-format +msgid "Couldn't find pixmap file: %s" +msgstr "Ne peut pas trouver le fichier pixmap: %s" + +#~ msgid "Select File" +#~ msgstr "Sélectionne Fichier" diff --git a/po/insert-header.sin b/po/insert-header.sin new file mode 100644 index 0000000..b26de01 --- /dev/null +++ b/po/insert-header.sin @@ -0,0 +1,23 @@ +# Sed script that inserts the file called HEADER before the header entry. +# +# At each occurrence of a line starting with "msgid ", we execute the following +# commands. At the first occurrence, insert the file. At the following +# occurrences, do nothing. The distinction between the first and the following +# occurrences is achieved by looking at the hold space. +/^msgid /{ +x +# Test if the hold space is empty. +s/m/m/ +ta +# Yes it was empty. First occurrence. Read the file. +r HEADER +# Output the file's contents by reading the next line. But don't lose the +# current line while doing this. +g +N +bb +:a +# The hold space was nonempty. Following occurrences. Do nothing. +x +:b +} diff --git a/po/quot.sed b/po/quot.sed new file mode 100644 index 0000000..0122c46 --- /dev/null +++ b/po/quot.sed @@ -0,0 +1,6 @@ +s/"\([^"]*\)"/“\1â€/g +s/`\([^`']*\)'/‘\1’/g +s/ '\([^`']*\)' / ‘\1’ /g +s/ '\([^`']*\)'$/ ‘\1’/g +s/^'\([^`']*\)' /‘\1’ /g +s/“â€/""/g diff --git a/po/remove-potcdate.sin b/po/remove-potcdate.sin new file mode 100644 index 0000000..2436c49 --- /dev/null +++ b/po/remove-potcdate.sin @@ -0,0 +1,19 @@ +# Sed script that remove the POT-Creation-Date line in the header entry +# from a POT file. +# +# The distinction between the first and the following occurrences of the +# pattern is achieved by looking at the hold space. +/^"POT-Creation-Date: .*"$/{ +x +# Test if the hold space is empty. +s/P/P/ +ta +# Yes it was empty. First occurrence. Remove the line. +g +d +bb +:a +# The hold space was nonempty. Following occurrences. Do nothing. +x +:b +} diff --git a/po/soundmodem.pot b/po/soundmodem.pot new file mode 100644 index 0000000..e09d538 --- /dev/null +++ b/po/soundmodem.pot @@ -0,0 +1,223 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Free Software Foundation, Inc. +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: soundmodem 0.16\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2011-06-18 09:26+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: configapp/src/app.c:139 +msgid "Mode" +msgstr "" + +#: configapp/src/app.c:389 +msgid "IO" +msgstr "" + +#: configapp/src/app.c:404 +msgid "Channel Access" +msgstr "" + +#: configapp/src/app.c:527 +msgid "Modulator" +msgstr "" + +#: configapp/src/app.c:552 +msgid "Demodulator" +msgstr "" + +#: configapp/src/app.c:578 +msgid "Packet IO" +msgstr "" + +#: configapp/src/interface.c:73 configapp/src/interface.c:339 +msgid "SoundModem Configurator" +msgstr "" + +#: configapp/src/interface.c:88 +msgid "File" +msgstr "" + +#: configapp/src/interface.c:95 +msgid "New" +msgstr "" + +#: configapp/src/interface.c:102 configapp/src/interface.c:117 +msgid "Configuration" +msgstr "" + +#: configapp/src/interface.c:106 configapp/src/interface.c:121 +msgid "Channel" +msgstr "" + +#: configapp/src/interface.c:110 +msgid "Delete" +msgstr "" + +#: configapp/src/interface.c:130 +msgid "Quit" +msgstr "" + +#: configapp/src/interface.c:134 +msgid "Diagnostics" +msgstr "" + +#: configapp/src/interface.c:141 configapp/src/interface.c:648 +#: configapp/src/interface.c:707 +msgid "Scope" +msgstr "" + +#: configapp/src/interface.c:145 configapp/src/interface.c:597 +msgid "Spectrum" +msgstr "" + +#: configapp/src/interface.c:149 +msgid "Modem" +msgstr "" + +#: configapp/src/interface.c:153 +msgid "AO-40 P3D Modem" +msgstr "" + +#: configapp/src/interface.c:157 +msgid "PASSALL (do not check CRC)" +msgstr "" + +#: configapp/src/interface.c:161 +msgid "Help" +msgstr "" + +#: configapp/src/interface.c:168 +msgid "About" +msgstr "" + +#: configapp/src/interface.c:313 +msgid "About SoundModem Configurator" +msgstr "" + +#: configapp/src/interface.c:329 +msgid "Copyright 2000" +msgstr "" + +#: configapp/src/interface.c:334 +msgid "Thomas Sailer" +msgstr "" + +#: configapp/src/interface.c:352 +msgid "Ok" +msgstr "" + +#: configapp/src/interface.c:389 +msgid "New Configuration" +msgstr "" + +#: configapp/src/interface.c:399 +msgid "Configuration Name" +msgstr "" + +#: configapp/src/interface.c:419 +msgid "Cancel" +msgstr "" + +#: configapp/src/interface.c:427 configapp/src/interface.c:488 +msgid "OK" +msgstr "" + +#: configapp/src/interface.c:465 configapp/src/interface.c:472 +msgid "Error" +msgstr "" + +#: configapp/src/interface.c:528 +msgid "Spectrum Display" +msgstr "" + +#: configapp/src/interface.c:539 +msgid "Pointer" +msgstr "" + +#: configapp/src/interface.c:556 configapp/src/interface.c:561 +#: configapp/src/interface.c:668 configapp/src/interface.c:672 +#: configapp/src/interface.c:828 configapp/src/interface.c:832 +msgid "PTT" +msgstr "" + +#: configapp/src/interface.c:573 configapp/src/interface.c:684 +#: configapp/src/interface.c:844 +msgid "DCD" +msgstr "" + +#: configapp/src/interface.c:659 +msgid "Freeze when not DCD" +msgstr "" + +#: configapp/src/interface.c:769 +msgid "Receive Packets/Bits" +msgstr "" + +#: configapp/src/interface.c:780 +msgid "Clear Count" +msgstr "" + +#: configapp/src/interface.c:784 +msgid "Zeros" +msgstr "" + +#: configapp/src/interface.c:797 +msgid "Ones" +msgstr "" + +#: configapp/src/interface.c:810 +msgid "Total" +msgstr "" + +#: configapp/src/interface.c:879 +msgid "Received Packets" +msgstr "" + +#: configapp/src/interface.c:901 +msgid "Received Bits" +msgstr "" + +#: configapp/src/interface.c:968 +msgid "AO-40 Phase 3D Receive Window" +msgstr "" + +#: configapp/src/interface.c:979 +msgid "Receiver Status" +msgstr "" + +#: configapp/src/interface.c:992 +msgid "Carrier Frequency" +msgstr "" + +#: configapp/src/interface.c:1005 +msgid "Hz" +msgstr "" + +#: configapp/src/interface.c:1010 +msgid "Decode All Packets (Faulty CRC)" +msgstr "" + +#: configapp/src/interface.c:1037 +msgid "Received Decoded Packets" +msgstr "" + +#: configapp/src/interface.c:1059 +msgid "Received Raw Packets" +msgstr "" + +#: configapp/src/support.c:90 configapp/src/support.c:114 +#, c-format +msgid "Couldn't find pixmap file: %s" +msgstr "" diff --git a/po/stamp-po b/po/stamp-po new file mode 100644 index 0000000..9788f70 --- /dev/null +++ b/po/stamp-po @@ -0,0 +1 @@ +timestamp diff --git a/po/sv.gmo b/po/sv.gmo new file mode 100644 index 0000000000000000000000000000000000000000..2cb52ae81ff61b2240b098251e5981d675e3da61 GIT binary patch literal 2763 zcmZ{kU5ryj6vsya(e)Gj0#qCoWD)Of+cg9#61wfKZ1$sdTQTC(Z11$a^mcBUncJnr z2Yn+kF&cyTAP*)>NYqF)1|A3+tqCSRYJ5WDM`Db=8htYHe{OGEx>+YZ_t%+w=FFV0 z`{U;Iry0fs?Zb?|QRt$2PO zyb<#cV_t~YKLPP$m+-g+yaLjBS3$b>Hz4i%A?8mY+5Z*X2L29`{yJQW_HP8q&rKld zZ3XWEw}a&81h@svfOmmMfm9Fc;4Jyg zK@RQ!$?qwU@-h#OfG>ii=Yn)j4J3OCqqIJ_Uv zFUR~0B>P{0+rg_Ko%o>>5WnRN%ST$Zv*#Sw?=+F0(k;LcijphUuaOx?t+Zd1cQ8|dZ3&= z33&iQaiTE>p%}x(Xry8iCos`4Yja=W?7-i(g(Emq~_CF9uK7|w^_C( zl%h9X@=UobjbT||3JnvXvTR_;3)Jw8FNlW3QnRhSYR&RgB9Xu}^j)>f@(S+9o8F0r zXyU&w(|o64xonQ*WEp<(jPLV;DA%Pmd~{lbzHRgDVs{ou4~dyY=ZMq>`A%~~C51%D22YIbcTyvZvKeUW%$us`I+J15IHe%X zM+*6plhsmK>~eC#BHgJ(GU+7tI>~)Ju|J*KyC;DHfugf0TOL{O>p>}z!jGpW(#hnW zL=t*)!dR!Ig)&hIqdWzHiCHCvtUD&j;3`rlDafor}t#koa(;vwQs|}3-8Njot?qGAXCK4uyS=T(pSNtTvr=87zuRn~&FlTB zk!RiRp0e~U?6)^mtVU3z7Tq(Vk59M7>E<)hAq82dNM%~a53Rs=BuZQC-8fP!^k8w- xR7BB0#G+6P)K*P(=iJZ=)r7ge#|Md7s|3*C^{CU2ct&v3o2}92-6B8?{sX~fdIkUh literal 0 HcmV?d00001 diff --git a/po/sv.po b/po/sv.po new file mode 100644 index 0000000..bb64436 --- /dev/null +++ b/po/sv.po @@ -0,0 +1,228 @@ +# Swedish translation of soundmodem. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the soundmodem package. +# Daniel Nylander , 2006. +# +msgid "" +msgstr "" +"Project-Id-Version: soundmodem 0.9-2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2011-06-18 09:26+0200\n" +"PO-Revision-Date: 2006-02-02 23:11+0100\n" +"Last-Translator: Daniel Nylander \n" +"Language-Team: Swedish \n" +"Language: sv\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: configapp/src/app.c:139 +msgid "Mode" +msgstr "Läge" + +#: configapp/src/app.c:389 +msgid "IO" +msgstr "In/Ut" + +#: configapp/src/app.c:404 +msgid "Channel Access" +msgstr "KanalÃ¥tkomst" + +#: configapp/src/app.c:527 +msgid "Modulator" +msgstr "Modulator" + +#: configapp/src/app.c:552 +msgid "Demodulator" +msgstr "Demodulator" + +#: configapp/src/app.c:578 +msgid "Packet IO" +msgstr "Paket In/Ut" + +#: configapp/src/interface.c:73 configapp/src/interface.c:339 +msgid "SoundModem Configurator" +msgstr "Konfiguratör för SoundModem" + +#: configapp/src/interface.c:88 +msgid "File" +msgstr "Arkiv" + +#: configapp/src/interface.c:95 +msgid "New" +msgstr "Ny" + +#: configapp/src/interface.c:102 configapp/src/interface.c:117 +msgid "Configuration" +msgstr "Konfiguration" + +#: configapp/src/interface.c:106 configapp/src/interface.c:121 +msgid "Channel" +msgstr "Kanal" + +#: configapp/src/interface.c:110 +msgid "Delete" +msgstr "Ta bort" + +#: configapp/src/interface.c:130 +msgid "Quit" +msgstr "Avsluta" + +#: configapp/src/interface.c:134 +msgid "Diagnostics" +msgstr "Diagnostik" + +#: configapp/src/interface.c:141 configapp/src/interface.c:648 +#: configapp/src/interface.c:707 +msgid "Scope" +msgstr "Scope" + +#: configapp/src/interface.c:145 configapp/src/interface.c:597 +msgid "Spectrum" +msgstr "Spektrum" + +#: configapp/src/interface.c:149 +msgid "Modem" +msgstr "Modem" + +#: configapp/src/interface.c:153 +msgid "AO-40 P3D Modem" +msgstr "AO-40 P3D Modem" + +#: configapp/src/interface.c:157 +msgid "PASSALL (do not check CRC)" +msgstr "PASSALL (kontrollera inte CRC)" + +#: configapp/src/interface.c:161 +msgid "Help" +msgstr "Hjälp" + +#: configapp/src/interface.c:168 +msgid "About" +msgstr "Om" + +#: configapp/src/interface.c:313 +msgid "About SoundModem Configurator" +msgstr "Om Konfiguratör för SoundModem" + +#: configapp/src/interface.c:329 +msgid "Copyright 2000" +msgstr "Copyright 2000" + +#: configapp/src/interface.c:334 +msgid "Thomas Sailer" +msgstr "Thomas Sailer" + +#: configapp/src/interface.c:352 +msgid "Ok" +msgstr "Ok" + +#: configapp/src/interface.c:389 +msgid "New Configuration" +msgstr "Ny konfiguration" + +#: configapp/src/interface.c:399 +msgid "Configuration Name" +msgstr "Konfigurationsnamn" + +#: configapp/src/interface.c:419 +msgid "Cancel" +msgstr "Avbryt" + +#: configapp/src/interface.c:427 configapp/src/interface.c:488 +msgid "OK" +msgstr "OK" + +#: configapp/src/interface.c:465 configapp/src/interface.c:472 +msgid "Error" +msgstr "Fel" + +#: configapp/src/interface.c:528 +msgid "Spectrum Display" +msgstr "Visa spektrum" + +#: configapp/src/interface.c:539 +msgid "Pointer" +msgstr "Pekare" + +#: configapp/src/interface.c:556 configapp/src/interface.c:561 +#: configapp/src/interface.c:668 configapp/src/interface.c:672 +#: configapp/src/interface.c:828 configapp/src/interface.c:832 +msgid "PTT" +msgstr "PTT" + +#: configapp/src/interface.c:573 configapp/src/interface.c:684 +#: configapp/src/interface.c:844 +msgid "DCD" +msgstr "DCD" + +#: configapp/src/interface.c:659 +msgid "Freeze when not DCD" +msgstr "Frys när inte DCD" + +#: configapp/src/interface.c:769 +msgid "Receive Packets/Bits" +msgstr "Mottagna paket/bitar" + +#: configapp/src/interface.c:780 +msgid "Clear Count" +msgstr "Nollställ räknare" + +#: configapp/src/interface.c:784 +msgid "Zeros" +msgstr "Nollor" + +#: configapp/src/interface.c:797 +msgid "Ones" +msgstr "Ettor" + +#: configapp/src/interface.c:810 +msgid "Total" +msgstr "Totalt" + +#: configapp/src/interface.c:879 +msgid "Received Packets" +msgstr "Mottagna paket" + +#: configapp/src/interface.c:901 +msgid "Received Bits" +msgstr "Mottagna bitar" + +#: configapp/src/interface.c:968 +msgid "AO-40 Phase 3D Receive Window" +msgstr "Mottagningsfönster AO-40 Phase 3D" + +#: configapp/src/interface.c:979 +msgid "Receiver Status" +msgstr "Mottagningsstatus" + +#: configapp/src/interface.c:992 +msgid "Carrier Frequency" +msgstr "Bärarfrekvens" + +#: configapp/src/interface.c:1005 +msgid "Hz" +msgstr "Hz" + +#: configapp/src/interface.c:1010 +msgid "Decode All Packets (Faulty CRC)" +msgstr "Avkoda alla paket (felaktig CRC)" + +#: configapp/src/interface.c:1037 +msgid "Received Decoded Packets" +msgstr "Mottagna avkodade paket" + +#: configapp/src/interface.c:1059 +msgid "Received Raw Packets" +msgstr "Mottagna rÃ¥paket" + +#: configapp/src/support.c:90 configapp/src/support.c:114 +#, c-format +msgid "Couldn't find pixmap file: %s" +msgstr "Kunde inte hitta bildfil: %s" + +#~ msgid "Select File" +#~ msgstr "Välj fil" + +#~ msgid "Error loading pixmap file: %s" +#~ msgstr "Fel vid inläsning av bildfil: %s" diff --git a/pskmodem/Makefile.am b/pskmodem/Makefile.am new file mode 100644 index 0000000..78739db --- /dev/null +++ b/pskmodem/Makefile.am @@ -0,0 +1,35 @@ +INCLUDES = -I$(top_srcdir)/soundcard -I$(top_srcdir)/libmisc -I$(top_srcdir)/matlib + +noinst_LIBRARIES = libpsk.a +#dnl sbin_PROGRAMS + +measpsk_SOURCES = measpsk.c +measpsk_LDADD = ../libmisc/libmisc.a ../matlib/libmat.a + +genpsktbl_SOURCES = genpsktbl.c +genpsktbl_LDADD = ../matlib/libmat.a + +libpsk_a_SOURCES = pskmodem.c pskmlse.c + +noinst_HEADERS = \ + meas.h \ + psk.h \ + psktbl.h + +if WIN32 +MEASPROG = +else +MEASPROG = measpsk +endif + +if CROSSCOMP + +else + +noinst_PROGRAMS = $(MEASPROG) genpsktbl + +$(srcdir)/psktbl.h: genpsktbl$(EXEEXT) + ./genpsktbl > $@ + +endif + diff --git a/pskmodem/Makefile.in b/pskmodem/Makefile.in new file mode 100644 index 0000000..08f1497 --- /dev/null +++ b/pskmodem/Makefile.in @@ -0,0 +1,527 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +@CROSSCOMP_FALSE@noinst_PROGRAMS = $(am__EXEEXT_1) genpsktbl$(EXEEXT) +subdir = pskmodem +DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +libpsk_a_AR = $(AR) $(ARFLAGS) +libpsk_a_LIBADD = +am_libpsk_a_OBJECTS = pskmodem.$(OBJEXT) pskmlse.$(OBJEXT) +libpsk_a_OBJECTS = $(am_libpsk_a_OBJECTS) +@WIN32_FALSE@am__EXEEXT_1 = measpsk$(EXEEXT) +PROGRAMS = $(noinst_PROGRAMS) +am_genpsktbl_OBJECTS = genpsktbl.$(OBJEXT) +genpsktbl_OBJECTS = $(am_genpsktbl_OBJECTS) +genpsktbl_DEPENDENCIES = ../matlib/libmat.a +am_measpsk_OBJECTS = measpsk.$(OBJEXT) +measpsk_OBJECTS = $(am_measpsk_OBJECTS) +measpsk_DEPENDENCIES = ../libmisc/libmisc.a ../matlib/libmat.a +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libpsk_a_SOURCES) $(genpsktbl_SOURCES) $(measpsk_SOURCES) +DIST_SOURCES = $(libpsk_a_SOURCES) $(genpsktbl_SOURCES) \ + $(measpsk_SOURCES) +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUDIOFILE_CFLAGS = @AUDIOFILE_CFLAGS@ +AUDIOFILE_LIBS = @AUDIOFILE_LIBS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +HAVE_ALSA = @HAVE_ALSA@ +HAVE_BITTYPES = @HAVE_BITTYPES@ +HAVE_DIRECTX = @HAVE_DIRECTX@ +HAVE_IFRNEWNAME = @HAVE_IFRNEWNAME@ +HAVE_MKISS = @HAVE_MKISS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTHREAD = @LIBTHREAD@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +M_PI = @M_PI@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USEMMX = @USEMMX@ +USEVIS = @USEVIS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WIN32 = @WIN32@ +WINDRES = @WINDRES@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CFLAGS = @XML_CFLAGS@ +XML_LIBS = @XML_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +INCLUDES = -I$(top_srcdir)/soundcard -I$(top_srcdir)/libmisc -I$(top_srcdir)/matlib +noinst_LIBRARIES = libpsk.a +#dnl sbin_PROGRAMS +measpsk_SOURCES = measpsk.c +measpsk_LDADD = ../libmisc/libmisc.a ../matlib/libmat.a +genpsktbl_SOURCES = genpsktbl.c +genpsktbl_LDADD = ../matlib/libmat.a +libpsk_a_SOURCES = pskmodem.c pskmlse.c +noinst_HEADERS = \ + meas.h \ + psk.h \ + psktbl.h + +@WIN32_FALSE@MEASPROG = measpsk +@WIN32_TRUE@MEASPROG = +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu pskmodem/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu pskmodem/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libpsk.a: $(libpsk_a_OBJECTS) $(libpsk_a_DEPENDENCIES) + -rm -f libpsk.a + $(libpsk_a_AR) libpsk.a $(libpsk_a_OBJECTS) $(libpsk_a_LIBADD) + $(RANLIB) libpsk.a + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) +genpsktbl$(EXEEXT): $(genpsktbl_OBJECTS) $(genpsktbl_DEPENDENCIES) + @rm -f genpsktbl$(EXEEXT) + $(LINK) $(genpsktbl_OBJECTS) $(genpsktbl_LDADD) $(LIBS) +measpsk$(EXEEXT): $(measpsk_OBJECTS) $(measpsk_DEPENDENCIES) + @rm -f measpsk$(EXEEXT) + $(LINK) $(measpsk_OBJECTS) $(measpsk_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genpsktbl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/measpsk.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pskmlse.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pskmodem.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES clean-noinstPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am + + +@CROSSCOMP_FALSE@$(srcdir)/psktbl.h: genpsktbl$(EXEEXT) +@CROSSCOMP_FALSE@ ./genpsktbl > $@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/pskmodem/genpsktbl.c b/pskmodem/genpsktbl.c new file mode 100644 index 0000000..9612bc9 --- /dev/null +++ b/pskmodem/genpsktbl.c @@ -0,0 +1,615 @@ +/*****************************************************************************/ + +/* + * genpsktbl.c -- Channel simulator for the PSK channel. + * + * Copyright (C) 1999-2000 Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please note that the GPL allows you to use the driver, NOT the radio. + * In order to use the radio, you need a license from the communications + * authority of your country. + * + */ + +/*****************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "modem.h" +#include "psk.h" +#include "mat.h" + +#include +#include +#include +#include + +/* ---------------------------------------------------------------------- */ + +/* + * Maximum length shift register connections + * (cf. Proakis, Digital Communications, p. 399 + * + * 2 1,2 + * 3 1,3 + * 4 1,4 + * 5 1,4 + * 6 1,6 + * 7 1,7 + * 8 1,5,6,7 + * 9 1,6 + * 10 1,8 + * 11 1,10 + * 12 1,7,9,12 + * 13 1,10,11,13 + * 14 1,5,9,14 + * 15 1,15 + * 16 1,5,14,16 + * 17 1,15 + * 18 1,12 + */ + +#define TAP_2 ((1<<1)|(1<<0)) +#define TAP_3 ((1<<2)|(1<<0)) +#define TAP_4 ((1<<3)|(1<<0)) +#define TAP_5 ((1<<4)|(1<<1)) +#define TAP_6 ((1<<5)|(1<<0)) +#define TAP_7 ((1<<6)|(1<<0)) +#define TAP_8 ((1<<7)|(1<<3)|(1<<2)|(1<<1)) +#define TAP_9 ((1<<8)|(1<<3)) +#define TAP_10 ((1<<9)|(1<<2)) +#define TAP_11 ((1<<10)|(1<<1)) +#define TAP_12 ((1<<11)|(1<<5)|(1<<3)|(1<<0)) +#define TAP_13 ((1<<12)|(1<<3)|(1<<2)|(1<<0)) +#define TAP_14 ((1<<13)|(1<<9)|(1<<5)|(1<<0)) +#define TAP_15 ((1<<14)|(1<<0)) +#define TAP_16 ((1<<15)|(1<<11)|(1<<2)|(1<<0)) +#define TAP_17 ((1<<16)|(1<<2)) +#define TAP_18 ((1<<17)|(1<<6)) + +#define MASK_2 ((1<<2)-1) +#define MASK_3 ((1<<3)-1) +#define MASK_4 ((1<<4)-1) +#define MASK_5 ((1<<5)-1) +#define MASK_6 ((1<<6)-1) +#define MASK_7 ((1<<7)-1) +#define MASK_8 ((1<<8)-1) +#define MASK_9 ((1<<9)-1) +#define MASK_10 ((1<<10)-1) +#define MASK_11 ((1<<11)-1) +#define MASK_12 ((1<<12)-1) +#define MASK_13 ((1<<13)-1) +#define MASK_14 ((1<<14)-1) +#define MASK_15 ((1<<15)-1) +#define MASK_16 ((1<<16)-1) +#define MASK_17 ((1<<17)-1) +#define MASK_18 ((1<<18)-1) + +#define TAPS TAP_12 +#define MASK MASK_12 + +/* ---------------------------------------------------------------------- */ + +extern __inline__ unsigned int hweight32(unsigned int w) +{ + unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555); + res = (res & 0x33333333) + ((res >> 2) & 0x33333333); + res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F); + res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF); + return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF); +} + +/* ---------------------------------------------------------------------- */ + +static int fcmatprintf(FILE *f, const char *name, unsigned int size1, unsigned int stride1, + unsigned int size2, unsigned int stride2, const cplxfloat_t *m) +{ + unsigned int i, j; + int ret = 0; + + fprintf(f, "%s = [", name); + for (i = 0; i < size1; i++) { + for (j = 0; j < size2; j++) { + ret += fprintf(f, " %g", real(m[i*stride1 + j*stride2])); + if (imag(m[i*stride1 + j*stride2]) != 0) + ret += fprintf(f, "%+gi", imag(m[i*stride1 + j*stride2])); + } + if (i+1 < size1) + ret += fprintf(f, " ; ...\n "); + } + ret += fprintf(f, " ];\n"); + return ret; +} + +static inline unsigned int inttogray(unsigned int x) +{ + unsigned int y, r = 0; + + for (y = 1; y <= 0x80; y <<= 1) + r |= ((x+y)>>1) & y; + return r; +} + +/* ---------------------------------------------------------------------- */ + +static unsigned int rndseed = 1; + +unsigned int random_num(void) +{ + unsigned int tmp2; + unsigned long long tmp; + + if (!rndseed) + return (rndseed = 1); + tmp = rndseed * 16807ULL; + tmp2 = (tmp & 0x7FFFFFFFU) + (tmp >> 31); + if (tmp2 >= 0x7FFFFFFFU) + tmp2 -= 0x7FFFFFFFU; + return (rndseed = tmp2); +} + +static void findtrainseq2(FILE *f, int trsymseq[TRAINSYMS], cplxint_t symmapping[(1<<(SYMBITS))]) +{ + cplxfloat_t symmap[(1<<(SYMBITS))], ct; + int trsym[2*TRAINSYMS]; + cplxfloat_t ma[OBSTRAINSYMS*CHANNELLEN], mah[CHANNELLEN*OBSTRAINSYMS], maha[CHANNELLEN*CHANNELLEN]; + float odmax, odmaxmin = FLT_MAX, ft; + unsigned int cnt, i, j; + + /* first calculate symbol mapping */ + for (i = 0; i < (1<<(SYMBITS)); i++) { + symmap[i].re = symmapping[i].re * (1.0 / 32767); + symmap[i].im = symmapping[i].im * (1.0 / 32767); + } + for (cnt = 0; cnt < 20000; cnt++) { + for (i = 0; i < TRAINSYMS; i++) + trsym[i+TRAINSYMS] = trsym[i] = random_num() & SYMBITMASK; + for (i = 0; i < OBSTRAINSYMS; i++) + for (j = 0; j < CHANNELLEN; j++) + ma[i*CHANNELLEN+j] = symmap[trsym[i+j]]; + fchermtranspose(mah, ma, OBSTRAINSYMS, CHANNELLEN); + fcmul(maha, mah, ma, CHANNELLEN, OBSTRAINSYMS, CHANNELLEN); + //fcmatprintf(f, "a", OBSTRAINSYMS, CHANNELLEN, CHANNELLEN, 1, ma); + //fcmatprintf(f, "aha", CHANNELLEN, CHANNELLEN, CHANNELLEN, 1, maha); + odmax = 0; + for (i = 0; i < CHANNELLEN; i++) + for (j = 0; j < i; j++) { + ct = maha[i*CHANNELLEN+j]; + ft = ct.re * ct.re + ct.im * ct.im; + if (ft > odmax) + odmax = ft; + } + if (odmax < odmaxmin) { + odmaxmin = odmax; + memcpy(trsymseq, trsym, TRAINSYMS*sizeof(trsymseq[0])); + } + //fprintf(f, "/* iter %3d offdiag max: %g maxmin: %g */\n", cnt, odmax, odmaxmin); + } + fprintf(f, "/* train sequence: min max offdiag a*a^H: %g */\n", odmaxmin); +} + +/* ---------------------------------------------------------------------- */ + +static void findtrainseq(FILE *f, int trsymseq[TRAINSYMS], cplxint_t symmapping[(1<<(SYMBITS))]) +{ + unsigned int pn = 0xaaaaaaaa; + unsigned int i, j, k, new; + + for (i = 0; i < TRAINSYMS; i++) { + for (k = j = 0; j < SYMBITS; j++) { + new = hweight32(pn & TAPS) & 1; + pn = ((pn << 1) | new) & MASK; + k = (k << 1) | new; + } + trsymseq[i] = k; + } +} + +/* ---------------------------------------------------------------------- */ + +static void gentrain(FILE *f) +{ + int trsym[2*TRAINSYMS]; + float sumr, sumi, expr, expi, vr, vi; + unsigned int i, j, k; + cplxfloat_t ma[OBSTRAINSYMS*CHANNELLEN], mah[CHANNELLEN*OBSTRAINSYMS], maha[CHANNELLEN*CHANNELLEN]; + cplxfloat_t mahainv[CHANNELLEN*CHANNELLEN], mahainvah[CHANNELLEN*OBSTRAINSYMS]; + double ph; + cplxint_t symmapping[(1<<(SYMBITS))]; + + /* first calculate symbol mapping */ + for (i = 0; i < (1<<(SYMBITS)); i++) { + j = inttogray(i) & ((1<<(SYMBITS))-1); + ph = i * (2.0 * M_PI / (1<<(SYMBITS))); + symmapping[j].re = 32767 * cos(ph); + symmapping[j].im = 32767 * sin(ph); + fprintf(f, "/* %02x %02x %6d%+6di */\n", i, j, symmapping[j].re, symmapping[j].im); + } + findtrainseq2(f, trsym, symmapping); + /*memcpy(&trsym[TRAINSYMS], trsym, sizeof(trsym)/2);*/ + fprintf(f, "\nconst cplxshort_t psk_symmapping[%u] = {", (1<<(SYMBITS))); + for (i = 0; ; i++) { + fprintf(f, "\n\t{ %d, %d }", symmapping[i].re, symmapping[i].im); + if (i >= (1<<(SYMBITS))-1) + break; + fprintf(f, ","); + } + fprintf(f, "\n};\n\n"); + /* calc training symbols */ + fprintf(f, "/*\n trsym = ["); + for (i = 0; i < TRAINSYMS; i++) { + trsym[i+TRAINSYMS] = trsym[i]; + fprintf(f, " %d%+di", symmapping[trsym[i]].re, symmapping[trsym[i]].im); + } + fprintf(f, " ];\n trsymcc = ["); + for (i = 0; i < TRAINSYMS; i++) { + for (sumr = sumi = 0, j = 0; j < TRAINSYMS; j++) { + sumr += symmapping[trsym[j]].re * symmapping[trsym[i+j]].re + + symmapping[trsym[j]].im * symmapping[trsym[i+j]].im; + sumi += symmapping[trsym[j]].im * symmapping[trsym[i+j]].re - + symmapping[trsym[j]].re * symmapping[trsym[i+j]].im; + } + fprintf(f, " %g%+gi", sumr * (1.0 / 32768 / 32768), sumi * (1.0 / 32768 / 32768)); + } + fprintf(f, " ];\n"); + for (i = 0; i < OBSTRAINSYMS; i++) + for (j = 0; j < CHANNELLEN; j++) { + ma[i*CHANNELLEN+j].re = symmapping[trsym[i+j]].re * (1.0 / 32768); + ma[i*CHANNELLEN+j].im = symmapping[trsym[i+j]].im * (1.0 / 32768); + } + fcmatprintf(f, "a", OBSTRAINSYMS, CHANNELLEN, CHANNELLEN, 1, ma); + /* transpose it */ + fchermtranspose(mah, ma, OBSTRAINSYMS, CHANNELLEN); + fcmul(maha, mah, ma, CHANNELLEN, OBSTRAINSYMS, CHANNELLEN); + fcinv(mahainv, maha, CHANNELLEN); + fcmul(mahainvah, mahainv, mah, CHANNELLEN, CHANNELLEN, OBSTRAINSYMS); + fcmatprintf(f, "ahainvah", CHANNELLEN, OBSTRAINSYMS, OBSTRAINSYMS, 1, mahainvah); + fprintf(f, " */\n\n"); + /* generate C code */ + fprintf(f, "\nstatic const unsigned char trainsyms[%u] = {\n\t", TRAINSYMS); + for (i = 0;;) { + fprintf(f, "%d", trsym[i]); + if ((++i) >= TRAINSYMS) + break; + if (!(i & 15)) { + fprintf(f, ",\n\t"); + continue; + } + fprintf(f, ", "); + } +#if 0 + fprintf(f, "\n};\n\nstatic const cplxshort_t traincorr[%u] = {\n", TRAINSYMS); + for (i = 0;;) { + if (!(i & 3)) + fprintf(f, "\n\t"); + fprintf(f, "{ %d, %d }", symmapping[trsym[i]].re, -symmapping[trsym[i]].im); + if (i >= (TRAINSYMS-1)) + break; + i++; + fprintf(f, ", "); + } +#endif + fprintf(f, "\n};\n\nstatic const cplxshort_t traincorrrotated[%u] = {\n", TRAINSYMS); + ph = 2.0 * M_PI * FCARRIER / SYMRATE; + for (i = 0;;) { + if (!(i & 3)) + fprintf(f, "\n\t"); + sumr = symmapping[trsym[i]].re; + sumi = -symmapping[trsym[i]].im; + expr = cos(ph * i); + expi = -sin(ph * i); + vr = sumr * expr - sumi * expi; + vi = sumr * expi + sumi * expr; + fprintf(f, "{ %d, %d }", (int)vr, (int)vi); + if (i >= (TRAINSYMS-1)) + break; + i++; + fprintf(f, ", "); + } +#if 0 + fprintf(f, "\n};\n\nstatic const cplxshort_t trainmat[%u] = {\n", CHANNELLEN*OBSTRAINSYMS); + for (i = 0; i < CHANNELLEN; i++) { + fprintf(f, "\t"); + for (j = 0; j < OBSTRAINSYMS; j++) { + fprintf(f, "{ %d, %d }", (int)((float)(1 << 16) * mahainvah[i*OBSTRAINSYMS+j].re), + (int)((float)(1 << 16) * mahainvah[i*OBSTRAINSYMS+j].im)); + if (i == CHANNELLEN-1 && j == OBSTRAINSYMS-1) + continue; + if ((j & 7) == 7 && j != OBSTRAINSYMS-1) { + fprintf(f, ",\n\t"); + continue; + } + fprintf(f, ", "); + } + fprintf(f, "\n"); + } +#endif + fprintf(f, "\n};\n\nstatic const cplxshort_t trainmatrotated[%u] = {\n", CHANNELLEN*OBSTRAINSYMS); + ph = -2.0 * M_PI * FCARRIER / SYMRATE; + for (i = 0; i < CHANNELLEN; i++) { + fprintf(f, "\t"); + for (j = 0; j < OBSTRAINSYMS; j++) { + k = i*OBSTRAINSYMS+j; + sumr = (float)(1 << 16) * mahainvah[k].re; + sumi = (float)(1 << 16) * mahainvah[k].im; + expr = cos(ph * (OBSTRAINSYMS-j)); + expi = -sin(ph * (OBSTRAINSYMS-j)); + vr = sumr * expr - sumi * expi; + vi = sumr * expi + sumi * expr; + fprintf(f, "{ %d, %d }", (int)(vr), (int)(vi)); + if (i == CHANNELLEN-1 && j == OBSTRAINSYMS-1) + continue; + if ((j & 7) == 7 && j != OBSTRAINSYMS-1) { + fprintf(f, ",\n\t"); + continue; + } + fprintf(f, ", "); + } + fprintf(f, "\n"); + } + fprintf(f, "};\n\n"); + /* calculate MLSE root and toor node */ + for (i = j = 0; i < CHANNELLEN-1; i++) + j |= trsym[TRAINSYMS-1-i] << (i * SYMBITS); + fprintf(f, "#define MLSEROOTNODE 0x%x\n", j); + for (i = j = 0; i < CHANNELLEN-1; i++) + j |= trsym[CHANNELLEN-2-i] << (i * SYMBITS); + fprintf(f, "#define MLSETOORNODE 0x%x\n\n", j); +} + +#define TXRCOSALPHA 0.4 +#define RXRCOSALPHA 0.4 + +#define TXFILTERRELAX 1.4 +#define RXFILTERRELAX 1.4 + +static inline double sinc(double x) +{ + double arg = x * M_PI; + + if (fabs(arg) < 1e-10) + return 1; + return sin(arg) / arg; +} + +static inline double hamming(double x) +{ + return 0.54-0.46*cos((2*M_PI)*x); +} + +static void gentxfilt(FILE *f) +{ + float coeff[TXFILTLEN * TXFILTOVER]; + double tmul, at, t, f1, f2; + int i, j; + + tmul = 1.0 / TXFILTOVER; +#if 0 + tmul *= TXFILTERRELAX; + for (i = 0; i < TXFILTLEN * TXFILTOVER; i++) + coeff[i] = sinc((i - 0.5 * TXFILTLEN * TXFILTOVER)*tmul) + * hamming(i * (1.0 / (TXFILTLEN * TXFILTOVER - 1))); +#else + for (i = 0; i < TXFILTLEN * TXFILTOVER; i++) { + t = (i - 0.5 * TXFILTLEN * TXFILTOVER) * tmul; + at = t * TXRCOSALPHA; + f1 = 1 - 4 * at * at; + if (fabs(f1) < 1e-10) + f2 = M_PI * (1.0 / 8.0) * sin(M_PI * at) / at; + else + f2 = cos(M_PI * at) / f1; + coeff[i] = sinc(t) * f2; + } +#endif + for (f1 = 0, i = 0; i < TXFILTOVER; i++) { + for (f2 = 0, j = 0; j < TXFILTLEN; j++) + f2 += fabs(coeff[j*TXFILTOVER+i]); + if (f2 > f1) + f1 = f2; + } + f2 = 32767 / f1; + fprintf(f, "/*\n txfilt = ["); + for (i = 0;;) { + fprintf(f, " %g ;", coeff[i]); + if ((++i) >= TXFILTLEN * TXFILTOVER) + break; + if (i & 3) + continue; + fprintf(f, "\n "); + } + fprintf(f, " ];\n abssum = %g;\n semilogy((0:%u)/%u,abs(fft(txfilt)))\n */\n\n", + f1, TXFILTLEN * TXFILTOVER - 1, TXFILTLEN * TXFILTOVER); + /* output C array with filter coefficients */ + fprintf(f, "static const int txfilter[%u][%u] = {", TXFILTOVER, TXFILTLEN); + for (i = 0;;) { + fprintf(f, "\n\t{"); + for (j = 0;;) { + fprintf(f, " %d", (int)(f2 * coeff[j*TXFILTOVER+i])); + if ((++j) >= TXFILTLEN) + break; + fprintf(f, ","); + } + fprintf(f, " }"); + if ((++i) >= TXFILTOVER) + break; + fprintf(f, ","); + } + fprintf(f, "\n};\n\n"); +} + +static void genrxfilt(FILE *f) +{ + float coeff[RXFILTLEN * RXFILTOVER]; + double tmul, at, t, f1, f2; + int i, j, k; + + tmul = 1.0 * SYMRATE / RXFILTOVER / SAMPLERATE; +#if 1 + tmul *= RXFILTERRELAX; + for (i = 0; i < RXFILTLEN * RXFILTOVER; i++) + coeff[i] = sinc((i - 0.5 * RXFILTLEN * RXFILTOVER)*tmul) + * hamming(i * (1.0 / (RXFILTLEN * RXFILTOVER - 1))); +#else + for (i = 0; i < RXFILTLEN * RXFILTOVER; i++) { + t = (i - 0.5 * RXFILTLEN * RXFILTOVER) * tmul; + at = t * RXRCOSALPHA; + f1 = 1 - 4 * at * at; + if (fabs(f1) < 1e-10) + f2 = M_PI * (1.0 / 8.0) * sin(M_PI * at) / at; + else + f2 = cos(M_PI * at) / f1; + coeff[i] = sinc(t) * f2; + } +#endif + for (f1 = 0, i = 0; i < RXFILTOVER; i++) { + for (f2 = 0, j = 0; j < RXFILTLEN; j++) + f2 += fabs(coeff[j*RXFILTOVER+i]); + if (f2 > f1) + f1 = f2; + } + f2 = 65535 / f1; + fprintf(f, "/*\n rxfilt = ["); + for (i = 0;;) { + fprintf(f, " %g ;", coeff[i]); + if ((++i) >= RXFILTLEN * RXFILTOVER) + break; + if (i & 3) + continue; + fprintf(f, "\n "); + } + fprintf(f, " ];\n abssum = %g;\n semilogy((0:%u)/%u,abs(fft(rxfilt)))\n */\n\n", + f1, RXFILTLEN * RXFILTOVER - 1, RXFILTLEN * RXFILTOVER); + /* output C array with filter coefficients */ +#if 0 + fprintf(f, "static const int rxfilter[%u][%u] = {", RXFILTOVER, RXFILTLEN); + for (i = 0;;) { + fprintf(f, "\n\t{"); + for (j = 0;;) { + fprintf(f, " %d", (int)(f2 * coeff[j*RXFILTOVER+i])); + if ((++j) >= RXFILTLEN) + break; + fprintf(f, ","); + } + fprintf(f, " }"); + if ((++i) >= RXFILTOVER) + break; + fprintf(f, ","); + } + fprintf(f, "\n};\n\n"); +#endif + /* output C arrays with filter coefficients and downmixing combined */ + tmul = -2.0 * M_PI * FCARRIER / RXFILTOVER / SAMPLERATE; + /* warning: filter runs backwards! */ + fprintf(f, "static const int rxfilter_re[%u][%u] = {", RXFILTOVER, RXFILTLEN); + for (i = RXFILTOVER-1;;) { + fprintf(f, "\n\t{"); + for (j = 0;;) { + k = j*RXFILTOVER+i; + fprintf(f, " %d", (int)(f2 * coeff[k] * cos(tmul * k))); + if ((++j) >= RXFILTLEN) + break; + fprintf(f, ","); + } + fprintf(f, " }"); + if (!(i--)) + break; + fprintf(f, ","); + } + fprintf(f, "\n};\n\nstatic const int rxfilter_im[%u][%u] = {", RXFILTOVER, RXFILTLEN); + for (i = RXFILTOVER-1;;) { + fprintf(f, "\n\t{"); + for (j = 0;;) { + k = j*RXFILTOVER+i; + fprintf(f, " %d", (int)(f2 * coeff[k] * sin(tmul * k))); + if ((++j) >= RXFILTLEN) + break; + fprintf(f, ","); + } + fprintf(f, " }"); + if (!(i--)) + break; + fprintf(f, ","); + } + fprintf(f, "\n};\n\n"); + /* output C arrays with filter coefficients and downmixing combined; int16 format (useful for mmx) */ + tmul = -2.0 * M_PI * FCARRIER / RXFILTOVER / SAMPLERATE; + /* warning: filter runs backwards! */ + fprintf(f, "static const int16_t rxfilter_re_16[%u][%u] = {", RXFILTOVER, RXFILTLEN); + for (i = RXFILTOVER-1;;) { + fprintf(f, "\n\t{"); + for (j = 0;;) { + k = j*RXFILTOVER+i; + fprintf(f, " %d", (int)(f2 * coeff[k] * cos(tmul * k))); + if ((++j) >= RXFILTLEN) + break; + fprintf(f, ","); + } + fprintf(f, " }"); + if (!(i--)) + break; + fprintf(f, ","); + } + fprintf(f, "\n};\n\nstatic const int16_t rxfilter_im_16[%u][%u] = {", RXFILTOVER, RXFILTLEN); + for (i = RXFILTOVER-1;;) { + fprintf(f, "\n\t{"); + for (j = 0;;) { + k = j*RXFILTOVER+i; + fprintf(f, " %d", (int)(f2 * coeff[k] * sin(tmul * k))); + if ((++j) >= RXFILTLEN) + break; + fprintf(f, ","); + } + fprintf(f, " }"); + if (!(i--)) + break; + fprintf(f, ","); + } + fprintf(f, "\n};\n\n"); +} + +#define COSBITS 9 + +static void gencos(FILE *f) +{ + unsigned int i; + + fprintf(f, "static const short costab[%u] = {", (1<<(COSBITS))); + for (i = 0; ; i++) { + if (!(i & 7)) + fprintf(f, "\n\t"); + fprintf(f, "%6d", (int)(32767*cos(i * (2.0 * M_PI / (1<<(COSBITS)))))); + if (i >= (1<<(COSBITS))-1) + break; + fprintf(f, ", "); + } + fprintf(f, "\n};\n\n#define COS(x) (costab[(((x)>>%u)&0x%x)])\n#define SIN(x) COS((x)+0xc000)\n\n", + 16-COSBITS, (1<<(COSBITS))-1); +} + + +/* ---------------------------------------------------------------------- */ + +int main(int argc, char *argv[]) +{ + gentrain(stdout); + gentxfilt(stdout); + genrxfilt(stdout); + gencos(stdout); + return 0; +} diff --git a/pskmodem/meas.h b/pskmodem/meas.h new file mode 100644 index 0000000..09b3bf2 --- /dev/null +++ b/pskmodem/meas.h @@ -0,0 +1,72 @@ +/*****************************************************************************/ + +/* + * meas.h -- Measurement utility. + * + * Copyright (C) 1999 Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please note that the GPL allows you to use the driver, NOT the radio. + * In order to use the radio, you need a license from the communications + * authority of your country. + * + */ + +/*****************************************************************************/ + +#ifndef _MEAS_H +#define _MEAS_H + +/* ---------------------------------------------------------------------- */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +/* ---------------------------------------------------------------------- */ + +/* + * Bittypes + */ + +#ifndef HAVE_BITTYPES + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) +typedef int int8_t __attribute__((__mode__(__QI__))); +typedef unsigned int u_int8_t __attribute__((__mode__(__QI__))); +typedef int int16_t __attribute__((__mode__(__HI__))); +typedef unsigned int u_int16_t __attribute__((__mode__(__HI__))); +typedef int int32_t __attribute__((__mode__(__SI__))); +typedef unsigned int u_int32_t __attribute__((__mode__(__SI__))); +typedef int int64_t __attribute__((__mode__(__DI__))); +typedef unsigned int u_int64_t __attribute__((__mode__(__DI__))); +#else +typedef char /* deduced */ int8_t __attribute__((__mode__(__QI__))); +typedef unsigned char /* deduced */ u_int8_t __attribute__((__mode__(__QI__))); +typedef short /* deduced */ int16_t __attribute__((__mode__(__HI__))); +typedef unsigned short /* deduced */ u_int16_t __attribute__((__mode__(__HI__))); +typedef long /* deduced */ int32_t __attribute__((__mode__(__SI__))); +typedef unsigned long /* deduced */ u_int32_t __attribute__((__mode__(__SI__))); +typedef long long /* deduced */ int64_t __attribute__((__mode__(__DI__))); +typedef unsigned long long /* deduced */ u_int64_t __attribute__((__mode__(__DI__))); +#endif + +#endif /* !HAVE_BITTYPES */ + +/* ---------------------------------------------------------------------- */ +#endif /* _MEAS_H */ diff --git a/pskmodem/measpsk.c b/pskmodem/measpsk.c new file mode 100644 index 0000000..9f0aee1 --- /dev/null +++ b/pskmodem/measpsk.c @@ -0,0 +1,587 @@ +/*****************************************************************************/ + +/* + * measpsk.c -- Measurement utility for the Kurtosis function. + * + * Copyright (C) 1998 Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please note that the GPL allows you to use the driver, NOT the radio. + * In order to use the radio, you need a license from the communications + * authority of your country. + * + */ + +/*****************************************************************************/ + +#include "meas.h" + +#ifdef HAVE_STROPTS_H +#include +#endif +#ifdef HAVE_SYS_CONF_H +#include +#endif +#ifdef HAVE_SYS_IOCTL_H +#include +#endif +#ifdef HAVE_SYS_AUDIOIO_H +#include +#endif +#ifdef HAVE_SYS_SOUNDCARD_H +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "getopt.h" + +#include "mat.h" + +/* ---------------------------------------------------------------------- */ + +static int done = 0; + +/* ---------------------------------------------------------------------- */ + +#define SAMPLERATE /*9600*/14400 + +#define LPFLEN 64 +#define LPFOVER 4 +#define FCARRIER /*1800*//*3000*/2400 +#define FCARRIERINC ((((FCARRIER)<<16)+(SAMPLERATE))/(SAMPLERATE)) + +static const float lpfcoeff[LPFLEN] = { + -0.000381, -0.000855, -0.000610, 0.000326, + 0.001286, 0.001263, -0.000196, -0.002150, + -0.002614, -0.000351, 0.003324, 0.004906, + 0.001762, -0.004534, -0.008329, -0.004598, + 0.005339, 0.013047, 0.009608, -0.005075, + -0.019314, -0.018044, 0.002655, 0.027887, + 0.032834, 0.004352, -0.041718, -0.064606, + -0.025668, 0.079625, 0.210100, 0.299929, + 0.299929, 0.210100, 0.079625, -0.025668, + -0.064606, -0.041718, 0.004352, 0.032834, + 0.027887, 0.002655, -0.018044, -0.019314, + -0.005075, 0.009608, 0.013047, 0.005339, + -0.004598, -0.008329, -0.004534, 0.001762, + 0.004906, 0.003324, -0.000351, -0.002614, + -0.002150, -0.000196, 0.001263, 0.001286, + 0.000326, -0.000610, -0.000855, -0.000381 +}; + +#define COSTABSHIFT 8 +#define COSTABSZ (1<<(COSTABSHIFT)) + +#define COS(x) (costab[((x)>>(16-COSTABSHIFT))&(COSTABSZ-1)]) +#define SIN(x) COS((x)+0xc000) + +static float costab[COSTABSZ]; + +/* ---------------------------------------------------------------------- */ +/* + * Linux OSS audio + */ + +#if defined(HAVE_SYS_SOUNDCARD_H) + +static char *soundpath = "/dev/dsp"; + +int sound_init(int sample_rate, int *sr) +{ + int fd, sndparam; + + fprintf(stderr, "sound: starting \"%s\"\n", soundpath); + if ((fd = open(soundpath, O_RDWR)) < 0) { + fprintf(stderr, "sound: Error, cannot open \"%s\"\n", soundpath); + return -1; + } + sndparam = AFMT_S16_LE; /* we want 16 bits/sample signed */ + /* little endian; works only on little endian systems! */ + if (ioctl(fd, SNDCTL_DSP_SETFMT, &sndparam) == -1) { + fprintf(stderr, "sound: Error, cannot set sample size\n"); + return -1; + } + if (sndparam != AFMT_S16_LE) { + fprintf(stderr, "sound: Error, cannot set sample size to 16 bits\n"); + return -1; + } + sndparam = 0; /* we want only 1 channel */ + if (ioctl(fd, SNDCTL_DSP_STEREO, &sndparam) == -1) { + fprintf(stderr, "sound: Error, cannot set the channel number\n"); + return -1; + } + if (sndparam != 0) { + fprintf(stderr, "sound: Error, cannot set the channel number to 1\n"); + return -1; + } + sndparam = sample_rate; + if(ioctl(fd, SNDCTL_DSP_SPEED, &sndparam) == -1) { + fprintf(stderr, "sound: Error, cannot set the sample " + "rate\n"); + return -1; + } + if (sr) + *sr = sndparam; + return fd; +} + +/* ---------------------------------------------------------------------- */ +/* + * Sun audio + */ + +#elif defined(HAVE_SYS_AUDIOIO_H) + +static char *soundpath = "/dev/audio"; + +int sound_init(int sample_rate, int *sr) +{ + audio_info_t audioinfo; + audio_info_t audioinfo2; + audio_device_t audiodev; + int fd; + + fprintf(stderr, "sound: starting \"%s\"\n", soundpath); + if ((fd = open(soundpath, O_RDWR)) < 0) { + fprintf(stderr, "sound: Error, cannot open \"%s\"\n", soundpath); + return -1; + } + if (ioctl(fd, AUDIO_GETDEV, &audiodev) == -1) { + fprintf(stderr, "sound: Error, cannot get audio dev\n"); + return -1; + } + fprintf(stderr, "sound: Audio device: name %s, ver %s, config %s\n", + audiodev.name, audiodev.version, audiodev.config); + AUDIO_INITINFO(&audioinfo); + audioinfo.play.sample_rate = audioinfo.record.sample_rate = sample_rate; + audioinfo.play.channels = audioinfo.record.channels = 1; + audioinfo.play.precision = audioinfo.record.precision = 16; + audioinfo.play.encoding = audioinfo.record.encoding = AUDIO_ENCODING_LINEAR; + //audioinfo.record.gain = 0x20; + audioinfo.record.port = AUDIO_LINE_IN; + //audioinfo.monitor_gain = 0; + if (ioctl(fd, AUDIO_SETINFO, &audioinfo) == -1) { + fprintf(stderr, "sound: Error, cannot set audio params\n"); + return -1; + } + if (ioctl(fd, I_FLUSH, FLUSHR) == -1) { + fprintf(stderr, "sound: Error, cannot flush\n"); + return -1; + } + if (ioctl(fd, AUDIO_GETINFO, &audioinfo2) == -1) { + fprintf(stderr, "sound: Error, cannot set audio params\n"); + return -1; + } + if (sr) + *sr = audioinfo.record.sample_rate; + return fd; +} + +#endif + +/* --------------------------------------------------------------------- */ +/* + * Maximum length shift register connections + * (cf. Proakis, Digital Communications, p. 399 + * + * 2 1,2 + * 3 1,3 + * 4 1,4 + * 5 1,4 + * 6 1,6 + * 7 1,7 + * 8 1,5,6,7 + * 9 1,6 + * 10 1,8 + * 11 1,10 + * 12 1,7,9,12 + * 13 1,10,11,13 + * 14 1,5,9,14 + * 15 1,15 + * 16 1,5,14,16 + * 17 1,15 + * 18 1,12 + */ + +#define TAP_2 ((1<<1)|(1<<0)) +#define TAP_3 ((1<<2)|(1<<0)) +#define TAP_4 ((1<<3)|(1<<0)) +#define TAP_5 ((1<<4)|(1<<1)) +#define TAP_6 ((1<<5)|(1<<0)) +#define TAP_7 ((1<<6)|(1<<0)) +#define TAP_8 ((1<<7)|(1<<3)|(1<<2)|(1<<1)) +#define TAP_9 ((1<<8)|(1<<3)) +#define TAP_10 ((1<<9)|(1<<2)) +#define TAP_11 ((1<<10)|(1<<1)) +#define TAP_12 ((1<<11)|(1<<5)|(1<<3)|(1<<0)) +#define TAP_13 ((1<<12)|(1<<3)|(1<<2)|(1<<0)) +#define TAP_14 ((1<<13)|(1<<9)|(1<<5)|(1<<0)) +#define TAP_15 ((1<<14)|(1<<0)) +#define TAP_16 ((1<<15)|(1<<11)|(1<<2)|(1<<0)) +#define TAP_17 ((1<<16)|(1<<2)) +#define TAP_18 ((1<<17)|(1<<6)) + +#define MASK_2 ((1<<2)-1) +#define MASK_3 ((1<<3)-1) +#define MASK_4 ((1<<4)-1) +#define MASK_5 ((1<<5)-1) +#define MASK_6 ((1<<6)-1) +#define MASK_7 ((1<<7)-1) +#define MASK_8 ((1<<8)-1) +#define MASK_9 ((1<<9)-1) +#define MASK_10 ((1<<10)-1) +#define MASK_11 ((1<<11)-1) +#define MASK_12 ((1<<12)-1) +#define MASK_13 ((1<<13)-1) +#define MASK_14 ((1<<14)-1) +#define MASK_15 ((1<<15)-1) +#define MASK_16 ((1<<16)-1) +#define MASK_17 ((1<<17)-1) +#define MASK_18 ((1<<18)-1) + +#define TAPS TAP_12 +#define MASK MASK_12 + +/* ---------------------------------------------------------------------- */ + +extern __inline__ unsigned int hweight32(unsigned int w) +{ + unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555); + res = (res & 0x33333333) + ((res >> 2) & 0x33333333); + res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F); + res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF); + return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF); +} + +/* ---------------------------------------------------------------------- */ + +#define TXBUFSZ 256 + +static struct txstate { + unsigned int scrami; + unsigned int scramq; + unsigned int shregi; + unsigned int shregq; + unsigned int carphase; + unsigned int txwr, txrd; + int16_t txbuf[TXBUFSZ]; +} txstate = { 1, 15, }; + +static float txcalcfilt(unsigned int bits, const float *f) +{ + unsigned int i; + float s = 0; + + for (i = 0; i < (LPFLEN/LPFOVER); i++, f += LPFOVER, bits >>= 1) + if (bits & 1) + s += *f; + else + s -= *f; + return s; +} + +static void transmit(int fd, struct txstate *t) +{ + int ret; + unsigned int i, j, new; + float sr, si; + + if (t->txrd >= t->txwr) { + t->txrd = 0; + for (i = 0; i <= (TXBUFSZ-LPFOVER); i += LPFOVER) { + /* update scramblers */ + new = hweight32(t->scrami & TAPS) & 1; + t->scrami = ((t->scrami << 1) | new) & MASK; + t->shregi = (t->shregi << 1) | new; + new = hweight32(t->scramq & TAPS) & 1; + t->scramq = ((t->scramq << 1) | new) & MASK; + t->shregq = (t->shregq << 1) | new; + /* calculate filter values */ + for (j = 0; j < LPFOVER; j++) { + sr = txcalcfilt(t->shregi, lpfcoeff+j); + si = txcalcfilt(t->shregq, lpfcoeff+j); + t->txbuf[i+j] = 16000 * (sr * COS(t->carphase) - si * SIN(t->carphase)); + t->carphase += FCARRIERINC; + } + } + t->txwr = i; + } + ret = write(fd, &t->txbuf[t->txrd], (t->txwr - t->txrd) * sizeof(t->txbuf[0])); + if (ret < 0) { + perror("write"); + exit(1); + } + t->txrd += ret / sizeof(t->txbuf[0]); +} + +/* ---------------------------------------------------------------------- */ + +#define RXBUFSZ (4*TXBUFSZ) + +static struct rxstate { + unsigned int rxwr; + int16_t rxbuf[RXBUFSZ]; +} rxstate = { 0, }; + +static void receive(int fd, struct rxstate *r) +{ + int ret; + + ret = read(fd, &r->rxbuf[r->rxwr], (RXBUFSZ - r->rxwr) * sizeof(r->rxbuf[0])); + if (ret < 0) { + if (errno == EAGAIN || errno == EINTR) + return; + perror("read"); + exit(1); + } + r->rxwr = (r->rxwr + ret / sizeof(r->rxbuf[0])) % RXBUFSZ; +} + +/* ---------------------------------------------------------------------- */ + +RETSIGTYPE sigterm() +{ + done = 1; +} + +/* ---------------------------------------------------------------------- */ + +static int frmatprintf(const char *name, unsigned int size1, unsigned int stride1, + unsigned int size2, unsigned int stride2, const float *m) +{ + unsigned int i, j; + int ret = 0; + + fprintf(stdout, "%s = [", name); + for (i = 0; i < size1; i++) { + for (j = 0; j < size2; j++) + ret += fprintf(stdout, " %g", m[i*stride1 + j*stride2]); + if (i+1 < size1) + ret += fprintf(stdout, " ;\n "); + } + ret += fprintf(stdout, " ];\n"); + return ret; +} + +static int fcmatprintf(const char *name, unsigned int size1, unsigned int stride1, + unsigned int size2, unsigned int stride2, const cplxfloat_t *m) +{ + unsigned int i, j; + int ret = 0; + + fprintf(stdout, "%s = [", name); + for (i = 0; i < size1; i++) { + for (j = 0; j < size2; j++) { + ret += fprintf(stdout, " %g", real(m[i*stride1 + j*stride2])); + if (imag(m[i*stride1 + j*stride2]) != 0) + ret += fprintf(stdout, "%+gi", imag(m[i*stride1 + j*stride2])); + } + if (i+1 < size1) + ret += fprintf(stdout, " ; ...\n "); + } + ret += fprintf(stdout, " ];\n"); + return ret; +} + +static cplxfloat_t crosscorr(cplxfloat_t *data, unsigned int scrami, unsigned int scramq) +{ + unsigned int i, newi, newq; + cplxfloat_t sum, c; + + cplx(sum, 0, 0); + for (i = 0; i < ((RXBUFSZ-LPFLEN)/LPFOVER); i++, data += LPFOVER) { + newi = hweight32(scrami & TAPS) & 1; + scrami = ((scrami << 1) | newi) & MASK; + newq = hweight32(scramq & TAPS) & 1; + scramq = ((scramq << 1) | newq) & MASK; + cplx(c, newi ? 1 : -1, newq ? -1 : 1); + cmac(sum, c, *data); + } + return sum; +} + +static inline cplxfloat_t rxfilter(const cplxfloat_t *p) +{ + cplxfloat_t r; + const float *c = lpfcoeff; + unsigned int i; + + cplx(r, 0, 0); + for (i = 0; i < LPFLEN; i++, p++, c++) + cmacs(r, *p, *c); + return r; +} + +#define CHLEN 16 +#define OBSLEN 128 + +static void processrx(struct rxstate *rxs) +{ + cplxfloat_t rxbuf[RXBUFSZ]; + unsigned int i, j, new, pnregi, pnregq, pnregmi, pnregmq, maxidx; + cplxfloat_t corr; + float maxv, corrv; + cplxfloat_t ma[OBSLEN*CHLEN], mah[CHLEN*OBSLEN], maha[CHLEN*CHLEN], mahainv[CHLEN*CHLEN], mr[OBSLEN], mahr[CHLEN], mc[CHLEN]; + + /* copy it to a linear buffer and downmix it */ + new = 0; + j = rxs->rxwr; + for (i = 0; i < RXBUFSZ; i++) { + cplx(rxbuf[i], rxs->rxbuf[j] * COS(new), rxs->rxbuf[j] * SIN(new)); + j++; + if (j >= RXBUFSZ) + j = 0; + new -= FCARRIERINC; + } + /* run lowpass filter over the receiver buffer (inplace) */ + for (i = 0; i <= (RXBUFSZ-LPFLEN); i++) + rxbuf[i] = rxfilter(&rxbuf[i]); + /* print received vector */ + printf("rxvec = [\n"); + for (i = 0; i < RXBUFSZ; i++) + printf(" %g%+gi\n", real(rxbuf[i]), imag(rxbuf[i])); + printf("];\n\n"); + /* calculate and print code correlation */ + printf("codecorr = [\n"); + maxv = 0; + maxidx = 0; + pnregmi = pnregi = 1; + pnregmq = pnregq = 15; /* must match transmitter! */ + do { + for (i = 0; i < LPFOVER; i++) { + corr = crosscorr(rxbuf+i, pnregi, pnregq); + corrv = real(corr) * real(corr) + imag(corr) * imag(corr); + if (fabs(corrv) > fabs(maxv)) { + maxv = corrv; + maxidx = i; + pnregmi = pnregi; + pnregmq = pnregq; + } + printf(" %g%+gi\n", real(corr), imag(corr)); + } + new = hweight32(pnregi & TAPS) & 1; + pnregi = ((pnregi << 1) | new) & MASK; + new = hweight32(pnregq & TAPS) & 1; + pnregq = ((pnregq << 1) | new) & MASK; + } while (pnregi != 1); + printf("];\n\n"); + if (maxv < 0) + printf("%% channel seems to be inverted\n\n"); + /* build and print A matrix */ + for (i = 0; i < OBSLEN; i++) { + pnregi = pnregmi; + pnregq = pnregmq; + for (j = 0; j < CHLEN; j++) { + new = hweight32(pnregi & TAPS) & 1; + pnregi = ((pnregi << 1) | new) & MASK; + real(ma[i*CHLEN+j]) = new ? 1 : -1; + new = hweight32(pnregq & TAPS) & 1; + pnregq = ((pnregq << 1) | new) & MASK; + imag(ma[i*CHLEN+j]) = new ? 1 : -1; + } + new = hweight32(pnregmi & TAPS) & 1; + pnregmi = ((pnregmi << 1) | new) & MASK; + new = hweight32(pnregmq & TAPS) & 1; + pnregmq = ((pnregmq << 1) | new) & MASK; + } + fcmatprintf("a", OBSLEN, CHLEN, CHLEN, 1, ma); + /* transpose it */ + fchermtranspose(mah, ma, OBSLEN, CHLEN); + fcmatprintf("ah", CHLEN, OBSLEN, OBSLEN, 1, mah); + fcmul(maha, mah, ma, CHLEN, OBSLEN, CHLEN); + fcmatprintf("aha", CHLEN, CHLEN, CHLEN, 1, maha); + fcinv(mahainv, maha, CHLEN); + fcmatprintf("ahainv", CHLEN, CHLEN, CHLEN, 1, mahainv); + /* build received vector */ + for (i = 0; i < OBSLEN; i++) + mr[i] = rxbuf[CHLEN/2*LPFOVER+i*LPFOVER+maxidx]; + fcmatprintf("r", 1, 0, OBSLEN, 1, mr); + fcmul(mahr, mah, mr, CHLEN, OBSLEN, 1); + fcmatprintf("ahr", 1, 0, CHLEN, 1, mahr); + fcmul(mc, mahainv, mahr, CHLEN, CHLEN, 1); + fcmatprintf("mc", 1, 0, CHLEN, 1, mc); + printf("%%\nmcf = fft(mc) / sqrt(sum(abs(mc).^2));\nsemilogy((0:size(mcf,2)-1)/size(mcf,2)*2400,abs(mcf));\n"); +} + +/* ---------------------------------------------------------------------- */ + +#define OUTBUFSIZE 1024 +#define INBUFSIZE 65536 + +int main(int argc, char *argv[]) +{ + static const struct option long_options[] = { + {0, 0, 0, 0} + }; + struct pollfd pfd[1]; + int fd, i, c; + + while ((c = getopt_long (argc, argv, "", long_options, NULL)) != EOF) { + switch (c) { + default: + fprintf(stderr, "usage: meas \n"); + exit(1); + } + } + /* initialize cosine table */ + for (i = 0; i < COSTABSZ; i++) + costab[i] = cos(i * (2.0 * M_PI / COSTABSZ)); + /* start sound IO */ + if ((fd = sound_init(SAMPLERATE, &c)) == -1) { + fprintf(stderr, "Cannot open sound interface\n"); + exit(1); + } + fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK); + printf("%% Sampling rate requested %d, actual %d\n", SAMPLERATE, c); + signal(SIGTERM, sigterm); + signal(SIGHUP, sigterm); + signal(SIGINT, sigterm); + signal(SIGQUIT, sigterm); + do { + pfd[0].fd = fd; + pfd[0].events = POLLIN | POLLOUT; + i = poll(pfd, 1, 1000); + if (i < 0) { + if (errno == EINTR) + break; + perror("poll"); + exit(1); + } + if (!i || !(pfd[0].revents & (POLLIN | POLLOUT))) { + fprintf(stderr, "poll timeout\n"); + exit(1); + } + if (pfd[0].revents & POLLIN) + receive(fd, &rxstate); + if (pfd[0].revents & POLLOUT) + transmit(fd, &txstate); + } while (!done); + processrx(&rxstate); + close(fd); + exit(0); +} diff --git a/pskmodem/psk.h b/pskmodem/psk.h new file mode 100644 index 0000000..0302d88 --- /dev/null +++ b/pskmodem/psk.h @@ -0,0 +1,104 @@ +/*****************************************************************************/ + +/* + * psk.h -- Defines for the PSK modem. + * + * Copyright (C) 1999-2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please note that the GPL allows you to use the driver, NOT the radio. + * In order to use the radio, you need a license from the communications + * authority of your country. + * + */ + +/*****************************************************************************/ + +#ifndef _PSK_H +#define _PSK_H + +/* ---------------------------------------------------------------------- */ + +#define SAMPLERATE 9600 + +/* ---------------------------------------------------------------------- */ + +typedef struct { + short re; + short im; +} cplxshort_t; + +typedef struct { + int re; + int im; +} cplxint_t; + +/* ---------------------------------------------------------------------- */ + +#define FCARRIER 1800 +#define SYMRATE 2400 +#define SYMBITS 3 +#define TRAINSYMS 16 +#define OBSTRAINSYMS ((TRAINSYMS)-(CHANNELLEN)+1) +#define DATABYTES 48 +#define DATABITS ((DATABYTES) * 8) +#define DATASYMS (((DATABITS)+(SYMBITS)-1)/(SYMBITS)) +#define CHANNELLEN 3 + +#define SYMBITMASK ((1<<(SYMBITS))-1) + + +/* TxFilter */ +#define TXFILTLEN 16 +#define TXFILTOVERBITS 4 +#define TXFILTOVER (1<<(TXFILTOVERBITS)) +#define TXFILTFIDX(x) (((x)>>(16-(TXFILTOVERBITS)))&(TXFILTOVER-1)) +#define TXFILTFSAMP(x) ((x)>>16) + +/* RxFilter */ +#define RXFILTLEN 16 +#define RXFILTOVERBITS 3 +#define RXFILTOVER (1<<(RXFILTOVERBITS)) +#define RXFILTFIDX(x) (((x)>>(16-(RXFILTOVERBITS)))&(RXFILTOVER-1)) +#define RXFILTFSAMP(x) ((x)>>16) + +/* ---------------------------------------------------------------------- */ + +extern const cplxshort_t psk_symmapping[1<<(SYMBITS)]; + +/* ---------------------------------------------------------------------- */ + +#define MLSENRSYMB ((CHANNELLEN)-1) +#define MLSENODES (1<<((MLSENRSYMB)*(SYMBITS))) +#define MLSEMTABSIZE (1<<(((MLSENRSYMB)+1)*(SYMBITS))) +#define MLSESRCINC (1<<(((MLSENRSYMB)-1)*(SYMBITS))) +#define MLSEENERGYSH 6 + +typedef union { + struct metrictab { + int re; + int im; + } m[MLSEMTABSIZE]; + unsigned int simdm[MLSEMTABSIZE]; +} metrictab_t; + +extern void pskmlse_initmetric(const cplxshort_t *channel, metrictab_t *metrictab); +extern void pskmlse_trellis(unsigned int *nodemetric1, unsigned int *nodemetric2, metrictab_t *metrictab, unsigned short *backptr, int vr, int vi); + +/* ---------------------------------------------------------------------- */ +#endif /* _PSK_H */ + diff --git a/pskmodem/pskmlse.c b/pskmodem/pskmlse.c new file mode 100644 index 0000000..6fd1561 --- /dev/null +++ b/pskmodem/pskmlse.c @@ -0,0 +1,621 @@ +/*****************************************************************************/ + +/* + * pskmlse.c -- PSK modem Maximum Likelyhood Sequence Estimator. + * + * Copyright (C) 1999 Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please note that the GPL allows you to use the driver, NOT the radio. + * In order to use the radio, you need a license from the communications + * authority of your country. + * + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE +#define _REENTRANT + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "modem.h" +#include "psk.h" +#include "simd.h" + +#include + +/* ---------------------------------------------------------------------- */ + +/* + * Maximum Likelyhood Sequence Estimation + */ + +/* ---------------------------------------------------------------------- */ + +/* MMX MLSE */ + +#if defined(USEMMX) + +#define VEMMXINIT(vx,vy) \ +do { \ + asm volatile("movd %0,%%mm0 \n\t" \ + "punpckldq %%mm0,%%mm0 \n\t" \ + "movd %1,%%mm1 \n\t" \ + "punpckldq %%mm1,%%mm1 \n\t" \ + : : "r" ((((int)vx) & 0xffff) | (((int)vy) << 16)), "r" (MLSESRCINC)); \ +} while (0) + +#define VEMMXINTER0(metrictab,nodemetric1,x) \ +do { \ + asm volatile("movq %0,%%mm4 \n\t" /* load metrictab values */ \ + "movd %3,%%mm2 \n\t" /* first iteration: set index register */ \ + "punpckldq %%mm2,%%mm2 \n\t" \ + "movq %%mm2,%%mm3 \n\t" /* first iteration: set counting index register */ \ + "psubw %%mm0,%%mm4 \n\t" /* subtract current data value */ \ + "pmaddwd %%mm4,%%mm4 \n\t" /* square and add -> energy */ \ + "psrld %2,%%mm4 \n\t" /* shift by energy divisor */ \ + "movd %1,%%mm6 \n\t" /* load nodemetric1 */ \ + "punpckldq %%mm6, %%mm6 \n\t" /* duplicate it */ \ + "paddd %%mm6,%%mm4 \n\t" /* add nodemetric1 */ \ + : : "m" (metrictab[0]), "m" (nodemetric1[0]), "i" (MLSEENERGYSH), \ + "r" (x)); \ +} while (0) + +#define VEMMXINTERN(metrictab,nodemetric1,n) \ +do { \ + asm volatile("movq %0,%%mm7 \n\t" /* load metrictab values */ \ + "paddw %%mm1,%%mm3 \n\t" /* increment counting index register */ \ + "psubw %%mm0,%%mm7 \n\t" /* subtract current data value */ \ + "pmaddwd %%mm7,%%mm7 \n\t" /* square and add -> energy */ \ + "psrld %2,%%mm7 \n\t" /* shift by energy divisor */ \ + "movd %1,%%mm6 \n\t" /* load nodemetric1 */ \ + "punpckldq %%mm6, %%mm6 \n\t" /* duplicate it */ \ + "paddd %%mm6,%%mm7 \n\t" /* add nodemetric1 */ \ + "movq %%mm7,%%mm6 \n\t" \ + "pcmpgtd %%mm4,%%mm7 \n\t" /* compare new metrics with old ones */ \ + "movq %%mm7,%%mm5 \n\t" /* 0xffff if new ones are greater */ \ + "pand %%mm7,%%mm4 \n\t" /* mux for metric values and index values */ \ + "pandn %%mm6,%%mm5 \n\t" \ + "por %%mm5,%%mm4 \n\t" \ + "pand %%mm7,%%mm2 \n\t" \ + "pandn %%mm3,%%mm7 \n\t" \ + "por %%mm7,%%mm2 \n\t" \ + : : "m" (metrictab[(n)*2]), "m" (nodemetric1[(n)*MLSESRCINC]), \ + "i" (MLSEENERGYSH)); \ +} while (0) + +#define VEMMXINTEREND(nodemetric2,backptr) \ +do { \ + asm volatile("movq %%mm4,%0 \n\t" \ + "movq %%mm2,%%mm7 \n\t" \ + "psrlq $32,%%mm7\n\t" \ + "punpcklwd %%mm7,%%mm2 \n\t" \ + "movd %%mm2,%1 \n\t" \ + : : "m" (nodemetric2[0]), "m" (backptr[0]) : "memory"); \ +} while (0) + +#if SYMBITS == 1 + +static void simdtrellis(unsigned int *nodemetric1, unsigned int *nodemetric2, unsigned int *metrictab, unsigned short *backptr, int vr, int vi) +{ + unsigned int x, i; + + VEMMXINIT(vr,vi); + for (x = 0; x < MLSESRCINC; x++) { + for (i = 0; i < ((1<>1); i++) { + VEMMXINTER0(metrictab,nodemetric1,x); + VEMMXINTERN(metrictab,nodemetric1,1); + VEMMXINTEREND(nodemetric2,backptr); + nodemetric2 += 2; + backptr += 2; + metrictab += 2*(1<>1); i++) { + VEMMXINTER0(metrictab,nodemetric1,x); + VEMMXINTERN(metrictab,nodemetric1,1); + VEMMXINTERN(metrictab,nodemetric1,2); + VEMMXINTERN(metrictab,nodemetric1,3); + VEMMXINTEREND(nodemetric2,backptr); + nodemetric2 += 2; + backptr += 2; + metrictab += 2*(1<>1); i++) { + VEMMXINTER0(metrictab,nodemetric1,x); + DBGPRNT(metrictab); + VEMMXINTERN(metrictab,nodemetric1,1); + DBGPRNT(metrictab+2); + VEMMXINTERN(metrictab,nodemetric1,2); + DBGPRNT(metrictab+4); + VEMMXINTERN(metrictab,nodemetric1,3); + DBGPRNT(metrictab+6); + VEMMXINTERN(metrictab,nodemetric1,4); + DBGPRNT(metrictab+8); + VEMMXINTERN(metrictab,nodemetric1,5); + DBGPRNT(metrictab+10); + VEMMXINTERN(metrictab,nodemetric1,6); + DBGPRNT(metrictab+12); + VEMMXINTERN(metrictab,nodemetric1,7); + DBGPRNT(metrictab+14); + VEMMXINTEREND(nodemetric2,backptr); + nodemetric2 += 2; + backptr += 2; + metrictab += 2*(1<>1); i++) { + VEMMXINTER0(metrictab,nodemetric1,x); + VEMMXINTERN(metrictab,nodemetric1,1); + VEMMXINTERN(metrictab,nodemetric1,2); + VEMMXINTERN(metrictab,nodemetric1,3); + VEMMXINTERN(metrictab,nodemetric1,4); + VEMMXINTERN(metrictab,nodemetric1,5); + VEMMXINTERN(metrictab,nodemetric1,6); + VEMMXINTERN(metrictab,nodemetric1,7); + VEMMXINTERN(metrictab,nodemetric1,8); + VEMMXINTERN(metrictab,nodemetric1,9); + VEMMXINTERN(metrictab,nodemetric1,10); + VEMMXINTERN(metrictab,nodemetric1,11); + VEMMXINTERN(metrictab,nodemetric1,12); + VEMMXINTERN(metrictab,nodemetric1,13); + VEMMXINTERN(metrictab,nodemetric1,14); + VEMMXINTERN(metrictab,nodemetric1,15); + VEMMXINTEREND(nodemetric2,backptr); + nodemetric2 += 2; + backptr += 2; + metrictab += 2*(1<> 16; \ + backptr[1] = tmpb[0]; \ +} while (0) + +#if SYMBITS == 1 + +static void simdtrellis(unsigned int *nodemetric1, unsigned int *nodemetric2, unsigned int *metrictab, unsigned short *backptr, int vr, int vi) +{ + unsigned int x, i; + VEVISSTATE; + + VEVISINIT(vr,vi); + for (x = 0; x < MLSESRCINC; x++) { + for (i = 0; i < ((1<>1); i++) { + VEVISINTER0(metrictab,nodemetric1,x); + VEVISINTERN(metrictab,nodemetric1,1); + VEVISINTEREND(nodemetric2,backptr); + nodemetric2 += 2; + backptr += 2; + metrictab += 2*(1<>1); i++) { + VEVISINTER0(metrictab,nodemetric1,x); + VEVISINTERN(metrictab,nodemetric1,1); + VEVISINTERN(metrictab,nodemetric1,2); + VEVISINTERN(metrictab,nodemetric1,3); + VEVISINTEREND(nodemetric2,backptr); + nodemetric2 += 2; + backptr += 2; + metrictab += 2*(1<>1); i++) { + VEVISINTER0(metrictab,nodemetric1,x); + DBGPRNT(metrictab); + VEVISINTERN(metrictab,nodemetric1,1); + DBGPRNT(metrictab+2); + VEVISINTERN(metrictab,nodemetric1,2); + DBGPRNT(metrictab+4); + VEVISINTERN(metrictab,nodemetric1,3); + DBGPRNT(metrictab+6); + VEVISINTERN(metrictab,nodemetric1,4); + DBGPRNT(metrictab+8); + VEVISINTERN(metrictab,nodemetric1,5); + DBGPRNT(metrictab+10); + VEVISINTERN(metrictab,nodemetric1,6); + DBGPRNT(metrictab+12); + VEVISINTERN(metrictab,nodemetric1,7); + DBGPRNT(metrictab+14); + VEVISINTEREND(nodemetric2,backptr); + nodemetric2 += 2; + backptr += 2; + metrictab += 2*(1<>1); i++) { + VEVISINTER0(metrictab,nodemetric1,x); + VEVISINTERN(metrictab,nodemetric1,1); + VEVISINTERN(metrictab,nodemetric1,2); + VEVISINTERN(metrictab,nodemetric1,3); + VEVISINTERN(metrictab,nodemetric1,4); + VEVISINTERN(metrictab,nodemetric1,5); + VEVISINTERN(metrictab,nodemetric1,6); + VEVISINTERN(metrictab,nodemetric1,7); + VEVISINTERN(metrictab,nodemetric1,8); + VEVISINTERN(metrictab,nodemetric1,9); + VEVISINTERN(metrictab,nodemetric1,10); + VEVISINTERN(metrictab,nodemetric1,11); + VEVISINTERN(metrictab,nodemetric1,12); + VEVISINTERN(metrictab,nodemetric1,13); + VEVISINTERN(metrictab,nodemetric1,14); + VEVISINTERN(metrictab,nodemetric1,15); + VEVISINTEREND(nodemetric2,backptr); + nodemetric2 += 2; + backptr += 2; + metrictab += 2*(1<re; + y = vi - mtab->im; + return ((unsigned int)(x * x + y * y)) >> MLSEENERGYSH; +} + +void pskmlse_trellis(unsigned int *nodemetric1, unsigned int *nodemetric2, metrictab_t *metrictab, unsigned short *backptr, int vr, int vi) +{ + struct metrictab *metrtab = metrictab->m; + unsigned int *nmetr1; + unsigned int xx, yy, xmm = 0, metricm, met, i; + + if (checksimd()) { + simdtrellis(nodemetric1, nodemetric2, metrictab->simdm, backptr, vr, vi); + return; + } + for (xx = 0; xx < MLSESRCINC; xx++) { + for (yy = 0; yy < (1<<(SYMBITS)); yy++) { + nmetr1 = nodemetric1+xx; + metricm = ~0; + for (i = 0; i < MLSENODES; i += MLSESRCINC, nmetr1 += MLSESRCINC) { + met = nmetr1[0] + metric(metrtab, vr, vi); + metrtab++; +#if 0 + printf("0x%03x->0x%03x mt %6d%+6di v %6d%+6di metric %9u delta: %9u\n", xx | i, (xx << (SYMBITS)) | yy, + metrtab[-1].re, metrtab[-1].im, vr, vi, met, met - nmetr1[0]); +#endif +#if 1 + if (met <= metricm) { + metricm = met; + xmm = xx | i; + } +#else + { + unsigned int maskn = -(met <= metricm); + unsigned int masko = ~maskn; + metricm = (metricm & masko) | (met & maskn); + xmm = (xmm & masko) | ((xx | i) & maskn); + } +#endif + } + *backptr++ = xmm; + *nodemetric2++ = metricm; + } + } +} + +#if defined(USEMMX) || defined(USEVIS) + +static void simdinitmetric(const cplxshort_t *channel, metrictab_t *metrictab) +{ + unsigned int i1, i2, i3, i, j, k; + int vr, vi; + cplxshort_t a, b; + + for (i1 = 0; i1 < MLSEMTABSIZE; i1 += (2<<(SYMBITS))) + for (i2 = 0; i2 < 2; i2++) + for (i3 = 0; i3 < (1<<(SYMBITS)); i3++) { + i = i3 | (i2 << (SYMBITS)) | i1; + a = channel[0]; + b = psk_symmapping[i & SYMBITMASK]; + vr = a.re * b.re - a.im * b.im; + vi = a.re * b.im + a.im * b.re; + for (k = i >> SYMBITS, j = 0; j < MLSENRSYMB; j++, k >>= SYMBITS) { + a = channel[MLSENRSYMB-j]; + b = psk_symmapping[k & SYMBITMASK]; + vr += a.re * b.re - a.im * b.im; + vi += a.re * b.im + a.im * b.re; + } + vr >>= 15; + vi >>= 15; + if (abs(vr) > 32767 || abs(vi) > 32767) + logprintf(0, "initmetric: metric overflow table %u value %d%+di\n", i, vr, vi); + metrictab->simdm[i2 | (i3 << 1) | i1] = (((int)vr) & 0xffff) | (((int)vi) << 16); + } +} + +#else + +extern inline void simdinitmetric(const cplxshort_t *channel, metrictab_t *metrictab) +{ +} + +#endif + +void pskmlse_initmetric(const cplxshort_t *channel, metrictab_t *metrictab) +{ + unsigned int i, j, k; + int vr, vi; + cplxshort_t a, b; + + if (checksimd()) { + simdinitmetric(channel, metrictab); + return; + } + for (i = 0; i < MLSEMTABSIZE; i++) { + a = channel[0]; + b = psk_symmapping[i & SYMBITMASK]; + vr = a.re * b.re - a.im * b.im; + vi = a.re * b.im + a.im * b.re; + for (k = i >> SYMBITS, j = 0; j < MLSENRSYMB; j++, k >>= SYMBITS) { + a = channel[MLSENRSYMB-j]; + b = psk_symmapping[k & SYMBITMASK]; + vr += a.re * b.re - a.im * b.im; + vi += a.re * b.im + a.im * b.re; + } + vr >>= 15; + vi >>= 15; + if (abs(vr) > 32767 || abs(vi) > 32767) + logprintf(0, "initmetric: metric overflow table %u value %d%+di\n", i, vr, vi); + metrictab->m[i].re = vr; + metrictab->m[i].im = vi; + } +} + +/* ---------------------------------------------------------------------- */ diff --git a/pskmodem/pskmodem.c b/pskmodem/pskmodem.c new file mode 100644 index 0000000..ffb1668 --- /dev/null +++ b/pskmodem/pskmodem.c @@ -0,0 +1,539 @@ +/*****************************************************************************/ + +/* + * pskmodem.c -- PSK modem. + * + * Copyright (C) 1999-2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please note that the GPL allows you to use the driver, NOT the radio. + * In order to use the radio, you need a license from the communications + * authority of your country. + * + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE +#define _REENTRANT + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +#include "modem.h" +#include "psk.h" +#include "psktbl.h" +#include "simd.h" + +#include +#include +#include +#include +#include + +/* ---------------------------------------------------------------------- */ + +struct txstate { + struct modemchannel *chan; + unsigned int txphinc; + unsigned int txphase; + unsigned int carphase; + unsigned int carphinc; + cplxshort_t filter[TXFILTLEN]; +}; + +static const struct modemparams modparams[] = { + { NULL } + +}; + +static void *modconfig(struct modemchannel *chan, unsigned int *samplerate, const char *params[]) +{ + struct txstate *s; + + if (!(s = calloc(1, sizeof(struct txstate)))) + logprintf(MLOG_FATAL, "out of memory\n"); + s->chan = chan; + *samplerate = SAMPLERATE; + return s; +} + +static void modinit(void *state, unsigned int samplerate) +{ + struct txstate *s = (struct txstate *)state; + + s->txphinc = ((SYMRATE << 16) + samplerate / 2) / samplerate; + s->carphinc = ((FCARRIER << 16) + samplerate / 2) / samplerate; +} + +static void txsendsymbols(struct txstate *tx, const unsigned char *sym, unsigned int nrsyms) +{ + int16_t sbuf[512]; + int16_t *sptr = sbuf, *eptr = sbuf + sizeof(sbuf)/sizeof(sbuf[0]); + unsigned int i; + int sumr, sumi; + const int *coeff; + + while (nrsyms > 0) { + if (tx->txphase >= 0x10000) { + tx->txphase &= 0xffff; + memmove(&tx->filter[1], tx->filter, sizeof(tx->filter) - sizeof(tx->filter[0])); + tx->filter[0] = psk_symmapping[sym[0] & SYMBITMASK]; + sym++; + nrsyms--; + } + coeff = txfilter[TXFILTFIDX(tx->txphase)]; + for (sumr = sumi = i = 0; i < TXFILTLEN; i++, coeff++) { + sumr += (*coeff) * tx->filter[i].re; + sumi += (*coeff) * tx->filter[i].im; + } + sumr >>= 15; + sumi >>= 15; + *sptr++ = (sumr * COS(tx->carphase) - sumi * SIN(tx->carphase)) >> 15; + tx->carphase += tx->carphinc; + tx->txphase += tx->txphinc; + if (sptr >= eptr) { + audiowrite(tx->chan, sbuf, sptr - sbuf); + sptr = sbuf; + } + } + audiowrite(tx->chan, sbuf, sptr - sbuf); +} + +static void txsendtrain(struct txstate *tx) +{ + txsendsymbols(tx, trainsyms, TRAINSYMS); +} + +static int txsenddata(struct txstate *tx) +{ + unsigned char buf[DATABYTES+1]; + unsigned char sym[DATASYMS]; + unsigned int i, j, k; + unsigned char *bp = buf; + + if (!pktget(tx->chan, buf, DATABYTES)) + return -1; + buf[DATABYTES] = 0; + for (k = j = i = 0; i < DATASYMS; i++) { + if (j < SYMBITS) { + k |= (*bp++) << j; + j += 8; + } + sym[i] = k & SYMBITMASK; + logprintf(260, "txsymbol[%2u] = %u %d%+di\n", i, sym[i], psk_symmapping[sym[i]].re, psk_symmapping[sym[i]].im); + k >>= SYMBITS; + j -= SYMBITS; + } + txsendsymbols(tx, sym, DATASYMS); + txsendtrain(tx); + return 0; +} + +static void modmodulate(void *state, unsigned int txdelay) +{ + struct txstate *tx = (struct txstate *)state; + unsigned char txddata[DATASYMS]; + unsigned int i, j, k; + + if (txdelay > 0) { + for (i = j = k = 0; i < DATASYMS; i++) { + if (j < SYMBITS) { + k |= 0x7e << j; + j += 8; + } + txddata[i] = k & SYMBITMASK; + k >>= SYMBITS; + j -= SYMBITS; + } + } + while (txdelay > 0) { + txsendtrain(tx); + txsendsymbols(tx, txddata, DATASYMS); + if (txdelay > ((TRAINSYMS+DATASYMS)*1000/SYMRATE)) + txdelay -= ((TRAINSYMS+DATASYMS)*1000/SYMRATE); + else + txdelay = 0; + } + txsendtrain(tx); + while (!txsenddata(tx)); +} + +struct modulator pskmodulator = { + NULL, + "psk", + modparams, + modconfig, + modinit, + modmodulate, + free +}; + +/* ---------------------------------------------------------------------- */ + +static inline int rxfilter_real(const int16_t *val, unsigned int phase) +{ + const int *coeff = rxfilter_re[RXFILTFIDX(phase)]; + unsigned int i; + int s = 0; + + val += RXFILTFSAMP(phase); + for (i = 0; i < RXFILTLEN; i++, val++, coeff++) + s += (*val) * (*coeff); + return s >> 16; +} + +static inline int rxfilter_imag(const int16_t *val, unsigned int phase) +{ + const int *coeff = rxfilter_im[RXFILTFIDX(phase)]; + unsigned int i; + int s = 0; + + val += RXFILTFSAMP(phase); + for (i = 0; i < RXFILTLEN; i++, val++, coeff++) + s += (*val) * (*coeff); + return s >> 16; +} + +/* ---------------------------------------------------------------------- */ + +#define RXCARPHASEINC (((FCARRIER << 16) + SYMRATE / 2) / SYMRATE) + +struct rxstate { + struct modemchannel *chan; + unsigned int srate; +}; + +static void rxread(struct rxstate *rx, cplxshort_t *ptr, unsigned int nr, unsigned int phase, unsigned int phaseinc) +{ + int16_t *samples; + unsigned int totsamp = ((nr * phaseinc) >> 16) + RXFILTLEN; + + samples = alloca(totsamp * sizeof(samples[0])); + audioread(rx->chan, samples, totsamp, phase >> 16); + phase &= 0xffff; + for (; nr > 0; nr--, ptr++, phase += phaseinc) { + ptr->re = rxfilter_real(samples, phase); + ptr->im = rxfilter_imag(samples, phase); + } +} + +static void rxrotate(cplxshort_t *ptr, unsigned int nr, unsigned int carphase, unsigned int carphaseinc) +{ + int vr, vi, cr, ci; + + for (; nr > 0; nr--, ptr++, carphase += carphaseinc) { + vr = ptr->re; + vi = ptr->im; + cr = COS(carphase); + ci = SIN(carphase); + ptr->re = (vr * cr + vi * ci) >> 15; + ptr->im = (vi * cr - vr * ci) >> 15; + } +} + +extern inline int calcsync(int *toten, int *corren, cplxshort_t *samples) +{ + const cplxshort_t *tr = traincorrrotated; + unsigned int i; + int acc1r, acc1i, acc2; + + for (acc1r = acc1i = acc2 = 0, i = 0; i < TRAINSYMS; i++, samples += 2, tr++) { + acc1r += ((tr->re) * (samples->re) - (tr->im) * (samples->im)) >> 5; + acc1i += ((tr->re) * (samples->im) + (tr->im) * (samples->re)) >> 5; + acc2 += ((samples->re) * (samples->re) + (samples->im) * (samples->im)) >> 10; + } + acc1r >>= 15; + acc1i >>= 15; + acc1r = acc1r * acc1r + acc1i * acc1i; + acc1r /= TRAINSYMS; + if (toten) + *toten = acc2; + if (corren) + *corren = acc1r; + logprintf(258, "Sync energy %d correlation %d\n", acc2, acc1r); + if (acc2 < 16*TRAINSYMS || acc1r*2 < acc2) + return 0; + logprintf(257, "Sync found, energy %d correlation %d\n", acc2, acc1r); + return 1; +} + +/* + * searches for a training sequence; returns the phase (time) of the training sequence start. + */ + +static unsigned int synchunt(struct rxstate *rx, unsigned int phase, unsigned int phaseinc, unsigned int dcdcnt) +{ + cplxshort_t syncbuf[4*TRAINSYMS+1]; + cplxshort_t syncbuf2[2*TRAINSYMS]; + unsigned int phaseblkinc; + int toten1, toten2, toten3, syncen1, syncen2, syncen3; + unsigned int i; + + phaseinc >>= 1; + phaseblkinc = phaseinc * (2 * TRAINSYMS); + rxread(rx, syncbuf, 4*TRAINSYMS+1, phase, phaseinc); + for (;;) { + for (i = 0; i < 2*TRAINSYMS; i++) { + if (calcsync(&toten1, &syncen1, syncbuf+i)) { + if (!calcsync(&toten2, &syncen2, syncbuf+i+1) || syncen2 < syncen1) { + phase += i * phaseinc; + rxread(rx, syncbuf2, 2*TRAINSYMS, phase - (phaseinc >> 1), phaseinc); + calcsync(&toten2, &syncen2, syncbuf2); + calcsync(&toten3, &syncen3, syncbuf2+1); + if (syncen2 > syncen1 && syncen2 > syncen3) + phase -= (phaseinc >> 1); + else if (syncen3 > syncen1 && syncen3 > syncen2) + phase += (phaseinc >> 1); + logprintf(256, "Sync found, dcd %u\n", dcdcnt); + return phase; + } + } + if (dcdcnt > 0) { + dcdcnt--; + if (!dcdcnt) + pktsetdcd(rx->chan, 0); + } + } + phase += phaseblkinc; + memmove(syncbuf, syncbuf+2*TRAINSYMS, (2*TRAINSYMS+1)*sizeof(syncbuf[0])); + rxread(rx, syncbuf+(2*TRAINSYMS+1), 2*TRAINSYMS, phase + phaseblkinc, phaseinc); + } +} + +static void calcchannel(struct rxstate *rx, unsigned int phase, unsigned int phaseinc, cplxshort_t *channel, int *chenergy) +{ + cplxshort_t trseq[OBSTRAINSYMS]; + const cplxshort_t *p1, *p2; + unsigned int i, j; + int sumr, sumi, en; + + rxread(rx, trseq, OBSTRAINSYMS, phase + (CHANNELLEN/2) * phaseinc, phaseinc); + for (p1 = trainmatrotated, en = 0, i = 0; i < CHANNELLEN; i++) { + for (sumr = sumi = 0, p2 = trseq, j = 0; j < OBSTRAINSYMS; j++, p1++, p2++) { + sumr += (p1->re) * (p2->re) - (p1->im) * (p2->im); + sumi += (p1->re) * (p2->im) + (p1->im) * (p2->re); + } + sumr >>= 16; + sumi >>= 16; + channel[i].re = sumr; + channel[i].im = sumi; + en += sumr * sumr + sumi * sumi; + } + *chenergy = en; + if (logcheck(256)) { + char buf[512], *bp = buf; + int r; + r = snprintf(bp, buf+sizeof(buf)-bp, "Sync found, chenergy %d, channel", en); + if (r > 0) + bp += r; + for (i = 0; i < CHANNELLEN; i++) { + r = snprintf(bp, buf+sizeof(buf)-bp, " %d%+di", channel[i].re, channel[i].im); + if (r > 0) + bp += r; + } + logprintf(256, "%s\n", buf); + } +} + +/* ---------------------------------------------------------------------- */ + +static unsigned int mlsebacktrack(unsigned char *syms, unsigned int nrsyms, unsigned int startnode, unsigned short *backtrack) +{ + for (; nrsyms > 0; nrsyms--, syms--, backtrack -= MLSENODES) { + if (syms) + *syms = startnode & SYMBITMASK; + startnode = backtrack[startnode]; + } + return startnode; +} + +static inline void symtochar(unsigned char *sym, unsigned char *msg) +{ + unsigned int i, j, k; + + for (i = j = k = 0; i < DATABYTES;) { + k |= sym[0] << j; + sym++; + j += SYMBITS; + if (j >= 8) { + msg[0] = k; + msg++; + k >>= 8; + j -= 8; + i++; + } + } +} + +/* ---------------------------------------------------------------------- */ + +static void mlseblock(struct rxstate *rx, unsigned int phase, unsigned int phaseinc, cplxshort_t *channel) +{ + unsigned int *nptr1, *nptr2, *nptr3; + unsigned short *btptr; + unsigned int i, j, k, carphase = 0, energy = 0; + cplxshort_t samp[8]; + unsigned int nodes[2*MLSENODES]; + metrictab_t metrictab; + unsigned short backtrack[(DATASYMS+CHANNELLEN-1)*MLSENODES]; + unsigned char msg[DATABYTES]; + unsigned char sym[DATASYMS+CHANNELLEN-1]; + + /* initialize MLSE state */ + pskmlse_initmetric(channel, &metrictab); + btptr = backtrack; + nptr1 = nodes; + nptr2 = nodes + MLSENODES; + for (i = 0; i < MLSENODES; i++) + nptr1[i] = UINT_MAX >> 2; + nptr1[MLSEROOTNODE] = 0; + /* MLSE decoder loop */ + for (i = DATASYMS+CHANNELLEN-1; i > 0;) { + j = i; + if (j > 8) + j = 8; + i -= j; + rxread(rx, samp, j, phase, phaseinc); + rxrotate(samp, j, carphase, RXCARPHASEINC); + phase += j * phaseinc; + carphase += j * RXCARPHASEINC; + for (k = 0; k < j; k++) { + logprintf(260, "RxSymbol: %d%+di\n", samp[k].re, samp[k].im); + energy += (samp[k].re * samp[k].re + samp[k].im * samp[k].im) >> MLSEENERGYSH; + pskmlse_trellis(nptr1, nptr2, &metrictab, btptr, samp[k].re, samp[k].im); + nptr3 = nptr1; + nptr1 = nptr2; + nptr2 = nptr3; + btptr += MLSENODES; + } + } + /* backtracking */ + btptr -= MLSENODES; + k = mlsebacktrack(&sym[DATASYMS+CHANNELLEN-2], DATASYMS+CHANNELLEN-1, MLSETOORNODE, btptr); + symtochar(sym, msg); + if (k != MLSEROOTNODE) + logprintf(1, "MLSE: uhoh surviving path does not end in root node 0x%x, 0x%x\n", MLSEROOTNODE, k); +#if 0 + j = 0; + for (i = 1; i < MLSENODES; i++) + if (nptr1[i] < nptr1[j]) + j = i; + if (j != MLSETOORNODE) + logprintf(1, "MLSE: uhoh best metric not at toor node 0x%x, 0x%x (en %u, %u)\n", + MLSETOORNODE, j, nptr1[MLSETOORNODE], nptr1[j]); +#endif + pktput(rx->chan, msg, DATABYTES); + k = nptr1[MLSETOORNODE]; +#if defined(USEVIS) + if (checksimd()) + k <<= 2; +#endif /* USEVIS */ + logprintf(1, "MLSE: signal energy %u, error energy %u S/(N+D) %5.1fdB\n", + energy, k, -10*log10(k / (double)(energy ? energy : 1))); +} + +static void receiver(void *__rx) +{ + struct rxstate *rx = (struct rxstate *)__rx; + cplxshort_t chan[CHANNELLEN]; + unsigned int phase, oldphase = (~0U) >> 1, phaseinc, estphaseinc; + unsigned int changle, oldchangle = 0; + int en, splphasediff, anglediff, totanglediff, totphasediff; + + phase = audiocurtime(rx->chan) << 16; + phaseinc = ((rx->srate << 16) + SYMRATE / 2) / SYMRATE; + logprintf(256, "rxphaseinc: 0x%x\n", phaseinc); + for (;;) { + phase = synchunt(rx, phase, phaseinc, 20); + pktsetdcd(rx->chan, 1); + splphasediff = phase - oldphase - (TRAINSYMS+DATASYMS) * phaseinc; + calcchannel(rx, phase, phaseinc, chan, &en); + changle = ((1 << 15) / M_PI) * atan2(chan[CHANNELLEN/2].im, chan[CHANNELLEN/2].re); + changle &= 0xffff; + anglediff = (int)(int16_t)((changle-oldchangle - RXCARPHASEINC * (DATASYMS + TRAINSYMS)) & 0xffff); + totphasediff = splphasediff - anglediff * (int)rx->srate / FCARRIER; + totanglediff = (anglediff - splphasediff * FCARRIER / (int)rx->srate); + estphaseinc = phaseinc; + if (abs(splphasediff) < 0x40000) { + estphaseinc = phaseinc - (totphasediff / (int)(DATASYMS + TRAINSYMS)); + logprintf(257, "last train phase: 0x%08x current train phase: 0x%08x diff: %d\n", + oldphase, phase, splphasediff); + logprintf(258, "channel angle: 0x%04x prev channel angle: 0x%04x diff: %d\n", changle, oldchangle, anglediff); + logprintf(257, "total angle difference: %6d total phase difference: %8d\n", totanglediff, totphasediff); + logprintf(257, "nominal phase inc: 0x%05x estimated phase inc: 0x%05x delta: %3d o/oo\n", + phaseinc, estphaseinc, 1000 * (int)(estphaseinc - phaseinc) / (int)phaseinc); + } + oldchangle = changle; + oldphase = phase; + phase += ((CHANNELLEN/2)+OBSTRAINSYMS) * phaseinc; + mlseblock(rx, phase, /*est*/phaseinc, chan); + phase += (DATASYMS-1) * phaseinc; + } +} + +static const struct modemparams demodparams[] = { + { NULL } + +}; + +static void *demodconfig(struct modemchannel *chan, unsigned int *samplerate, const char *params[]) +{ + struct rxstate *s; + + if (!(s = calloc(1, sizeof(struct rxstate)))) + logprintf(MLOG_FATAL, "out of memory\n"); + s->chan = chan; + *samplerate = SAMPLERATE; + return s; +} + +static void demodinit(void *state, unsigned int samplerate, unsigned int *bitrate) +{ + struct rxstate *s = (struct rxstate *)state; + + s->srate = samplerate; + *bitrate = 7600; +} + +struct demodulator pskdemodulator = { + NULL, + "psk", + demodparams, + demodconfig, + demodinit, + receiver, + free +}; + +/* ---------------------------------------------------------------------- */ diff --git a/pskmodem/psktbl.h b/pskmodem/psktbl.h new file mode 100644 index 0000000..3615250 --- /dev/null +++ b/pskmodem/psktbl.h @@ -0,0 +1,307 @@ +/* 00 00 32767 +0i */ +/* 01 01 23169+23169i */ +/* 02 03 0+32767i */ +/* 03 02 -23169+23169i */ +/* 04 06 -32767 +0i */ +/* 05 07 -23169-23169i */ +/* 06 05 0-32767i */ +/* 07 04 23169-23169i */ +/* train sequence: min max offdiag a*a^H: 0.343233 */ + +const cplxshort_t psk_symmapping[8] = { + { 32767, 0 }, + { 23169, 23169 }, + { -23169, 23169 }, + { 0, 32767 }, + { 23169, -23169 }, + { 0, -32767 }, + { -32767, 0 }, + { -23169, -23169 } +}; + +/* + trsym = [ -32767+0i 23169-23169i -32767+0i -23169-23169i 0+32767i 0+32767i 23169+23169i 0-32767i -23169+23169i 23169+23169i -23169+23169i -23169+23169i -23169-23169i 0-32767i 0+32767i -23169-23169i ]; + trsymcc = [ 15.9984+0i -0.414208+0.414208i -0.414208-1.58554i -6.62804e-05+1.99988i 2.41395-1.58554i 1.41408-3.41376i 2.24263+2.82816i -4.41376-2.41402i 2.24236+0i -4.41376+2.41402i 2.24263-2.82816i 1.41408+3.41376i 2.41395+1.58554i -6.62804e-05-1.99988i -0.414208+1.58554i -0.414208-0.414208i ]; +a = [ -0.999969 0.707062-0.707062i -0.999969 ; ... + 0.707062-0.707062i -0.999969 -0.707062-0.707062i ; ... + -0.999969 -0.707062-0.707062i 0+0.999969i ; ... + -0.707062-0.707062i 0+0.999969i 0+0.999969i ; ... + 0+0.999969i 0+0.999969i 0.707062+0.707062i ; ... + 0+0.999969i 0.707062+0.707062i 0-0.999969i ; ... + 0.707062+0.707062i 0-0.999969i -0.707062+0.707062i ; ... + 0-0.999969i -0.707062+0.707062i 0.707062+0.707062i ; ... + -0.707062+0.707062i 0.707062+0.707062i -0.707062+0.707062i ; ... + 0.707062+0.707062i -0.707062+0.707062i -0.707062+0.707062i ; ... + -0.707062+0.707062i -0.707062+0.707062i -0.707062-0.707062i ; ... + -0.707062+0.707062i -0.707062-0.707062i 0-0.999969i ; ... + -0.707062-0.707062i 0-0.999969i 0+0.999969i ; ... + 0-0.999969i 0+0.999969i -0.707062-0.707062i ]; +ahainvah = [ -0.0737285+0.00084296i 0.0453474+0.0484783i -0.0725354-0.00203612i -0.0463163+0.0463167i 0.00521937-0.0738541i 0.00084296-0.0696563i 0.0486566-0.051536i 0.0030054+0.0686875i -0.0475093-0.0538758i 0.0506928-0.0568809i -0.0538758-0.0538758i -0.0560378-0.0484786i -0.0505664+0.0508183i -0.000969272+0.0693525i ; ... + 0.0461909+0.0506925i -0.0716924+0.000177842i -0.0508183+0.0505667i 0.00203613-0.0708491i 0.000969046-0.0740321i 0.0464424-0.0506925i -3.14557e-10+0.0655042i -0.0454734-0.0485306i 0.0475095-0.0538755i -0.0506925-0.0568807i -0.0568807-0.0506925i -0.0559117+0.0528544i 0.00203613+0.0725357i -0.000969046-0.0693527i ; ... + -0.0707234+0.00234006i -0.049849+0.0527284i -0.00221396-0.0663472i -0.00203589-0.0708489i 0.0463163-0.0550684i -0.00216222+0.0664733i -0.0486566-0.051536i 0.0498496-0.0486564i -0.0536979-0.0536975i -0.0538758-0.0538758i -0.0568809+0.0506928i -0.00318324+0.0748757i 0.00221421-0.0663473i -0.0505664+0.0505668i ]; + */ + + +static const unsigned char trainsyms[16] = { + 6, 4, 6, 7, 3, 3, 1, 5, 2, 1, 2, 2, 7, 5, 3, 7 +}; + +static const cplxshort_t traincorrrotated[16] = { + + { -32767, 0 }, { -23169, 23169 }, { 32767, 0 }, { 23169, 23169 }, + { 0, -32767 }, { 32767, 0 }, { -23169, 23169 }, { 32767, 0 }, + { -23169, -23169 }, { 23169, 23169 }, { 23169, 23169 }, { -23169, 23169 }, + { -23169, 23169 }, { -32767, 0 }, { 0, 32767 }, { 23169, 23169 } +}; + +static const cplxshort_t trainmatrotated[42] = { + { 4831, -55 }, { 3177, -2971 }, { -4753, -133 }, { -3035, -3035 }, { -342, 4840 }, { -4564, -55 }, { 3188, -3377 }, { -4501, 196 }, + { 3113, 3530 }, { -3727, -3322 }, { -3530, -3530 }, { 3177, -3672 }, { 3313, -3330 }, { 4545, 63 }, + { -3027, -3322 }, { 11, 4698 }, { -3330, 3313 }, { 4643, 133 }, { -63, 4851 }, { -3322, -3043 }, { 0, 4292 }, { 3180, -2980 }, + { -3113, 3530 }, { -3727, 3322 }, { -3727, -3322 }, { -3463, -3664 }, { -133, -4753 }, { -4545, 63 }, + { 4634, -153 }, { 3455, 3266 }, { -145, -4348 }, { 4643, -133 }, { -3035, 3608 }, { 4356, 141 }, { -3188, -3377 }, { 3188, 3266 }, + { 3519, 3519 }, { -3530, 3530 }, { -3727, 3322 }, { -4907, -208 }, { -145, 4348 }, { 3313, 3313 } +}; + +#define MLSEROOTNODE 0x1f +#define MLSETOORNODE 0x34 + +/* + txfilt = [ -7.89211e-19 ; -0.000169639 ; -0.000356223 ; -0.000549436 ; + -0.000737741 ; -0.000909138 ; -0.001052 ; -0.00115595 ; + -0.00121261 ; -0.00121637 ; -0.00116487 ; -0.00105933 ; + -0.000904593 ; -0.000708972 ; -0.000483741 ; -0.000242448 ; + 1.03876e-18 ; 0.000228389 ; 0.000428328 ; 0.000587364 ; + 0.000696013 ; 0.000748609 ; 0.000743905 ; 0.000685371 ; + 0.000581136 ; 0.000443577 ; 0.000288539 ; 0.000134254 ; + -4.59404e-19 ; -9.5412e-05 ; -0.000135207 ; -0.00010617 ; + 5.46552e-19 ; 0.000185619 ; 0.000446326 ; 0.00077085 ; + 0.00114129 ; 0.0015339 ; 0.00192042 ; 0.00226978 ; + 0.00255019 ; 0.00273144 ; 0.00278726 ; 0.00269755 ; + 0.00245035 ; 0.00204336 ; 0.00148485 ; 0.000793942 ; + -2.59878e-18 ; -0.000858639 ; -0.00173676 ; -0.00258502 ; + -0.00335312 ; -0.00399341 ; -0.0044645 ; -0.00473465 ; + -0.0047848 ; -0.00461084 ; -0.00422493 ; -0.00365583 ; + -0.00294782 ; -0.00215855 ; -0.00135555 ; -0.000611731 ; + 1.30368e-18 ; 0.000412633 ; 0.000571146 ; 0.000438343 ; + -1.37821e-18 ; -0.000731099 ; -0.00171266 ; -0.00287225 ; + -0.00410874 ; -0.00529605 ; -0.00628909 ; -0.00693185 ; + -0.00706721 ; -0.00654822 ; -0.00525007 ; -0.00308225 ; + 6.62539e-18 ; 0.00398561 ; 0.00879986 ; 0.0142994 ; + 0.0202711 ; 0.0264345 ; 0.032449 ; 0.0379254 ; + 0.0424413 ; 0.045561 ; 0.0468577 ; 0.0459391 ; + 0.0424728 ; 0.0362128 ; 0.027024 ; 0.0149038 ; + -2.02159e-17 ; -0.0173775 ; -0.0367505 ; -0.0574747 ; + -0.0787489 ; -0.0996327 ; -0.119072 ; -0.135932 ; + -0.149035 ; -0.157207 ; -0.159322 ; -0.154354 ; + -0.141421 ; -0.119838 ; -0.0891489 ; -0.0491676 ; + 3.34611e-17 ; 0.0579397 ; 0.123925 ; 0.196924 ; + 0.275621 ; 0.358446 ; 0.443618 ; 0.529196 ; + 0.613138 ; 0.693369 ; 0.767845 ; 0.834623 ; + 0.891929 ; 0.938215 ; 0.97222 ; 0.993006 ; + 1 ; 0.993006 ; 0.97222 ; 0.938215 ; + 0.891929 ; 0.834623 ; 0.767845 ; 0.693369 ; + 0.613138 ; 0.529196 ; 0.443618 ; 0.358446 ; + 0.275621 ; 0.196924 ; 0.123925 ; 0.0579397 ; + 3.34611e-17 ; -0.0491676 ; -0.0891489 ; -0.119838 ; + -0.141421 ; -0.154354 ; -0.159322 ; -0.157207 ; + -0.149035 ; -0.135932 ; -0.119072 ; -0.0996327 ; + -0.0787489 ; -0.0574747 ; -0.0367505 ; -0.0173775 ; + -2.02159e-17 ; 0.0149038 ; 0.027024 ; 0.0362128 ; + 0.0424728 ; 0.0459391 ; 0.0468577 ; 0.045561 ; + 0.0424413 ; 0.0379254 ; 0.032449 ; 0.0264345 ; + 0.0202711 ; 0.0142994 ; 0.00879986 ; 0.00398561 ; + 6.62539e-18 ; -0.00308225 ; -0.00525007 ; -0.00654822 ; + -0.00706721 ; -0.00693185 ; -0.00628909 ; -0.00529605 ; + -0.00410874 ; -0.00287225 ; -0.00171266 ; -0.000731099 ; + -1.37821e-18 ; 0.000438343 ; 0.000571146 ; 0.000412633 ; + 1.30368e-18 ; -0.000611731 ; -0.00135555 ; -0.00215855 ; + -0.00294782 ; -0.00365583 ; -0.00422493 ; -0.00461084 ; + -0.0047848 ; -0.00473465 ; -0.0044645 ; -0.00399341 ; + -0.00335312 ; -0.00258502 ; -0.00173676 ; -0.000858639 ; + -2.59878e-18 ; 0.000793942 ; 0.00148485 ; 0.00204336 ; + 0.00245035 ; 0.00269755 ; 0.00278726 ; 0.00273144 ; + 0.00255019 ; 0.00226978 ; 0.00192042 ; 0.0015339 ; + 0.00114129 ; 0.00077085 ; 0.000446326 ; 0.000185619 ; + 5.46552e-19 ; -0.00010617 ; -0.000135207 ; -9.5412e-05 ; + -4.59404e-19 ; 0.000134254 ; 0.000288539 ; 0.000443577 ; + 0.000581136 ; 0.000685371 ; 0.000743905 ; 0.000748609 ; + 0.000696013 ; 0.000587364 ; 0.000428328 ; 0.000228389 ; + 1.03876e-18 ; -0.000242448 ; -0.000483741 ; -0.000708972 ; + -0.000904593 ; -0.00105933 ; -0.00116487 ; -0.00121637 ; + -0.00121261 ; -0.00115595 ; -0.001052 ; -0.000909138 ; + -0.000737741 ; -0.000549436 ; -0.000356223 ; -0.000169639 ; ]; + abssum = 1.6357; + semilogy((0:255)/256,abs(fft(txfilt))) + */ + +static const int txfilter[16][16] = { + { 0, 0, 0, 0, 0, 0, 0, 0, 20032, 0, 0, 0, 0, 0, 0, 0 }, + { -3, 4, 3, -17, 8, 79, -348, 1160, 19892, -984, 298, -61, -12, 15, -2, -4 }, + { -7, 8, 8, -34, 11, 176, -736, 2482, 19475, -1785, 541, -105, -27, 29, -2, -9 }, + { -11, 11, 15, -51, 8, 286, -1151, 3944, 18794, -2400, 725, -131, -43, 40, -1, -14 }, + { -14, 13, 22, -67, 0, 406, -1577, 5521, 17867, -2833, 850, -141, -59, 49, 0, -18 }, + { -18, 14, 30, -79, -14, 529, -1995, 7180, 16719, -3092, 920, -138, -73, 54, 2, -21 }, + { -21, 14, 38, -89, -34, 650, -2385, 8886, 15381, -3191, 938, -125, -84, 55, 5, -23 }, + { -23, 13, 45, -94, -57, 759, -2723, 10601, 13889, -3149, 912, -106, -92, 54, 8, -24 }, + { -24, 11, 51, -95, -82, 850, -2985, 12282, 12282, -2985, 850, -82, -95, 51, 11, -24 }, + { -24, 8, 54, -92, -106, 912, -3149, 13889, 10601, -2723, 759, -57, -94, 45, 13, -23 }, + { -23, 5, 55, -84, -125, 938, -3191, 15381, 8886, -2385, 650, -34, -89, 38, 14, -21 }, + { -21, 2, 54, -73, -138, 920, -3092, 16719, 7180, -1995, 529, -14, -79, 30, 14, -18 }, + { -18, 0, 49, -59, -141, 850, -2833, 17867, 5521, -1577, 406, 0, -67, 22, 13, -14 }, + { -14, -1, 40, -43, -131, 725, -2400, 18794, 3944, -1151, 286, 8, -51, 15, 11, -11 }, + { -9, -2, 29, -27, -105, 541, -1785, 19475, 2482, -736, 176, 11, -34, 8, 8, -7 }, + { -4, -2, 15, -12, -61, 298, -984, 19892, 1160, -348, 79, 8, -17, 3, 4, -3 } +}; + +/* + rxfilt = [ 0.00534565 ; 0.00644843 ; 0.00757986 ; 0.00875248 ; + 0.00996825 ; 0.0112164 ; 0.012472 ; 0.0136948 ; + 0.0148292 ; 0.0158048 ; 0.0165376 ; 0.0169325 ; + 0.016886 ; 0.0162902 ; 0.0150367 ; 0.013022 ; + 0.0101524 ; 0.00634969 ; 0.00155649 ; -0.00425822 ; + -0.0110942 ; -0.0189153 ; -0.0276459 ; -0.0371682 ; + -0.04732 ; -0.0578947 ; -0.0686416 ; -0.0792683 ; + -0.0894442 ; -0.0988052 ; -0.10696 ; -0.113498 ; + -0.117998 ; -0.120035 ; -0.119195 ; -0.115082 ; + -0.10733 ; -0.0956153 ; -0.0796631 ; -0.0592614 ; + -0.0342674 ; -0.0046161 ; 0.0296741 ; 0.0684964 ; + 0.111653 ; 0.158856 ; 0.209725 ; 0.263794 ; + 0.320517 ; 0.379273 ; 0.439376 ; 0.500089 ; + 0.560635 ; 0.620208 ; 0.677993 ; 0.733176 ; + 0.784965 ; 0.832601 ; 0.875376 ; 0.912645 ; + 0.943842 ; 0.968488 ; 0.986203 ; 0.996714 ; + 0.999859 ; 0.995592 ; 0.983984 ; 0.965218 ; + 0.93959 ; 0.907502 ; 0.869449 ; 0.826014 ; + 0.777855 ; 0.72569 ; 0.670283 ; 0.612429 ; + 0.552941 ; 0.492629 ; 0.432291 ; 0.372694 ; + 0.314561 ; 0.258562 ; 0.205298 ; 0.155298 ; + 0.109006 ; 0.0667808 ; 0.0288905 ; -0.00448781 ; + -0.0332666 ; -0.0574451 ; -0.0771043 ; -0.0924002 ; + -0.103556 ; -0.110854 ; -0.114624 ; -0.115233 ; + -0.113078 ; -0.108569 ; -0.102125 ; -0.0941583 ; + -0.0850708 ; -0.0752412 ; -0.0650205 ; -0.0547253 ; + -0.0446337 ; -0.0349818 ; -0.0259622 ; -0.0177238 ; + -0.0103722 ; -0.00397234 ; 0.00144888 ; 0.00589848 ; + 0.00941285 ; 0.0120526 ; 0.0138974 ; 0.01504 ; + 0.0155817 ; 0.0156264 ; 0.0152766 ; 0.0146288 ; + 0.0137704 ; 0.0127769 ; 0.0117102 ; 0.0106169 ; + 0.00952902 ; 0.0084636 ; 0.00742438 ; 0.00640338 ; ]; + abssum = 3.6765; + semilogy((0:127)/128,abs(fft(rxfilt))) + */ + +static const int rxfilter_re[8][16] = { + { 125, -138, 642, 296, -906, 3776, -3175, -17574, -7569, 3957, -77, -301, 836, -84, 63, 112 }, + { 141, -126, 490, 553, -1097, 3296, -1184, -16822, -9831, 3632, 512, -593, 895, -22, 26, 126 }, + { 148, -97, 336, 753, -1144, 2666, 542, -15606, -11986, 2958, 1188, -844, 900, 66, -13, 136 }, + { 147, -58, 193, 885, -1062, 1952, 1949, -13988, -13925, 1922, 1905, -1025, 842, 181, -54, 141 }, + { 141, -14, 71, 948, -877, 1219, 3003, -12053, -15553, 535, 2606, -1106, 717, 315, -90, 140 }, + { 129, 28, -24, 945, -616, 526, 3691, -9899, -16784, -1171, 3227, -1062, 528, 460, -116, 132 }, + { 113, 68, -90, 885, -313, -79, 4027, -7630, -17554, -3143, 3701, -878, 283, 604, -127, 117 }, + { 95, 101, -127, 779, 0, -564, 4039, -5354, -17822, -5306, 3964, -547, 0, 735, -118, 93 } +}; + +static const int rxfilter_im[8][16] = { + { -209, -186, -160, -2001, -543, -2801, -12677, -2606, 12629, 5336, 19, 2031, 501, 62, 252, 16 }, + { -171, -236, -48, -1824, -900, -1762, -12027, -5103, 11980, 6795, -50, 1955, 735, 12, 270, 38 }, + { -134, -273, 16, -1592, -1262, -953, -11042, -7381, 10863, 8267, 58, 1786, 993, -23, 278, 64 }, + { -98, -295, 38, -1325, -1590, -388, -9801, -9347, 9304, 9666, 379, 1534, 1260, -36, 272, 94 }, + { -66, -301, 25, -1046, -1854, -59, -8393, -10925, 7356, 10903, 932, 1220, 1517, -15, 252, 127 }, + { -39, -293, -13, -776, -2033, 51, -6907, -12061, 5091, 11890, 1725, 871, 1742, 45, 218, 161 }, + { -16, -273, -67, -530, -2116, -19, -5430, -12729, 2603, 12548, 2745, 526, 1914, 151, 172, 195 }, + { 0, -244, -127, -322, -2103, -233, -4039, -12927, 0, 12810, 3964, 226, 2015, 304, 118, 226 } +}; + +static const int16_t rxfilter_re_16[8][16] = { + { 125, -138, 642, 296, -906, 3776, -3175, -17574, -7569, 3957, -77, -301, 836, -84, 63, 112 }, + { 141, -126, 490, 553, -1097, 3296, -1184, -16822, -9831, 3632, 512, -593, 895, -22, 26, 126 }, + { 148, -97, 336, 753, -1144, 2666, 542, -15606, -11986, 2958, 1188, -844, 900, 66, -13, 136 }, + { 147, -58, 193, 885, -1062, 1952, 1949, -13988, -13925, 1922, 1905, -1025, 842, 181, -54, 141 }, + { 141, -14, 71, 948, -877, 1219, 3003, -12053, -15553, 535, 2606, -1106, 717, 315, -90, 140 }, + { 129, 28, -24, 945, -616, 526, 3691, -9899, -16784, -1171, 3227, -1062, 528, 460, -116, 132 }, + { 113, 68, -90, 885, -313, -79, 4027, -7630, -17554, -3143, 3701, -878, 283, 604, -127, 117 }, + { 95, 101, -127, 779, 0, -564, 4039, -5354, -17822, -5306, 3964, -547, 0, 735, -118, 93 } +}; + +static const int16_t rxfilter_im_16[8][16] = { + { -209, -186, -160, -2001, -543, -2801, -12677, -2606, 12629, 5336, 19, 2031, 501, 62, 252, 16 }, + { -171, -236, -48, -1824, -900, -1762, -12027, -5103, 11980, 6795, -50, 1955, 735, 12, 270, 38 }, + { -134, -273, 16, -1592, -1262, -953, -11042, -7381, 10863, 8267, 58, 1786, 993, -23, 278, 64 }, + { -98, -295, 38, -1325, -1590, -388, -9801, -9347, 9304, 9666, 379, 1534, 1260, -36, 272, 94 }, + { -66, -301, 25, -1046, -1854, -59, -8393, -10925, 7356, 10903, 932, 1220, 1517, -15, 252, 127 }, + { -39, -293, -13, -776, -2033, 51, -6907, -12061, 5091, 11890, 1725, 871, 1742, 45, 218, 161 }, + { -16, -273, -67, -530, -2116, -19, -5430, -12729, 2603, 12548, 2745, 526, 1914, 151, 172, 195 }, + { 0, -244, -127, -322, -2103, -233, -4039, -12927, 0, 12810, 3964, 226, 2015, 304, 118, 226 } +}; + +static const short costab[512] = { + 32767, 32764, 32757, 32744, 32727, 32705, 32678, 32646, + 32609, 32567, 32520, 32468, 32412, 32350, 32284, 32213, + 32137, 32056, 31970, 31880, 31785, 31684, 31580, 31470, + 31356, 31236, 31113, 30984, 30851, 30713, 30571, 30424, + 30272, 30116, 29955, 29790, 29621, 29446, 29268, 29085, + 28897, 28706, 28510, 28309, 28105, 27896, 27683, 27466, + 27244, 27019, 26789, 26556, 26318, 26077, 25831, 25582, + 25329, 25072, 24811, 24546, 24278, 24006, 23731, 23452, + 23169, 22883, 22594, 22301, 22004, 21705, 21402, 21096, + 20787, 20474, 20159, 19840, 19519, 19194, 18867, 18537, + 18204, 17868, 17530, 17189, 16845, 16499, 16150, 15799, + 15446, 15090, 14732, 14372, 14009, 13645, 13278, 12909, + 12539, 12166, 11792, 11416, 11038, 10659, 10278, 9895, + 9511, 9126, 8739, 8351, 7961, 7571, 7179, 6786, + 6392, 5997, 5601, 5205, 4807, 4409, 4011, 3611, + 3211, 2811, 2410, 2009, 1607, 1206, 804, 402, + 0, -402, -804, -1206, -1607, -2009, -2410, -2811, + -3211, -3611, -4011, -4409, -4807, -5205, -5601, -5997, + -6392, -6786, -7179, -7571, -7961, -8351, -8739, -9126, + -9511, -9895, -10278, -10659, -11038, -11416, -11792, -12166, + -12539, -12909, -13278, -13645, -14009, -14372, -14732, -15090, + -15446, -15799, -16150, -16499, -16845, -17189, -17530, -17868, + -18204, -18537, -18867, -19194, -19519, -19840, -20159, -20474, + -20787, -21096, -21402, -21705, -22004, -22301, -22594, -22883, + -23169, -23452, -23731, -24006, -24278, -24546, -24811, -25072, + -25329, -25582, -25831, -26077, -26318, -26556, -26789, -27019, + -27244, -27466, -27683, -27896, -28105, -28309, -28510, -28706, + -28897, -29085, -29268, -29446, -29621, -29790, -29955, -30116, + -30272, -30424, -30571, -30713, -30851, -30984, -31113, -31236, + -31356, -31470, -31580, -31684, -31785, -31880, -31970, -32056, + -32137, -32213, -32284, -32350, -32412, -32468, -32520, -32567, + -32609, -32646, -32678, -32705, -32727, -32744, -32757, -32764, + -32767, -32764, -32757, -32744, -32727, -32705, -32678, -32646, + -32609, -32567, -32520, -32468, -32412, -32350, -32284, -32213, + -32137, -32056, -31970, -31880, -31785, -31684, -31580, -31470, + -31356, -31236, -31113, -30984, -30851, -30713, -30571, -30424, + -30272, -30116, -29955, -29790, -29621, -29446, -29268, -29085, + -28897, -28706, -28510, -28309, -28105, -27896, -27683, -27466, + -27244, -27019, -26789, -26556, -26318, -26077, -25831, -25582, + -25329, -25072, -24811, -24546, -24278, -24006, -23731, -23452, + -23169, -22883, -22594, -22301, -22004, -21705, -21402, -21096, + -20787, -20474, -20159, -19840, -19519, -19194, -18867, -18537, + -18204, -17868, -17530, -17189, -16845, -16499, -16150, -15799, + -15446, -15090, -14732, -14372, -14009, -13645, -13278, -12909, + -12539, -12166, -11792, -11416, -11038, -10659, -10278, -9895, + -9511, -9126, -8739, -8351, -7961, -7571, -7179, -6786, + -6392, -5997, -5601, -5205, -4807, -4409, -4011, -3611, + -3211, -2811, -2410, -2009, -1607, -1206, -804, -402, + 0, 402, 804, 1206, 1607, 2009, 2410, 2811, + 3211, 3611, 4011, 4409, 4807, 5205, 5601, 5997, + 6392, 6786, 7179, 7571, 7961, 8351, 8739, 9126, + 9511, 9895, 10278, 10659, 11038, 11416, 11792, 12166, + 12539, 12909, 13278, 13645, 14009, 14372, 14732, 15090, + 15446, 15799, 16150, 16499, 16845, 17189, 17530, 17868, + 18204, 18537, 18867, 19194, 19519, 19840, 20159, 20474, + 20787, 21096, 21402, 21705, 22004, 22301, 22594, 22883, + 23169, 23452, 23731, 24006, 24278, 24546, 24811, 25072, + 25329, 25582, 25831, 26077, 26318, 26556, 26789, 27019, + 27244, 27466, 27683, 27896, 28105, 28309, 28510, 28706, + 28897, 29085, 29268, 29446, 29621, 29790, 29955, 30116, + 30272, 30424, 30571, 30713, 30851, 30984, 31113, 31236, + 31356, 31470, 31580, 31684, 31785, 31880, 31970, 32056, + 32137, 32213, 32284, 32350, 32412, 32468, 32520, 32567, + 32609, 32646, 32678, 32705, 32727, 32744, 32757, 32764 +}; + +#define COS(x) (costab[(((x)>>7)&0x1ff)]) +#define SIN(x) COS((x)+0xc000) + diff --git a/soundcard/Makefile.am b/soundcard/Makefile.am new file mode 100644 index 0000000..c4cede2 --- /dev/null +++ b/soundcard/Makefile.am @@ -0,0 +1,45 @@ +INCLUDES = @XML_CFLAGS@ -I$(top_srcdir)/matlib -I$(top_srcdir)/libmisc \ + -I$(top_srcdir)/directx/include \ + -I$(top_srcdir)/directx/include/directx6 \ + @AUDIOFILE_CFLAGS@ + +MODEMLIBS = ../afsk/libafsk.a ../fsk/libfsk.a ../pammodem/libpam.a ../pskmodem/libpsk.a ../newqpsk/libnewqpsk.a ../p3dmodem/libp3d.a + +man_MANS = soundmodem.8 + +if WIN32 +SBINPROG = +NOINSTPROG = +libpttio_a_SOURCES = winptt2.c +libaudioio_a_SOURCES = winaudioio.c audiofilein.c chansim.c +liblog_a_SOURCES = winlog.c +else +SBINPROG = soundmodem +NOINSTPROG = testkiss chansim chansimberr +libpttio_a_SOURCES = ptt.c +libaudioio_a_SOURCES = audioio.c alsaio.c audiofilein.c chansim.c +liblog_a_SOURCES = log.c +endif + +include_HEADERS = modem.h simd.h +noinst_HEADERS = ppdev.h soundio.h audioio.h kisspkt.h pttio.h + +sbin_PROGRAMS = $(SBINPROG) +noinst_PROGRAMS = $(NOINSTPROG) +noinst_LIBRARIES = libcommon.a libpttio.a libaudioio.a liblog.a + +libcommon_a_SOURCES = simd.c snprintpkt.c + +soundmodem_SOURCES = kisspkt.c main.c +soundmodem_LDADD = $(MODEMLIBS) libcommon.a liblog.a libaudioio.a libpttio.a ../matlib/libmat.a ../libmisc/libmisc.a @XML_LIBS@ @LIBTHREAD@ @AUDIOFILE_LIBS@ + +testkiss_SOURCES = kisspkt.c testkiss.c log.c snprintpkt.c +testkiss_LDADD = ../libmisc/libmisc.a @LIBTHREAD@ + +chansim_SOURCES = simd.c pktsimple.c main.c +chansim_LDADD = $(MODEMLIBS) liblog.a libaudioio.a libpttio.a ../matlib/libmat.a ../libmisc/libmisc.a @XML_LIBS@ @LIBTHREAD@ @AUDIOFILE_LIBS@ + +chansimberr_SOURCES = simd.c pktberr.c main.c +chansimberr_LDADD = $(MODEMLIBS) liblog.a libaudioio.a libpttio.a ../matlib/libmat.a ../libmisc/libmisc.a @XML_LIBS@ @LIBTHREAD@ @AUDIOFILE_LIBS@ + +EXTRA_DIST = test.xml audioio.c audiofilein.c chansim.c winaudioio.c ptt.c winptt.c winptt2.c log.c winlog.c soundmodem.8 diff --git a/soundcard/Makefile.in b/soundcard/Makefile.in new file mode 100644 index 0000000..a74fd3d --- /dev/null +++ b/soundcard/Makefile.in @@ -0,0 +1,753 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +sbin_PROGRAMS = $(am__EXEEXT_2) +noinst_PROGRAMS = $(am__EXEEXT_1) +subdir = soundcard +DIST_COMMON = $(include_HEADERS) $(noinst_HEADERS) \ + $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +libaudioio_a_AR = $(AR) $(ARFLAGS) +libaudioio_a_LIBADD = +am__libaudioio_a_SOURCES_DIST = audioio.c alsaio.c audiofilein.c \ + chansim.c winaudioio.c +@WIN32_FALSE@am_libaudioio_a_OBJECTS = audioio.$(OBJEXT) \ +@WIN32_FALSE@ alsaio.$(OBJEXT) audiofilein.$(OBJEXT) \ +@WIN32_FALSE@ chansim.$(OBJEXT) +@WIN32_TRUE@am_libaudioio_a_OBJECTS = winaudioio.$(OBJEXT) \ +@WIN32_TRUE@ audiofilein.$(OBJEXT) chansim.$(OBJEXT) +libaudioio_a_OBJECTS = $(am_libaudioio_a_OBJECTS) +libcommon_a_AR = $(AR) $(ARFLAGS) +libcommon_a_LIBADD = +am_libcommon_a_OBJECTS = simd.$(OBJEXT) snprintpkt.$(OBJEXT) +libcommon_a_OBJECTS = $(am_libcommon_a_OBJECTS) +liblog_a_AR = $(AR) $(ARFLAGS) +liblog_a_LIBADD = +am__liblog_a_SOURCES_DIST = log.c winlog.c +@WIN32_FALSE@am_liblog_a_OBJECTS = log.$(OBJEXT) +@WIN32_TRUE@am_liblog_a_OBJECTS = winlog.$(OBJEXT) +liblog_a_OBJECTS = $(am_liblog_a_OBJECTS) +libpttio_a_AR = $(AR) $(ARFLAGS) +libpttio_a_LIBADD = +am__libpttio_a_SOURCES_DIST = ptt.c winptt2.c +@WIN32_FALSE@am_libpttio_a_OBJECTS = ptt.$(OBJEXT) +@WIN32_TRUE@am_libpttio_a_OBJECTS = winptt2.$(OBJEXT) +libpttio_a_OBJECTS = $(am_libpttio_a_OBJECTS) +@WIN32_FALSE@am__EXEEXT_1 = testkiss$(EXEEXT) chansim$(EXEEXT) \ +@WIN32_FALSE@ chansimberr$(EXEEXT) +@WIN32_FALSE@am__EXEEXT_2 = soundmodem$(EXEEXT) +am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)" \ + "$(DESTDIR)$(includedir)" +PROGRAMS = $(noinst_PROGRAMS) $(sbin_PROGRAMS) +am_chansim_OBJECTS = simd.$(OBJEXT) pktsimple.$(OBJEXT) main.$(OBJEXT) +chansim_OBJECTS = $(am_chansim_OBJECTS) +chansim_DEPENDENCIES = $(MODEMLIBS) liblog.a libaudioio.a libpttio.a \ + ../matlib/libmat.a ../libmisc/libmisc.a +am_chansimberr_OBJECTS = simd.$(OBJEXT) pktberr.$(OBJEXT) \ + main.$(OBJEXT) +chansimberr_OBJECTS = $(am_chansimberr_OBJECTS) +chansimberr_DEPENDENCIES = $(MODEMLIBS) liblog.a libaudioio.a \ + libpttio.a ../matlib/libmat.a ../libmisc/libmisc.a +am_soundmodem_OBJECTS = kisspkt.$(OBJEXT) main.$(OBJEXT) +soundmodem_OBJECTS = $(am_soundmodem_OBJECTS) +soundmodem_DEPENDENCIES = $(MODEMLIBS) libcommon.a liblog.a \ + libaudioio.a libpttio.a ../matlib/libmat.a \ + ../libmisc/libmisc.a +am_testkiss_OBJECTS = kisspkt.$(OBJEXT) testkiss.$(OBJEXT) \ + log.$(OBJEXT) snprintpkt.$(OBJEXT) +testkiss_OBJECTS = $(am_testkiss_OBJECTS) +testkiss_DEPENDENCIES = ../libmisc/libmisc.a +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libaudioio_a_SOURCES) $(libcommon_a_SOURCES) \ + $(liblog_a_SOURCES) $(libpttio_a_SOURCES) $(chansim_SOURCES) \ + $(chansimberr_SOURCES) $(soundmodem_SOURCES) \ + $(testkiss_SOURCES) +DIST_SOURCES = $(am__libaudioio_a_SOURCES_DIST) $(libcommon_a_SOURCES) \ + $(am__liblog_a_SOURCES_DIST) $(am__libpttio_a_SOURCES_DIST) \ + $(chansim_SOURCES) $(chansimberr_SOURCES) \ + $(soundmodem_SOURCES) $(testkiss_SOURCES) +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +man8dir = $(mandir)/man8 +NROFF = nroff +MANS = $(man_MANS) +HEADERS = $(include_HEADERS) $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +ALSA_CFLAGS = @ALSA_CFLAGS@ +ALSA_LIBS = @ALSA_LIBS@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUDIOFILE_CFLAGS = @AUDIOFILE_CFLAGS@ +AUDIOFILE_LIBS = @AUDIOFILE_LIBS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +HAVE_ALSA = @HAVE_ALSA@ +HAVE_BITTYPES = @HAVE_BITTYPES@ +HAVE_DIRECTX = @HAVE_DIRECTX@ +HAVE_IFRNEWNAME = @HAVE_IFRNEWNAME@ +HAVE_MKISS = @HAVE_MKISS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTHREAD = @LIBTHREAD@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +M_PI = @M_PI@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USEMMX = @USEMMX@ +USEVIS = @USEVIS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WIN32 = @WIN32@ +WINDRES = @WINDRES@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XML_CFLAGS = @XML_CFLAGS@ +XML_LIBS = @XML_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +INCLUDES = @XML_CFLAGS@ -I$(top_srcdir)/matlib -I$(top_srcdir)/libmisc \ + -I$(top_srcdir)/directx/include \ + -I$(top_srcdir)/directx/include/directx6 \ + @AUDIOFILE_CFLAGS@ + +MODEMLIBS = ../afsk/libafsk.a ../fsk/libfsk.a ../pammodem/libpam.a ../pskmodem/libpsk.a ../newqpsk/libnewqpsk.a ../p3dmodem/libp3d.a +man_MANS = soundmodem.8 +@WIN32_FALSE@SBINPROG = soundmodem +@WIN32_TRUE@SBINPROG = +@WIN32_FALSE@NOINSTPROG = testkiss chansim chansimberr +@WIN32_TRUE@NOINSTPROG = +@WIN32_FALSE@libpttio_a_SOURCES = ptt.c +@WIN32_TRUE@libpttio_a_SOURCES = winptt2.c +@WIN32_FALSE@libaudioio_a_SOURCES = audioio.c alsaio.c audiofilein.c chansim.c +@WIN32_TRUE@libaudioio_a_SOURCES = winaudioio.c audiofilein.c chansim.c +@WIN32_FALSE@liblog_a_SOURCES = log.c +@WIN32_TRUE@liblog_a_SOURCES = winlog.c +include_HEADERS = modem.h simd.h +noinst_HEADERS = ppdev.h soundio.h audioio.h kisspkt.h pttio.h +noinst_LIBRARIES = libcommon.a libpttio.a libaudioio.a liblog.a +libcommon_a_SOURCES = simd.c snprintpkt.c +soundmodem_SOURCES = kisspkt.c main.c +soundmodem_LDADD = $(MODEMLIBS) libcommon.a liblog.a libaudioio.a libpttio.a ../matlib/libmat.a ../libmisc/libmisc.a @XML_LIBS@ @LIBTHREAD@ @AUDIOFILE_LIBS@ +testkiss_SOURCES = kisspkt.c testkiss.c log.c snprintpkt.c +testkiss_LDADD = ../libmisc/libmisc.a @LIBTHREAD@ +chansim_SOURCES = simd.c pktsimple.c main.c +chansim_LDADD = $(MODEMLIBS) liblog.a libaudioio.a libpttio.a ../matlib/libmat.a ../libmisc/libmisc.a @XML_LIBS@ @LIBTHREAD@ @AUDIOFILE_LIBS@ +chansimberr_SOURCES = simd.c pktberr.c main.c +chansimberr_LDADD = $(MODEMLIBS) liblog.a libaudioio.a libpttio.a ../matlib/libmat.a ../libmisc/libmisc.a @XML_LIBS@ @LIBTHREAD@ @AUDIOFILE_LIBS@ +EXTRA_DIST = test.xml audioio.c audiofilein.c chansim.c winaudioio.c ptt.c winptt.c winptt2.c log.c winlog.c soundmodem.8 +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu soundcard/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu soundcard/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libaudioio.a: $(libaudioio_a_OBJECTS) $(libaudioio_a_DEPENDENCIES) + -rm -f libaudioio.a + $(libaudioio_a_AR) libaudioio.a $(libaudioio_a_OBJECTS) $(libaudioio_a_LIBADD) + $(RANLIB) libaudioio.a +libcommon.a: $(libcommon_a_OBJECTS) $(libcommon_a_DEPENDENCIES) + -rm -f libcommon.a + $(libcommon_a_AR) libcommon.a $(libcommon_a_OBJECTS) $(libcommon_a_LIBADD) + $(RANLIB) libcommon.a +liblog.a: $(liblog_a_OBJECTS) $(liblog_a_DEPENDENCIES) + -rm -f liblog.a + $(liblog_a_AR) liblog.a $(liblog_a_OBJECTS) $(liblog_a_LIBADD) + $(RANLIB) liblog.a +libpttio.a: $(libpttio_a_OBJECTS) $(libpttio_a_DEPENDENCIES) + -rm -f libpttio.a + $(libpttio_a_AR) libpttio.a $(libpttio_a_OBJECTS) $(libpttio_a_LIBADD) + $(RANLIB) libpttio.a + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) +install-sbinPROGRAMS: $(sbin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)" + @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-sbinPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(sbindir)" && rm -f $$files + +clean-sbinPROGRAMS: + -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) +chansim$(EXEEXT): $(chansim_OBJECTS) $(chansim_DEPENDENCIES) + @rm -f chansim$(EXEEXT) + $(LINK) $(chansim_OBJECTS) $(chansim_LDADD) $(LIBS) +chansimberr$(EXEEXT): $(chansimberr_OBJECTS) $(chansimberr_DEPENDENCIES) + @rm -f chansimberr$(EXEEXT) + $(LINK) $(chansimberr_OBJECTS) $(chansimberr_LDADD) $(LIBS) +soundmodem$(EXEEXT): $(soundmodem_OBJECTS) $(soundmodem_DEPENDENCIES) + @rm -f soundmodem$(EXEEXT) + $(LINK) $(soundmodem_OBJECTS) $(soundmodem_LDADD) $(LIBS) +testkiss$(EXEEXT): $(testkiss_OBJECTS) $(testkiss_DEPENDENCIES) + @rm -f testkiss$(EXEEXT) + $(LINK) $(testkiss_OBJECTS) $(testkiss_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alsaio.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audiofilein.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audioio.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chansim.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kisspkt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pktberr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pktsimple.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ptt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snprintpkt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testkiss.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winaudioio.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winlog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/winptt2.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +install-man8: $(man_MANS) + @$(NORMAL_INSTALL) + test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)" + @list=''; test -n "$(man8dir)" || exit 0; \ + { for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.8[a-z]*$$/p'; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \ + done; } + +uninstall-man8: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man8dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.8[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + test -z "$$files" || { \ + echo " ( cd '$(DESTDIR)$(man8dir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(man8dir)" && rm -f $$files; } +install-includeHEADERS: $(include_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)" + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ + done + +uninstall-includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includedir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @list='$(MANS)'; if test -n "$$list"; then \ + list=`for p in $$list; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ + if test -n "$$list" && \ + grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ + echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ + grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ + echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ + echo " typically \`make maintainer-clean' will remove them" >&2; \ + exit 1; \ + else :; fi; \ + else :; fi + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(MANS) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(includedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES clean-noinstPROGRAMS \ + clean-sbinPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includeHEADERS install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-sbinPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man8 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includeHEADERS uninstall-man \ + uninstall-sbinPROGRAMS + +uninstall-man: uninstall-man8 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES clean-noinstPROGRAMS clean-sbinPROGRAMS \ + ctags distclean distclean-compile distclean-generic \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includeHEADERS install-info \ + install-info-am install-man install-man8 install-pdf \ + install-pdf-am install-ps install-ps-am install-sbinPROGRAMS \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-includeHEADERS \ + uninstall-man uninstall-man8 uninstall-sbinPROGRAMS + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/soundcard/alsaio.c b/soundcard/alsaio.c new file mode 100644 index 0000000..cd9501d --- /dev/null +++ b/soundcard/alsaio.c @@ -0,0 +1,625 @@ +/*****************************************************************************/ + +/* + * alsaio.c -- Audio I/O using the ALSA API. + * + * Copyright (C) 1999-2000, 2004 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please note that the GPL allows you to use the driver, NOT the radio. + * In order to use the radio, you need a license from the communications + * authority of your country. + * + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE +#define _REENTRANT + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "soundio.h" +#include "audioio.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_ALSA + +#include + +/* ---------------------------------------------------------------------- */ + +#define AUDIOIBUFSIZE 4096 + +struct audioio_unix { + struct audioio audioio; + unsigned int samplerate; + unsigned int capturechannelmode; + snd_pcm_t *playback_handle; + snd_pcm_t *capture_handle; + unsigned int fragsize; + pthread_mutex_t iomutex; + pthread_cond_t iocond; + unsigned int flags; + unsigned int ptr; + u_int16_t ptime; + int16_t ibuf[AUDIOIBUFSIZE]; +}; + +struct modemparams ioparams_alsasoundcard[] = { + { "device", "ALSA Audio Driver", "Path name of the audio (soundcard) driver", "hw:0,0", MODEMPAR_COMBO, + { c: { { "hw:0,0", "plughw:0,0", "hw:1,0", "plughw:1,0", "hw:2,0", "plughw:2,0", "hw:3,0", "plughw:3,0" } } } }, + { "halfdup", "Half Duplex", "Force operating the Sound Driver in Half Duplex mode", "0", MODEMPAR_CHECKBUTTON }, + { "capturechannelmode", "Capture Channel", "Capture Channel", "Mono", MODEMPAR_COMBO, + { c: { { "Mono", "Left", "Right" } } } }, + { NULL, } +}; + +#define CAP_HALFDUPLEX 0x100 + +#define FLG_READING 0x1000 +#define FLG_HALFDUPLEXTX 0x2000 +#define FLG_TERMINATERX 0x4000 + +#ifndef INFTIM +#define INFTIM (-1) +#endif + +/* ---------------------------------------------------------------------- */ + +static void iorelease(struct audioio *aio); +static void iowrite(struct audioio *aio, const int16_t *samples, unsigned int nr); +static void ioread(struct audioio *aio, int16_t *samples, unsigned int nr, u_int16_t tim); +static u_int16_t iocurtime(struct audioio *aio); +static void iotransmitstart(struct audioio *aio); +static void iotransmitstop(struct audioio *aio); +static void ioterminateread(struct audioio *aio); + +/* ---------------------------------------------------------------------- */ + +static inline int iomodetofmode(unsigned int flags) +{ + switch (flags & IO_RDWR) { + default: + case IO_RDONLY: + return O_RDONLY; + + case IO_WRONLY: + return O_WRONLY; + + case IO_RDWR: + return O_RDWR; + } +} + +/* ---------------------------------------------------------------------- */ + +static snd_pcm_t *open_alsa(const char *name, snd_pcm_stream_t direction, unsigned int *samplerate, unsigned int *chanmode) +{ + snd_pcm_t *pcm_handle; + snd_pcm_hw_params_t *hwparams; + snd_pcm_format_mask_t *fmtmask; + snd_pcm_sw_params_t *swparams; + /* set fragment size so we have approx. 10-20ms wakeup latency */ + unsigned int buffer_time = 500000; /* ring buffer length in us */ + unsigned int period_time = 15000; /* period time in us */ + snd_pcm_format_t samplefmt; + snd_pcm_uframes_t buffer_size; + snd_pcm_uframes_t period_size; + int err, dir; + + if (snd_pcm_open(&pcm_handle, name, direction, 0) < 0) { + logprintf(MLOG_ERROR, "alsa: Error opening PCM device %s\n", name); + return NULL; + } + /* + * Set hardware parameter + */ + snd_pcm_hw_params_alloca(&hwparams); + /* choose all parameters */ + err = snd_pcm_hw_params_any(pcm_handle, hwparams); + if (err < 0) { + logprintf(MLOG_ERROR, "Broken configuration for capture: no configurations available: %s\n", snd_strerror(err)); + goto err; + } + /* set the interleaved read/write format */ + err = snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED); + if (err < 0) { + logprintf(MLOG_ERROR, "Access type RW_INTERLEAVED not available for capture: %s\n", snd_strerror(err)); + goto err; + } + /* set the sample format */ + snd_pcm_format_mask_alloca(&fmtmask); + snd_pcm_format_mask_set(fmtmask, SND_PCM_FORMAT_S16); + err = snd_pcm_hw_params_set_format_mask(pcm_handle, hwparams, fmtmask); + if (err < 0) { + logprintf(MLOG_ERROR, "Sample format S16_NE not available for capture: %s\n", snd_strerror(err)); + goto err; + } + /* set the count of channels */ + if (chanmode && *chanmode) { + err = snd_pcm_hw_params_set_channels(pcm_handle, hwparams, 2); + if (err < 0) { + logprintf(MLOG_ERROR, "Channels count (2) not available for captures: %s; trying Mono\n", snd_strerror(err)); + *chanmode = 0; + } + } + if (!chanmode || !*chanmode) { + err = snd_pcm_hw_params_set_channels(pcm_handle, hwparams, 1); + if (err < 0) { + logprintf(MLOG_ERROR, "Channels count (1) not available for captures: %s\n", snd_strerror(err)); + goto err; + } + } + /* set the stream rate */ + err = snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, samplerate, 0); + if (err < 0) { + logprintf(MLOG_ERROR, "Rate %iHz not available for capture: %s\n", *samplerate, snd_strerror(err)); + goto err; + } + /* set the buffer time */ + err = snd_pcm_hw_params_set_buffer_time_near(pcm_handle, hwparams, &buffer_time, &dir); + if (err < 0) { + logprintf(MLOG_ERROR, "Unable to set buffer time %i for capture: %s\n", buffer_time, snd_strerror(err)); + goto err; + } + /* set the period time */ + err = snd_pcm_hw_params_set_period_time_near(pcm_handle, hwparams, &period_time, &dir); + if (err < 0) { + logprintf(MLOG_ERROR, "Unable to set period time %i for capture: %s\n", period_time, snd_strerror(err)); + goto err; + } + /* write the parameters to device */ + err = snd_pcm_hw_params(pcm_handle, hwparams); + if (err < 0) { + logprintf(MLOG_ERROR, "Unable to set hw params for capture: %s\n", snd_strerror(err)); + goto err; + } + /* read current configuration */ + err = snd_pcm_hw_params_get_buffer_size(hwparams, &buffer_size); + if (err < 0) { + logprintf(MLOG_ERROR, "Unable to get buffer size for capture: %s\n", snd_strerror(err)); + goto err; + } + err = snd_pcm_hw_params_get_period_size(hwparams, &period_size, &dir); + if (err < 0) { + logprintf(MLOG_ERROR, "Unable to get period size for capture: %s\n", snd_strerror(err)); + goto err; + } + err = snd_pcm_hw_params_get_rate(hwparams, samplerate, &dir); + if (err < 0) { + logprintf(MLOG_ERROR, "Unable to get the sample rate for capture: %s\n", snd_strerror(err)); + goto err; + } + err = snd_pcm_hw_params_get_format(hwparams, &samplefmt); + if (err < 0) { + logprintf(MLOG_ERROR, "Unable to get the sample format for capture: %s\n", snd_strerror(err)); + goto err; + } + err = snd_pcm_hw_params_get_sbits(hwparams); + if (err < 0) { + logprintf(MLOG_ERROR, "Unable to get the number of significant bits for capture: %s\n", snd_strerror(err)); + goto err; + } + printf("ALSA: Using sample rate %u, sample format %d, significant bits %d, buffer size %u, period size %u\n", + *samplerate, (int)samplefmt, err, (unsigned int)buffer_size, (unsigned int)period_size); + /* + * Set Software Parameters + */ + snd_pcm_sw_params_alloca(&swparams); + /* get the current swparams */ + err = snd_pcm_sw_params_current(pcm_handle, swparams); + if (err < 0) { + logprintf(MLOG_ERROR, "Unable to determine current swparams for capture: %s\n", snd_strerror(err)); + goto err; + } + /* start the transfer when samples are available */ + err = snd_pcm_sw_params_set_start_threshold(pcm_handle, swparams, 64); + if (err < 0) { + logprintf(MLOG_ERROR, "Unable to set start threshold mode for capture: %s\n", snd_strerror(err)); + goto err; + } + /* allow the transfer when at least 1 samples can be processed */ + err = snd_pcm_sw_params_set_avail_min(pcm_handle, swparams, 1); + if (err < 0) { + logprintf(MLOG_ERROR, "Unable to set avail min for capture: %s\n", snd_strerror(err)); + goto err; + } + /* align all transfers to 1 sample */ + err = snd_pcm_sw_params_set_xfer_align(pcm_handle, swparams, 1); + if (err < 0) { + logprintf(MLOG_ERROR, "Unable to set transfer align for capture: %s\n", snd_strerror(err)); + goto err; + } + /* write the parameters to the capture device */ + err = snd_pcm_sw_params(pcm_handle, swparams); + if (err < 0) { + logprintf(MLOG_ERROR, "Unable to set sw params for capture: %s\n", snd_strerror(err)); + goto err; + } + if (snd_pcm_prepare(pcm_handle) < 0) { + logprintf(MLOG_ERROR, "Error preparing capture.\n"); + goto err; + } + return pcm_handle; + + err: + snd_pcm_close(pcm_handle); + return NULL; +} + +/* ---------------------------------------------------------------------- */ +/* + * Linux ALSA audio + */ + +struct audioio *ioopen_alsasoundcard(unsigned int *samplerate, unsigned int flags, const char *params[]) +{ + const char *audiopath = params[0]; + struct audioio_unix *audioio; + unsigned int prate, crate, i; + + audioio = calloc(1, sizeof(struct audioio_unix)); + if (!audioio) + return NULL; + audioio->audioio.release = iorelease; + if (!audiopath) + audiopath = "hw:0,0"; + prate = crate = *samplerate; + audioio->capturechannelmode = 0; + if (params[2] && !strcmp(params[2], ioparams_alsasoundcard[2].u.c.combostr[1])) + audioio->capturechannelmode = 1; + else if (params[2] && !strcmp(params[2], ioparams_alsasoundcard[2].u.c.combostr[2])) + audioio->capturechannelmode = 2; + /* todo: remove configurations with different rx/tx rates or make different rates work...*/ + if (flags & IO_RDONLY) { + audioio->audioio.terminateread = ioterminateread; + audioio->audioio.read = ioread; + audioio->audioio.curtime = iocurtime; + audioio->capture_handle = open_alsa(audiopath, SND_PCM_STREAM_CAPTURE, &crate, &audioio->capturechannelmode); + if (!audioio->capture_handle) + goto err; + } + if (flags & IO_WRONLY) { + audioio->audioio.transmitstart = iotransmitstart; + audioio->audioio.transmitstop = iotransmitstop; + audioio->audioio.write = iowrite; + i = 0; + audioio->playback_handle = open_alsa(audiopath, SND_PCM_STREAM_PLAYBACK, &prate, &i); + if (!audioio->playback_handle) + goto err; + } + audioio->samplerate = prate; + if ((flags & (IO_RDONLY|IO_WRONLY)) == (IO_RDONLY|IO_WRONLY) && abs(prate - crate) > 1) { + logprintf(MLOG_ERROR, "audio: Error, playback/capture sample rates do not match: %u/%u\n", prate, crate); + goto err; + } + pthread_cond_init(&audioio->iocond, NULL); + pthread_mutex_init(&audioio->iomutex, NULL); + audioio->flags = flags & IO_RDWR; + audioio->ptr = audioio->ptime = 0; + logprintf(MLOG_DEBUG, "audio: starting \"%s\"\n", audiopath); + if (params[1] && params[1][0] != '0') { + audioio->flags |= CAP_HALFDUPLEX; + logprintf(MLOG_INFO, "audio: forcing half duplex mode\n"); + } + *samplerate = audioio->samplerate; + return &audioio->audioio; + + err: + if (audioio->playback_handle) + snd_pcm_close(audioio->playback_handle); + if (audioio->capture_handle) + snd_pcm_close(audioio->capture_handle); + free(audioio); + return NULL; +} + +static inline void iotxend(struct audioio_unix *audioio) +{ + int err; + + err = snd_pcm_drain(audioio->playback_handle); + if (err < 0) + logprintf(MLOG_ERROR, "snd_pcm_drain in iotxend: %s", snd_strerror(err)); + if (!(audioio->flags & CAP_HALFDUPLEX)) + return; + err = snd_pcm_start(audioio->capture_handle); + if (err < 0 && err != -EBADFD) + logprintf(MLOG_ERROR, "snd_pcm_start in iotxend: %s", snd_strerror(err)); +} + +static inline void iotxstart(struct audioio_unix *audioio) +{ + int err; + + if (snd_pcm_prepare(audioio->playback_handle) < 0) { + logprintf(MLOG_ERROR, "Error preparing tx.\n"); + } + err = snd_pcm_start(audioio->playback_handle); + if (err < 0) + logprintf(MLOG_ERROR, "snd_pcm_start in iotxstart: %s", snd_strerror(err)); +} + +/* ---------------------------------------------------------------------- */ + +static void iorelease(struct audioio *aio) +{ + struct audioio_unix *audioio = (struct audioio_unix *)aio; + + pthread_cond_destroy(&audioio->iocond); + pthread_mutex_destroy(&audioio->iomutex); + audioio->flags = audioio->ptr = audioio->ptime = 0; + if (audioio->playback_handle) + snd_pcm_close(audioio->playback_handle); + if (audioio->capture_handle) + snd_pcm_close(audioio->capture_handle); + free(audioio); +} + +static void iowrite(struct audioio *aio, const int16_t *samples, unsigned int nr) +{ + struct audioio_unix *audioio = (struct audioio_unix *)aio; + unsigned char *p = (unsigned char *)samples; + int err; + + if (!audioio->playback_handle) + return; + err = snd_pcm_writei(audioio->playback_handle, p, nr); + if (err == -EPIPE) { + if (snd_pcm_prepare(audioio->playback_handle) < 0) { + logprintf(MLOG_ERROR, "Error preparing tx.\n"); + } + err = snd_pcm_writei(audioio->playback_handle, p, nr); + } + if (err < 0) { + logprintf(MLOG_ERROR, "audio: snd_pcm_writei: %s\n", snd_strerror(err)); + return; + } + if (err < nr) { + logprintf(MLOG_ERROR, "audio: snd_pcm_writei: not enough samples written: %d < %u\n", err, nr); + return; + } +} + +static void ioread(struct audioio *aio, int16_t *samples, unsigned int nr, u_int16_t tim) +{ + struct audioio_unix *audioio = (struct audioio_unix *)aio; + int16_t ibuf[2*AUDIOIBUFSIZE/8]; + int16_t *ip; + unsigned int p; + int i, j; + + pthread_mutex_lock(&audioio->iomutex); + while (nr > 0) { + if (audioio->flags & FLG_TERMINATERX) { + pthread_mutex_unlock(&audioio->iomutex); + pthread_exit(NULL); + } + i = (signed)(int16_t)(audioio->ptime - tim); + if (i > AUDIOIBUFSIZE) { + pthread_mutex_unlock(&audioio->iomutex); + i -= AUDIOIBUFSIZE; + if (i > nr) + i = nr; + memset(samples, 0, i * sizeof(samples[0])); + logprintf(MLOG_ERROR, "ioread: request time %u out of time window [%u,%u)\n", tim, audioio->ptime-AUDIOIBUFSIZE, audioio->ptime); + samples += i; + nr -= i; + tim += i; + pthread_mutex_lock(&audioio->iomutex); + continue; + } + if (i > 0) { + p = (AUDIOIBUFSIZE + audioio->ptr - i) % AUDIOIBUFSIZE; + if (i > nr) + i = nr; + if (i > AUDIOIBUFSIZE-p) + i = AUDIOIBUFSIZE-p; + memcpy(samples, &audioio->ibuf[p], i * sizeof(samples[0])); + nr -= i; + samples += i; + tim += i; + continue; + } + if (audioio->flags & (FLG_READING|FLG_HALFDUPLEXTX)) { + pthread_cond_wait(&audioio->iocond, &audioio->iomutex); + continue; + } + audioio->flags |= FLG_READING; + pthread_mutex_unlock(&audioio->iomutex); + if (!audioio->capture_handle) + logerr(MLOG_FATAL, "audio: read: capture handle NULL"); + i = snd_pcm_readi(audioio->capture_handle, ibuf, sizeof(ibuf)/sizeof(ibuf[0])/2); + if (i == -EPIPE) { + if (snd_pcm_prepare(audioio->capture_handle) < 0) { + logprintf(MLOG_ERROR, "Error preparing rx.\n"); + } + i = snd_pcm_readi(audioio->capture_handle, ibuf, sizeof(ibuf)/sizeof(ibuf[0])/2); + } + if (i < 0) + logprintf(MLOG_FATAL, "audio: snd_pcm_readi: %s", snd_strerror(i)); + if (!i) { + logerr(MLOG_ERROR, "audio: snd_pcm_readi returned 0??"); + pthread_mutex_lock(&audioio->iomutex); + audioio->flags &= ~FLG_READING; + pthread_cond_broadcast(&audioio->iocond); + continue; + } + p = i; + pthread_mutex_lock(&audioio->iomutex); + audioio->flags &= ~FLG_READING; + ip = ibuf; + if (audioio->capturechannelmode) + ip += audioio->capturechannelmode-1; + for (; p > 0; ) { + i = p; + if (i > AUDIOIBUFSIZE-audioio->ptr) + i = AUDIOIBUFSIZE-audioio->ptr; + if (audioio->capturechannelmode) { + for (j = 0; j < i; j++, ip += 2) + audioio->ibuf[audioio->ptr + j] = *ip; + } else { + memcpy(&audioio->ibuf[audioio->ptr], ip, i * sizeof(audioio->ibuf[0])); + ip += i; + } + audioio->ptr = (audioio->ptr + i) % AUDIOIBUFSIZE; + audioio->ptime += i; + p -= i; + } + pthread_cond_broadcast(&audioio->iocond); + } + pthread_mutex_unlock(&audioio->iomutex); +} + +static u_int16_t iocurtime(struct audioio *aio) +{ + struct audioio_unix *audioio = (struct audioio_unix *)aio; + u_int16_t res; + int16_t ibuf[2*AUDIOIBUFSIZE/8]; + int16_t *ip; + unsigned int p; + int i, j, r; + + pthread_mutex_lock(&audioio->iomutex); + for (;;) { + if (audioio->flags & (FLG_READING|FLG_HALFDUPLEXTX)) + break; + audioio->flags |= FLG_READING; + pthread_mutex_unlock(&audioio->iomutex); + if (!audioio->capture_handle) + logprintf(MLOG_FATAL, "audio: read: capture handle NULL"); + r = snd_pcm_nonblock(audioio->capture_handle, 1); + if (r < 0) + logprintf(MLOG_FATAL, "audio: snd_pcm_nonblock: %s", snd_strerror(r)); + i = snd_pcm_readi(audioio->capture_handle, ibuf, sizeof(ibuf)/sizeof(ibuf[0])/2); + r = snd_pcm_nonblock(audioio->capture_handle, 0); + if (r < 0) + logprintf(MLOG_FATAL, "audio: snd_pcm_nonblock: %s", snd_strerror(r)); + if (!i || i == -EAGAIN) { + pthread_mutex_lock(&audioio->iomutex); + audioio->flags &= ~FLG_READING; + pthread_cond_broadcast(&audioio->iocond); + break; + } + if (i < 0) + logprintf(MLOG_FATAL, "audio: snd_pcm_readi: %s", snd_strerror(i)); + p = i; + pthread_mutex_lock(&audioio->iomutex); + audioio->flags &= ~FLG_READING; + ip = ibuf; + if (audioio->capturechannelmode) + ip += audioio->capturechannelmode-1; + for (; p > 0; ) { + i = p; + if (i > AUDIOIBUFSIZE-audioio->ptr) + i = AUDIOIBUFSIZE-audioio->ptr; + if (audioio->capturechannelmode) { + for (j = 0; j < i; j++, ip += 2) + audioio->ibuf[audioio->ptr + j] = *ip; + } else { + memcpy(&audioio->ibuf[audioio->ptr], ip, i * sizeof(audioio->ibuf[0])); + ip += i; + } + audioio->ptr = (audioio->ptr + i) % AUDIOIBUFSIZE; + audioio->ptime += i; + p -= i; + } + pthread_cond_broadcast(&audioio->iocond); + } + res = audioio->ptime; + pthread_mutex_unlock(&audioio->iomutex); + return res; +} + +static void iotransmitstart(struct audioio *aio) +{ + struct audioio_unix *audioio = (struct audioio_unix *)aio; + if (audioio->flags & CAP_HALFDUPLEX) { + pthread_mutex_lock(&audioio->iomutex); + audioio->flags |= FLG_HALFDUPLEXTX; + while (audioio->flags & FLG_READING) + pthread_cond_wait(&audioio->iocond, &audioio->iomutex); + pthread_mutex_unlock(&audioio->iomutex); + } + iotxstart(audioio); +} + +static void iotransmitstop(struct audioio *aio) +{ + struct audioio_unix *audioio = (struct audioio_unix *)aio; + +#if 0 + short sbuf[256]; + unsigned int i, j; + /* add 20ms tail */ + i = audioio->samplerate / 50; + memset(sbuf, 0, sizeof(sbuf)); + while (i > 0) { + j = sizeof(sbuf)/sizeof(sbuf[0]); + if (j > i) + j = i; + iowrite(audioio, sbuf, j); + i -= j; + } +#endif + iotxend(audioio); + if (audioio->flags & CAP_HALFDUPLEX) { + pthread_mutex_lock(&audioio->iomutex); + audioio->flags &= ~FLG_HALFDUPLEXTX; + pthread_cond_broadcast(&audioio->iocond); + pthread_mutex_unlock(&audioio->iomutex); + } +} + +static void ioterminateread(struct audioio *aio) +{ + struct audioio_unix *audioio = (struct audioio_unix *)aio; + + pthread_mutex_lock(&audioio->iomutex); + audioio->flags |= FLG_TERMINATERX; + pthread_mutex_unlock(&audioio->iomutex); + pthread_cond_broadcast(&audioio->iocond); +} + +/* ---------------------------------------------------------------------- */ +#else + +struct audioio *ioopen_alsasoundcard(unsigned int *samplerate, unsigned int flags, const char *params[]) +{ + return NULL; +} + +#endif + +void ioinit_alsasoundcard(void) +{ +} + diff --git a/soundcard/audiofilein.c b/soundcard/audiofilein.c new file mode 100644 index 0000000..aab9bc6 --- /dev/null +++ b/soundcard/audiofilein.c @@ -0,0 +1,305 @@ +/*****************************************************************************/ + +/* + * audiofilein.c -- Audio input from file. + * + * Copyright (C) 2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please note that the GPL allows you to use the driver, NOT the radio. + * In order to use the radio, you need a license from the communications + * authority of your country. + * + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE +#define _REENTRANT + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +#include "soundio.h" +#include "audioio.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* ---------------------------------------------------------------------- */ + +#define AUDIOIBUFSIZE 4096 + +struct audioio_filein { + struct audioio audioio; + AFfilehandle file; + /* audio file info */ + unsigned int samplerate; + int samplefmt, samplewidth, byteorder; + unsigned int nrchan, framesz; + AFframecount nrframes, frameptr; + pthread_mutex_t iomutex; + pthread_cond_t iocond; + unsigned int flags; + unsigned int ptr; + u_int16_t ptime; + int16_t ibuf[AUDIOIBUFSIZE]; +}; + +struct modemparams ioparams_filein[] = { + { "file", "Input file", "Input File Name", "", MODEMPAR_STRING }, + { "repeat", "Repeat", "Loop input file forever", "0", MODEMPAR_CHECKBUTTON }, + { NULL, } +}; + +#define FLG_TERMINATERX 4 +#define FLG_REPEAT 8 + +/* ---------------------------------------------------------------------- */ + +static void iorelease(struct audioio *aio) +{ + struct audioio_filein *audioio = (struct audioio_filein *)aio; + + if (audioio->file) { + afCloseFile(audioio->file); + pthread_cond_destroy(&audioio->iocond); + pthread_mutex_destroy(&audioio->iomutex); + } + audioio->file = NULL; + audioio->flags = audioio->ptr = audioio->ptime = 0; + free(audioio); +} + +static void ioread(struct audioio *aio, int16_t *samples, unsigned int nr, u_int16_t tim) +{ + struct audioio_filein *audioio = (struct audioio_filein *)aio; + unsigned int p, nrsamp; + unsigned char *buf, *bp; + int i; + + buf = alloca(AUDIOIBUFSIZE/8 * audioio->framesz); + pthread_mutex_lock(&audioio->iomutex); + while (nr > 0) { + if (audioio->flags & FLG_TERMINATERX) { + pthread_mutex_unlock(&audioio->iomutex); + pthread_exit(NULL); + } + i = (signed)(int16_t)(audioio->ptime - tim); + if (i > AUDIOIBUFSIZE) { + pthread_mutex_unlock(&audioio->iomutex); + i -= AUDIOIBUFSIZE; + if (i > nr) + i = nr; + memset(samples, 0, i * sizeof(samples[0])); + logprintf(MLOG_ERROR, "ioread: request time %u out of time window [%u,%u)\n", tim, audioio->ptime-AUDIOIBUFSIZE, audioio->ptime); + samples += i; + nr -= i; + tim += i; + pthread_mutex_lock(&audioio->iomutex); + continue; + } + if (i > 0) { + p = (AUDIOIBUFSIZE + audioio->ptr - i) % AUDIOIBUFSIZE; + if (i > nr) + i = nr; + if (i > AUDIOIBUFSIZE-p) + i = AUDIOIBUFSIZE-p; + memcpy(samples, &audioio->ibuf[p], i * sizeof(samples[0])); + nr -= i; + samples += i; + tim += i; + continue; + } + pthread_mutex_unlock(&audioio->iomutex); + nrsamp = AUDIOIBUFSIZE/8; + if (audioio->flags & FLG_REPEAT && audioio->frameptr >= audioio->nrframes) { + audioio->frameptr = 0; + afSeekFrame(audioio->file, AF_DEFAULT_TRACK, 0); + } + if (audioio->frameptr >= audioio->nrframes) { + if (audioio->frameptr >= audioio->nrframes + 2 * AUDIOIBUFSIZE) + pthread_exit(NULL); + pthread_mutex_lock(&audioio->iomutex); + for (p = 0; p < nrsamp; p++) { + audioio->ibuf[audioio->ptr] = 0; + audioio->ptr = (audioio->ptr + 1) % AUDIOIBUFSIZE; + audioio->ptime += 1; + audioio->frameptr++; + } + } else { + if (audioio->frameptr + nrsamp > audioio->nrframes) + nrsamp = audioio->nrframes - audioio->frameptr; + afReadFrames(audioio->file, AF_DEFAULT_TRACK, buf, nrsamp); + audioio->frameptr += nrsamp; + pthread_mutex_lock(&audioio->iomutex); + for (bp = buf, p = 0; p < nrsamp; p++, bp += audioio->framesz) { + switch (audioio->samplefmt) { + case AF_SAMPFMT_TWOSCOMP: + case AF_SAMPFMT_UNSIGNED: + if (audioio->byteorder == AF_BYTEORDER_BIGENDIAN) { + switch (audioio->samplewidth) { + case 8: + i = ((signed char *)bp)[0] << 8; + break; + + case 16: + case 24: + case 32: + i = (((signed char *)bp)[0] << 8) | bp[1]; + break; + } + } else { + switch (audioio->samplewidth) { + case 8: + i = ((signed char *)bp)[0] << 8; + break; + + case 16: + i = (((signed char *)bp)[1] << 8) | bp[0]; + break; + + case 24: + i = (((signed char *)bp)[2] << 8) | bp[1]; + break; + case 32: + i = (((signed char *)bp)[3] << 8) | bp[2]; + break; + } + } + if (audioio->samplefmt == AF_SAMPFMT_UNSIGNED) + i ^= 0x8000; + break; + + default: + i = 0; + } + audioio->ibuf[audioio->ptr] = i; + audioio->ptr = (audioio->ptr + 1) % AUDIOIBUFSIZE; + audioio->ptime += 1; + } + } + pthread_cond_broadcast(&audioio->iocond); + } + pthread_mutex_unlock(&audioio->iomutex); +} + +static u_int16_t iocurtime(struct audioio *aio) +{ + struct audioio_filein *audioio = (struct audioio_filein *)aio; + u_int16_t res; + + pthread_mutex_lock(&audioio->iomutex); + res = audioio->ptime; + pthread_mutex_unlock(&audioio->iomutex); + return res; +} + +static void ioterminateread(struct audioio *aio) +{ + struct audioio_filein *audioio = (struct audioio_filein *)aio; + + pthread_mutex_lock(&audioio->iomutex); + audioio->flags |= FLG_TERMINATERX; + pthread_mutex_unlock(&audioio->iomutex); + pthread_cond_broadcast(&audioio->iocond); +} + +/* ---------------------------------------------------------------------- */ + +struct audioio *ioopen_filein(unsigned int *samplerate, unsigned int flags, const char *params[]) +{ + const char *audiopath = params[0]; + struct audioio_filein *audioio; + int version; + + if ((flags & IO_RDWR) != IO_RDONLY) { + logprintf(MLOG_ERROR, "audio: File input is unidirectional\n"); + return NULL; + } + audioio = calloc(1, sizeof(struct audioio_filein)); + if (!audioio) + return NULL; + audioio->audioio.release = iorelease; + audioio->audioio.terminateread = ioterminateread; + audioio->audioio.transmitstart = NULL; + audioio->audioio.transmitstop = NULL; + audioio->audioio.write = NULL; + audioio->audioio.read = ioread; + audioio->audioio.curtime = iocurtime; + pthread_cond_init(&audioio->iocond, NULL); + pthread_mutex_init(&audioio->iomutex, NULL); + audioio->flags = audioio->ptr = audioio->ptime = 0; + if (params[1] && params[1][0] != '0') + audioio->flags |= FLG_REPEAT; + if (!audiopath) { + logprintf(MLOG_ERROR, "audio: No file name specified\n"); + free(audioio); + return NULL; + } + if (!(audioio->file = afOpenFile(audiopath, "r", NULL))) { + logprintf(MLOG_ERROR, "audio: Cannot open file \"%s\"\n", audiopath); + free(audioio); + return NULL; + } + audioio->samplerate = afGetRate(audioio->file, AF_DEFAULT_TRACK); + afGetSampleFormat(audioio->file, AF_DEFAULT_TRACK, &audioio->samplefmt, &audioio->samplewidth); + audioio->byteorder = afGetByteOrder(audioio->file, AF_DEFAULT_TRACK); + audioio->nrchan = afGetChannels(audioio->file, AF_DEFAULT_TRACK); + audioio->framesz = afGetFrameSize(audioio->file, AF_DEFAULT_TRACK, 1); + audioio->nrframes = afGetFrameCount(audioio->file, AF_DEFAULT_TRACK); + audioio->frameptr = 0; + /* work around a libaudiofile WAVE bug */ + if (afGetFileFormat(audioio->file, &version) == AF_FILE_WAVE && audioio->samplewidth <= 8) + audioio->samplefmt = AF_SAMPFMT_UNSIGNED; + logprintf(MLOG_INFO, "audio: sample rate %u channels %u sfmt %d swidth %d byteorder %d framesize %u nrframes %d\n", + audioio->samplerate, audioio->nrchan, audioio->samplefmt, audioio->samplewidth, + audioio->byteorder, audioio->framesz, audioio->nrframes); + *samplerate = audioio->samplerate; + return &audioio->audioio; +} + +/* ---------------------------------------------------------------------- */ + +void ioinit_filein(void) +{ +} + +/* ---------------------------------------------------------------------- */ diff --git a/soundcard/audioio.c b/soundcard/audioio.c new file mode 100644 index 0000000..a553499 --- /dev/null +++ b/soundcard/audioio.c @@ -0,0 +1,702 @@ +/*****************************************************************************/ + +/* + * audioio.c -- Audio I/O. + * + * Copyright (C) 1999-2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please note that the GPL allows you to use the driver, NOT the radio. + * In order to use the radio, you need a license from the communications + * authority of your country. + * + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE +#define _REENTRANT + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "soundio.h" +#include "audioio.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_STROPTS_H +#include +#endif +#ifdef HAVE_SYS_AUDIOIO_H +#include +#endif +#ifdef HAVE_SYS_SOUNDCARD_H +#include +#endif + +/* ---------------------------------------------------------------------- */ + +#define AUDIOIBUFSIZE 4096 + +struct audioio_unix { + struct audioio audioio; + char audiopath[64]; + unsigned int samplerate; + int audiofd; + unsigned int fragsize; + pthread_mutex_t iomutex; + pthread_cond_t iocond; + unsigned int flags; + unsigned int ptr; + u_int16_t ptime; + int16_t ibuf[AUDIOIBUFSIZE]; +}; + +#if defined(HAVE_SYS_SOUNDCARD_H) +#define AUDIOPATH "/dev/dsp" +#else +#define AUDIOPATH "/dev/audio" +#endif + +struct modemparams ioparams_soundcard[] = { + { "device", "Audio Driver", "Path name of the audio (soundcard) driver", AUDIOPATH, MODEMPAR_COMBO, + { c: { { AUDIOPATH, AUDIOPATH "1", AUDIOPATH "2", AUDIOPATH "3" } } } }, + { "halfdup", "Half Duplex", "Force operating the Sound Driver in Half Duplex mode", "0", MODEMPAR_CHECKBUTTON }, + { NULL, } +}; + +#undef AUDIOPATH + +#define CAP_HALFDUPLEX 0x100 + +#define FLG_READING 0x1000 +#define FLG_HALFDUPLEXTX 0x2000 +#define FLG_TERMINATERX 0x4000 + +#ifndef INFTIM +#define INFTIM (-1) +#endif + +/* ---------------------------------------------------------------------- */ + +static void iorelease(struct audioio *aio); +static void iowrite(struct audioio *aio, const int16_t *samples, unsigned int nr); +static void ioread(struct audioio *aio, int16_t *samples, unsigned int nr, u_int16_t tim); +static u_int16_t iocurtime(struct audioio *aio); +static void iotransmitstart(struct audioio *aio); +static void iotransmitstop(struct audioio *aio); +static void ioterminateread(struct audioio *aio); + +/* ---------------------------------------------------------------------- */ + +static inline int iomodetofmode(unsigned int flags) +{ + switch (flags & IO_RDWR) { + default: + case IO_RDONLY: + return O_RDONLY; + + case IO_WRONLY: + return O_WRONLY; + + case IO_RDWR: + return O_RDWR; + } +} + +/* ---------------------------------------------------------------------- */ +/* + * Linux OSS audio + */ + +#if defined(HAVE_SYS_SOUNDCARD_H) + +struct audioio *ioopen_soundcard(unsigned int *samplerate, unsigned int flags, const char *params[]) +{ + int sndparam, i; + const char *audiopath = params[0]; + audio_buf_info abinfoi, abinfoo; + struct audioio_unix *audioio; + + audioio = calloc(1, sizeof(struct audioio_unix)); + if (!audioio) + return NULL; + audioio->audioio.release = iorelease; + if (flags & IO_RDONLY) { + audioio->audioio.terminateread = ioterminateread; + audioio->audioio.read = ioread; + audioio->audioio.curtime = iocurtime; + } + if (flags & IO_WRONLY) { + audioio->audioio.transmitstart = iotransmitstart; + audioio->audioio.transmitstop = iotransmitstop; + audioio->audioio.write = iowrite; + } + audioio->samplerate = *samplerate; + pthread_cond_init(&audioio->iocond, NULL); + pthread_mutex_init(&audioio->iomutex, NULL); + audioio->flags = flags & IO_RDWR; + audioio->ptr = audioio->ptime = 0; + if (!audiopath) + audiopath = "/dev/dsp"; + strncpy(audioio->audiopath, audiopath, sizeof(audioio->audiopath)); + logprintf(MLOG_DEBUG, "audio: starting \"%s\"\n", audioio->audiopath); + if ((audioio->audiofd = open(audioio->audiopath, iomodetofmode(audioio->flags))) < 0) { + logprintf(MLOG_ERROR, "audio: Error, cannot open \"%s\"\n", audioio->audiopath); + free(audioio); + return NULL; + } + if (ioctl(audioio->audiofd, SNDCTL_DSP_GETCAPS, &sndparam) == -1) { + logprintf(MLOG_ERROR, "audio: Error, cannot get capabilities\n"); + close(audioio->audiofd); + free(audioio); + return NULL; + } + if (!((~audioio->flags) & IO_RDWR)) { + if (params[1] && params[1][0] != '0') { + audioio->flags |= CAP_HALFDUPLEX; + logprintf(MLOG_INFO, "audio: forcing half duplex mode\n"); + } else if (!(sndparam & DSP_CAP_DUPLEX)) { + audioio->flags |= CAP_HALFDUPLEX; + logprintf(MLOG_INFO, "audio: Soundcard does not support full duplex, using half duplex mode\n"); + } else if (ioctl(audioio->audiofd, SNDCTL_DSP_SETDUPLEX, 0) == -1) { + logprintf(MLOG_ERROR, "audio: Error, cannot set duplex mode\n"); + close(audioio->audiofd); + free(audioio); + return NULL; + } + } + /* set fragment size so we have approx. 10-20ms wakeup latency */ + i = audioio->samplerate / 50; + sndparam = 0xffff0000; + while (i) { + sndparam++; + i >>= 1; + } + audioio->fragsize = sndparam; + if (ioctl(audioio->audiofd, SNDCTL_DSP_SETFRAGMENT, &sndparam) == -1) + logprintf(MLOG_ERROR, "audio: Error, cannot set fragment size\n"); + sndparam = AFMT_S16_LE; /* we want 16 bits/sample signed */ + /* little endian; works only on little endian systems! */ + if (ioctl(audioio->audiofd, SNDCTL_DSP_SETFMT, &sndparam) == -1) { + logprintf(MLOG_ERROR, "audio: Error, cannot set sample size\n"); + free(audioio); + return NULL; + } + if (sndparam != AFMT_S16_LE) { + logprintf(MLOG_ERROR, "audio: Error, cannot set sample size to 16 bits\n"); + free(audioio); + return NULL; + } + sndparam = 0; /* we want only 1 channel */ + if (ioctl(audioio->audiofd, SNDCTL_DSP_STEREO, &sndparam) == -1) { + logprintf(MLOG_ERROR, "audio: Error, cannot set the channel number\n"); + close(audioio->audiofd); + free(audioio); + return NULL; + } + if (sndparam != 0) { + logprintf(MLOG_ERROR, "audio: Error, cannot set the channel number to 1\n"); + close(audioio->audiofd); + free(audioio); + return NULL; + } + sndparam = audioio->samplerate; + if (ioctl(audioio->audiofd, SNDCTL_DSP_SPEED, &sndparam) == -1) { + logprintf(MLOG_ERROR, "audio: Error, cannot set the sample rate\n"); + close(audioio->audiofd); + free(audioio); + return NULL; + } + audioio->samplerate = sndparam; + if (ioctl(audioio->audiofd, SNDCTL_DSP_NONBLOCK, 0) == -1) { + logprintf(MLOG_ERROR, "audio: Error, cannot set nonblocking mode\n"); + close(audioio->audiofd); + free(audioio); + return NULL; + } + memset(&abinfoi, 0, sizeof(abinfoi)); + memset(&abinfoo, 0, sizeof(abinfoo)); + if ((flags & IO_RDONLY) && ioctl(audioio->audiofd, SNDCTL_DSP_GETISPACE, &abinfoi) == -1) + logprintf(MLOG_ERROR, "audio: Error, cannot get input buffer parameters\n"); + else if ((flags & IO_WRONLY) && ioctl(audioio->audiofd, SNDCTL_DSP_GETOSPACE, &abinfoo) == -1) + logprintf(MLOG_ERROR, "audio: Error, cannot get output buffer parameters\n"); + else { + logprintf(MLOG_INFO, "audio: sample rate %u input fragsz %u numfrags %u output fragsz %u numfrags %u\n", + audioio->samplerate, abinfoi.fragsize, abinfoi.fragstotal, abinfoo.fragsize, abinfoo.fragstotal); + } + *samplerate = audioio->samplerate; + return &audioio->audioio; +} + +static inline void iotxend(struct audioio_unix *audioio) +{ + int sndparam; + short s; + + fcntl(audioio->audiofd, F_SETFL, fcntl(audioio->audiofd, F_GETFL, 0) & ~O_NONBLOCK); + if (ioctl(audioio->audiofd, SNDCTL_DSP_SYNC, 0)) + logerr(MLOG_ERROR, "ioctl: SNDCTL_DSP_SYNC"); + fcntl(audioio->audiofd, F_SETFL, fcntl(audioio->audiofd, F_GETFL, 0) | O_NONBLOCK); + if (!(audioio->flags & CAP_HALFDUPLEX)) + return; + /* the only reliable method seems to be to reopen the audio device :( */ + close(audioio->audiofd); + if ((audioio->audiofd = open(audioio->audiopath, O_RDWR)) < 0) + logprintf(MLOG_FATAL, "audio: Error, cannot open \"%s\"\n", audioio->audiopath); + /* set fragment size so we have approx. 10-20ms wakeup latency */ + sndparam = audioio->fragsize; + if (ioctl(audioio->audiofd, SNDCTL_DSP_SETFRAGMENT, &sndparam) == -1) + logprintf(MLOG_ERROR, "audio: Error, cannot set fragment size\n"); + sndparam = AFMT_S16_LE; /* we want 16 bits/sample signed */ + /* little endian; works only on little endian systems! */ + if (ioctl(audioio->audiofd, SNDCTL_DSP_SETFMT, &sndparam) == -1) + logprintf(MLOG_FATAL, "audio: Error, cannot set sample size\n"); + if (sndparam != AFMT_S16_LE) + logprintf(MLOG_FATAL, "audio: Error, cannot set sample size to 16 bits\n"); + sndparam = 0; /* we want only 1 channel */ + if (ioctl(audioio->audiofd, SNDCTL_DSP_STEREO, &sndparam) == -1) + logprintf(MLOG_FATAL, "audio: Error, cannot set the channel number\n"); + if (sndparam != 0) + logprintf(MLOG_FATAL, "audio: Error, cannot set the channel number to 1\n"); + sndparam = audioio->samplerate; + if (ioctl(audioio->audiofd, SNDCTL_DSP_SPEED, &sndparam) == -1) + logprintf(MLOG_FATAL, "audio: Error, cannot set the sample rate\n"); + if (ioctl(audioio->audiofd, SNDCTL_DSP_NONBLOCK, 0) == -1) + logprintf(MLOG_FATAL, "audio: Error, cannot set nonblocking mode\n"); + read(audioio->audiofd, &s, sizeof(s)); +} + +static inline void iotxstart(struct audioio_unix *audioio) +{ + int sndparam; + short s = 0; + + if (!(audioio->flags & CAP_HALFDUPLEX)) { + write(audioio->audiofd, &s, sizeof(s)); + return; + } + /* the only reliable method seems to be to reopen the audio device :( */ + close(audioio->audiofd); + if ((audioio->audiofd = open(audioio->audiopath, O_RDWR)) < 0) + logprintf(MLOG_FATAL, "audio: Error, cannot open \"%s\"\n", audioio->audiopath); + /* set fragment size so we have approx. 10-20ms wakeup latency */ + sndparam = audioio->fragsize; + if (ioctl(audioio->audiofd, SNDCTL_DSP_SETFRAGMENT, &sndparam) == -1) + logprintf(MLOG_ERROR, "audio: Error, cannot set fragment size\n"); + sndparam = AFMT_S16_LE; /* we want 16 bits/sample signed */ + /* little endian; works only on little endian systems! */ + if (ioctl(audioio->audiofd, SNDCTL_DSP_SETFMT, &sndparam) == -1) + logprintf(MLOG_FATAL, "audio: Error, cannot set sample size\n"); + if (sndparam != AFMT_S16_LE) + logprintf(MLOG_FATAL, "audio: Error, cannot set sample size to 16 bits\n"); + sndparam = 0; /* we want only 1 channel */ + if (ioctl(audioio->audiofd, SNDCTL_DSP_STEREO, &sndparam) == -1) + logprintf(MLOG_FATAL, "audio: Error, cannot set the channel number\n"); + if (sndparam != 0) + logprintf(MLOG_FATAL, "audio: Error, cannot set the channel number to 1\n"); + sndparam = audioio->samplerate; + if (ioctl(audioio->audiofd, SNDCTL_DSP_SPEED, &sndparam) == -1) + logprintf(MLOG_FATAL, "audio: Error, cannot set the sample rate\n"); + if (ioctl(audioio->audiofd, SNDCTL_DSP_NONBLOCK, 0) == -1) + logprintf(MLOG_FATAL, "audio: Error, cannot set nonblocking mode\n"); + sndparam = write(audioio->audiofd, &s, sizeof(s)); +} + +/* ---------------------------------------------------------------------- */ +/* + * Sun audio + */ + +#elif defined(HAVE_SYS_AUDIOIO_H) + +static inline int iomodetoflush(unsigned int flags) +{ + switch (flags & IO_RDWR) { + default: + case IO_RDONLY: + return FLUSHR; + + case IO_WRONLY: + return FLUSHW; + + case IO_RDWR: + return FLUSHRW; + } +} + +struct audioio *ioopen_soundcard(unsigned int *samplerate, unsigned int flags, const char *params[]) +{ + static int srtable[] = { + 8000, 9600, 11025, 16000, 18900, 22050, 32000, 37800, 44100, 48000, -1 + }; + int *srptr = srtable; + const char *audiopath = params[0]; + audio_info_t audioinfo; + audio_info_t audioinfo2; + audio_device_t audiodev; + struct audioio_unix *audioio; + + audioio = calloc(1, sizeof(struct audioio_unix)); + if (!audioio) + return NULL; + audioio->audioio.release = iorelease; + if (flags & IO_RDONLY) { + audioio->audioio.terminateread = ioterminateread; + audioio->audioio.read = ioread; + audioio->audioio.curtime = iocurtime; + } + if (flags & IO_WRONLY) { + audioio->audioio.transmitstart = iotransmitstart; + audioio->audioio.transmitstop = iotransmitstop; + audioio->audioio.write = iowrite; + } + audioio->samplerate = *samplerate; + pthread_cond_init(&audioio->iocond, NULL); + pthread_mutex_init(&audioio->iomutex, NULL); + audioio->flags = flags & IO_RDWR; + audioio->ptr = audioio->ptime = 0; + if (!audiopath) + audiopath = "/dev/audio"; + logprintf(MLOG_DEBUG, "audio: starting \"%s\"\n", audiopath); + if ((audioio->audiofd = open(audiopath, iomodetofmode(audioio->flags))) < 0) { + logprintf(MLOG_ERROR, "audio: Error, cannot open \"%s\"\n", audiopath); + free(audioio); + return NULL; + } + if (ioctl(audioio->audiofd, AUDIO_GETDEV, &audiodev) == -1) { + logprintf(MLOG_ERROR, "audio: Error, cannot get audio dev\n"); + close(audioio->audiofd); + free(audioio); + return NULL; + } + logprintf(MLOG_DEBUG, "audio: Audio device: name %s, ver %s, config %s\n", + audiodev.name, audiodev.version, audiodev.config); + AUDIO_INITINFO(&audioinfo); + while (srptr[0] < audioio->samplerate && srptr[1] != -1) + srptr++; + if (audioio->flags & IO_WRONLY) { + audioinfo.play.sample_rate = srptr[0]; + audioinfo.play.channels = 1; + audioinfo.play.precision = 16; + audioinfo.play.encoding = AUDIO_ENCODING_LINEAR; + } + if (audioio->flags & IO_RDONLY) { + audioinfo.record.sample_rate = srptr[0]; + audioinfo.record.channels = 1; + audioinfo.record.precision = 16; + audioinfo.record.encoding = AUDIO_ENCODING_LINEAR; + //audioinfo.record.gain = 0x20; + audioinfo.record.port = AUDIO_LINE_IN; + //audioinfo.monitor_gain = 0; + } + if (ioctl(audioio->audiofd, AUDIO_SETINFO, &audioinfo) == -1) { + logprintf(MLOG_ERROR, "audio: Error, cannot set audio params\n"); + close(audioio->audiofd); + free(audioio); + return NULL; + } + if (ioctl(audioio->audiofd, I_FLUSH, iomodetoflush(audioio->flags)) == -1) { + logprintf(MLOG_ERROR, "audio: Error, cannot flush\n"); + close(audioio->audiofd); + free(audioio); + return NULL; + } + if (ioctl(audioio->audiofd, AUDIO_GETINFO, &audioinfo2) == -1) { + logprintf(MLOG_ERROR, "audio: Error, cannot get audio params\n"); + close(audioio->audiofd); + free(audioio); + return NULL; + } + audioio->samplerate = audioinfo2.record.sample_rate; + if (params[1] && params[1][0] != '0') { + audioio->flags |= CAP_HALFDUPLEX; + logprintf(MLOG_INFO, "audio: forcing half duplex mode\n"); + } + fcntl(audioio->audiofd, F_SETFL, fcntl(audioio->audiofd, F_GETFL, 0) | O_NONBLOCK); + logprintf(MLOG_INFO, "audio: sample rate %u input buffer %u output buffer %u\n", + audioio->samplerate, audioinfo2.record.buffer_size, audioinfo2.play.buffer_size); + *samplerate = audioio->samplerate; + return &audioio->audioio; +} + +static inline void iotxend(struct audioio_unix *audioio) +{ + if (ioctl(audioio->audiofd, AUDIO_DRAIN, 0)) + logerr(MLOG_ERROR, "ioctl: AUDIO_DRAIN"); +} + +static inline void iotxstart(struct audioio_unix *audioio) +{ + short s = 0; + + write(audioio->audiofd, &s, sizeof(s)); +} + +#endif + +/* ---------------------------------------------------------------------- */ + +void ioinit_soundcard(void) +{ +} + +static void iorelease(struct audioio *aio) +{ + struct audioio_unix *audioio = (struct audioio_unix *)aio; + + if (audioio->audiofd != -1) { + close(audioio->audiofd); + pthread_cond_destroy(&audioio->iocond); + pthread_mutex_destroy(&audioio->iomutex); + } + audioio->audiofd = -1; + audioio->flags = audioio->ptr = audioio->ptime = 0; + free(audioio); +} + +static void iowrite(struct audioio *aio, const int16_t *samples, unsigned int nr) +{ + struct audioio_unix *audioio = (struct audioio_unix *)aio; + unsigned char *p = (unsigned char *)samples; + unsigned int sz = nr * sizeof(samples[0]); + struct pollfd pfd; + int i; + + pfd.fd = audioio->audiofd; + pfd.events = POLLOUT; + while (sz > 0) { + poll(&pfd, 1, 1000); + i = write(audioio->audiofd, p, sz); + +#if 0 + logprintf(10, "audio: write: sz %u ret %d\n", sz, i); +#endif +#if 0 + { + audio_buf_info abinfo; + count_info cinfo; + if (ioctl(audioio->audiofd, SNDCTL_DSP_GETOSPACE, &abinfo)) + logerr(MLOG_FATAL, "audio: SNDCTL_DSP_GETOSPACE"); + if (ioctl(audioio->audiofd, SNDCTL_DSP_GETOPTR, &cinfo)) + logerr(MLOG_FATAL, "audio: SNDCTL_DSP_GETOSPACE"); + logprintf(10, "audio: driver: hwptr %u count %u bufsz %u\n", cinfo.ptr, abinfo.bytes, abinfo.fragsize * abinfo.fragstotal); + } +#endif + + if (i == -1) { + if (errno == EINTR || errno == EAGAIN) + continue; + logerr(MLOG_FATAL, "audio: write"); + } + p += i; + sz -= i; + } +} + +static void ioread(struct audioio *aio, int16_t *samples, unsigned int nr, u_int16_t tim) +{ + struct audioio_unix *audioio = (struct audioio_unix *)aio; + struct pollfd pfd; + int16_t ibuf[AUDIOIBUFSIZE/8]; + int16_t *ip; + unsigned int p; + int i; + + pthread_mutex_lock(&audioio->iomutex); + while (nr > 0) { + if (audioio->flags & FLG_TERMINATERX) { + pthread_mutex_unlock(&audioio->iomutex); + pthread_exit(NULL); + } + i = (signed)(int16_t)(audioio->ptime - tim); + if (i > AUDIOIBUFSIZE) { + pthread_mutex_unlock(&audioio->iomutex); + i -= AUDIOIBUFSIZE; + if (i > nr) + i = nr; + memset(samples, 0, i * sizeof(samples[0])); + logprintf(MLOG_ERROR, "ioread: request time %u out of time window [%u,%u)\n", tim, audioio->ptime-AUDIOIBUFSIZE, audioio->ptime); + samples += i; + nr -= i; + tim += i; + pthread_mutex_lock(&audioio->iomutex); + continue; + } + if (i > 0) { + p = (AUDIOIBUFSIZE + audioio->ptr - i) % AUDIOIBUFSIZE; + if (i > nr) + i = nr; + if (i > AUDIOIBUFSIZE-p) + i = AUDIOIBUFSIZE-p; + memcpy(samples, &audioio->ibuf[p], i * sizeof(samples[0])); + nr -= i; + samples += i; + tim += i; + continue; + } + if (audioio->flags & (FLG_READING|FLG_HALFDUPLEXTX)) { + pthread_cond_wait(&audioio->iocond, &audioio->iomutex); + continue; + } + audioio->flags |= FLG_READING; + pthread_mutex_unlock(&audioio->iomutex); + pfd.fd = audioio->audiofd; + pfd.events = POLLIN; + poll(&pfd, 1, 50); + i = read(audioio->audiofd, ibuf, sizeof(ibuf)); + if (i == -1) { + if (errno == EINTR || errno == EAGAIN) { + pthread_mutex_lock(&audioio->iomutex); + audioio->flags &= ~FLG_READING; + pthread_cond_broadcast(&audioio->iocond); + continue; + } + logerr(MLOG_FATAL, "audio: read"); + } + p = i / 2; + pthread_mutex_lock(&audioio->iomutex); + audioio->flags &= ~FLG_READING; + for (ip = ibuf; p > 0; ) { + i = p; + if (i > AUDIOIBUFSIZE-audioio->ptr) + i = AUDIOIBUFSIZE-audioio->ptr; + memcpy(&audioio->ibuf[audioio->ptr], ip, i * sizeof(audioio->ibuf[0])); + audioio->ptr = (audioio->ptr + i) % AUDIOIBUFSIZE; + audioio->ptime += i; + ip += i; + p -= i; + } + pthread_cond_broadcast(&audioio->iocond); + } + pthread_mutex_unlock(&audioio->iomutex); +} + +static u_int16_t iocurtime(struct audioio *aio) +{ + struct audioio_unix *audioio = (struct audioio_unix *)aio; + u_int16_t res; + int16_t ibuf[AUDIOIBUFSIZE/8]; + int16_t *ip; + unsigned int p; + int i; + + pthread_mutex_lock(&audioio->iomutex); + for (;;) { + if (audioio->flags & (FLG_READING|FLG_HALFDUPLEXTX)) + break; + audioio->flags |= FLG_READING; + pthread_mutex_unlock(&audioio->iomutex); + i = read(audioio->audiofd, ibuf, sizeof(ibuf)); + if (i == 0 || (i == -1 && errno == EAGAIN)) { + pthread_mutex_lock(&audioio->iomutex); + audioio->flags &= ~FLG_READING; + pthread_cond_broadcast(&audioio->iocond); + break; + } + if (i == -1) { + if (errno == EINTR || errno == EAGAIN) { + pthread_mutex_lock(&audioio->iomutex); + audioio->flags &= ~FLG_READING; + pthread_cond_broadcast(&audioio->iocond); + continue; + } + logerr(MLOG_FATAL, "audio: read"); + } + p = i / 2; + pthread_mutex_lock(&audioio->iomutex); + audioio->flags &= ~FLG_READING; + for (ip = ibuf; p > 0; ) { + i = p; + if (i > AUDIOIBUFSIZE-audioio->ptr) + i = AUDIOIBUFSIZE-audioio->ptr; + memcpy(&audioio->ibuf[audioio->ptr], ip, i * sizeof(audioio->ibuf[0])); + audioio->ptr = (audioio->ptr + i) % AUDIOIBUFSIZE; + audioio->ptime += i; + ip += i; + p -= i; + } + pthread_cond_broadcast(&audioio->iocond); + } + res = audioio->ptime; + pthread_mutex_unlock(&audioio->iomutex); + return res; +} + +static void iotransmitstart(struct audioio *aio) +{ + struct audioio_unix *audioio = (struct audioio_unix *)aio; + if (audioio->flags & CAP_HALFDUPLEX) { + pthread_mutex_lock(&audioio->iomutex); + audioio->flags |= FLG_HALFDUPLEXTX; + while (audioio->flags & FLG_READING) + pthread_cond_wait(&audioio->iocond, &audioio->iomutex); + pthread_mutex_unlock(&audioio->iomutex); + } + iotxstart(audioio); +} + +static void iotransmitstop(struct audioio *aio) +{ + struct audioio_unix *audioio = (struct audioio_unix *)aio; + short sbuf[256]; + unsigned int i, j; + +#if 0 + /* add 20ms tail */ + i = audioio->samplerate / 50; + memset(sbuf, 0, sizeof(sbuf)); + while (i > 0) { + j = sizeof(sbuf)/sizeof(sbuf[0]); + if (j > i) + j = i; + iowrite(audioio, sbuf, j); + i -= j; + } +#endif + iotxend(audioio); + if (audioio->flags & CAP_HALFDUPLEX) { + pthread_mutex_lock(&audioio->iomutex); + audioio->flags &= ~FLG_HALFDUPLEXTX; + pthread_cond_broadcast(&audioio->iocond); + pthread_mutex_unlock(&audioio->iomutex); + } +} + +static void ioterminateread(struct audioio *aio) +{ + struct audioio_unix *audioio = (struct audioio_unix *)aio; + + pthread_mutex_lock(&audioio->iomutex); + audioio->flags |= FLG_TERMINATERX; + pthread_mutex_unlock(&audioio->iomutex); + pthread_cond_broadcast(&audioio->iocond); +} + +/* ---------------------------------------------------------------------- */ diff --git a/soundcard/audioio.h b/soundcard/audioio.h new file mode 100644 index 0000000..93decd2 --- /dev/null +++ b/soundcard/audioio.h @@ -0,0 +1,71 @@ +/*****************************************************************************/ + +/* + * audioio.h -- Internal audioio data structures. + * + * Copyright (C) 2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +/*****************************************************************************/ + +#ifndef _AUDIOIO_H +#define _AUDIOIO_H + +/* ---------------------------------------------------------------------- */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "modem.h" + +/* ---------------------------------------------------------------------- */ + +struct audioio { + void (*release)(struct audioio *audioio); + void (*terminateread)(struct audioio *audioio); + void (*transmitstart)(struct audioio *audioio); + void (*transmitstop)(struct audioio *audioio); + void (*write)(struct audioio *audioio, const int16_t *samples, unsigned int nr); + void (*read)(struct audioio *audioio, int16_t *samples, unsigned int nr, u_int16_t tim); + u_int16_t (*curtime)(struct audioio *audioio); +}; + +/* "private" audio IO functions */ +extern struct modemparams ioparams_soundcard[]; +extern struct modemparams ioparams_alsasoundcard[]; +extern struct modemparams ioparams_filein[]; +extern struct modemparams ioparams_sim[]; + +extern void ioinit_soundcard(void); +extern void ioinit_alsasoundcard(void); +extern void ioinit_filein(void); +extern void ioinit_sim(void); + +#define IO_RDONLY 1 +#define IO_WRONLY 2 +#define IO_RDWR (IO_RDONLY|IO_WRONLY) + +extern struct audioio *ioopen_soundcard(unsigned int *samplerate, unsigned int flags, const char *params[]); +extern struct audioio *ioopen_alsasoundcard(unsigned int *samplerate, unsigned int flags, const char *params[]); +extern struct audioio *ioopen_filein(unsigned int *samplerate, unsigned int flags, const char *params[]); +extern struct audioio *ioopen_sim(unsigned int *samplerate, unsigned int flags, const char *params[]); + +/* ---------------------------------------------------------------------- */ +#endif /* _AUDIOIO_H */ diff --git a/soundcard/chansim.c b/soundcard/chansim.c new file mode 100644 index 0000000..9f861b9 --- /dev/null +++ b/soundcard/chansim.c @@ -0,0 +1,358 @@ +/*****************************************************************************/ + +/* + * chansim.c -- Modem simulation environment. + * + * Copyright (C) 1999-2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE +#define _REENTRANT + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "soundio.h" +#include "mat.h" + +#include +#include +#include +#include +#include +#include + +/* ---------------------------------------------------------------------- */ + + +#define CHANLEN 64 +#define IBUFSIZE 1024 + +#undef PRINTCHIN +#undef PRINTCHOUT + +struct audioio_sim { + struct audioio audioio; + unsigned int samplerate; + pthread_mutex_t iomutex; + pthread_cond_t iocondrd; + pthread_cond_t iocondwr; + unsigned int ptr; + unsigned int ptime; + int16_t ibuf[IBUFSIZE]; + int16_t iostate[CHANLEN]; + float chan[CHANLEN]; + unsigned int chanlen; + float snrmul; + float snrstate; + unsigned int snrmode; + unsigned int termread; +}; + +/* ---------------------------------------------------------------------- */ + +static inline double sinc(double x) +{ + double arg = x * M_PI; + + if (fabs(arg) < 1e-10) + return 1; + return sin(arg) / arg; +} + +static void resamplechannel(struct audioio_sim *audioio, unsigned int chsr, unsigned int chanlen, const float *ch) +{ + double tmul, tmulch, s, en; + unsigned int i, j; + + audioio->chanlen = CHANLEN; + tmul = 1.0 / audioio->samplerate; + tmulch = 1.0 / chsr; + en = 0; + for (i = 0; i < CHANLEN; i++) { + s = 0; + for (j = 0; j < chanlen; j++) + s += ch[j] * sinc((j-0.5*(chanlen-1)) * tmulch - (i-0.5*(CHANLEN-1)) * tmul); + audioio->chan[i] = s; + en += s * s; + } + s = 0.5 / sqrt(en); + for (i = 0; i < CHANLEN; i++) + audioio->chan[i] *= s; +} + +/* ---------------------------------------------------------------------- */ + +static inline int16_t calcchan(struct audioio_sim *audioio, int16_t *ptr) +{ + const float *c = audioio->chan; + float sum, noise, ntemp; + unsigned int i; + + sum = 0; + for (i = 0; i < audioio->chanlen; i++, c++, ptr++) + sum += (*ptr) * (*c); + switch (audioio->snrmode) { + default: + case 0: + noise = audioio->snrstate = randn(); + break; + + case 1: + ntemp = audioio->snrstate; + audioio->snrstate = randn(); + noise = ntemp - audioio->snrstate; + break; + } + sum += audioio->snrmul * noise; + if (sum > 32767) + sum = 32767; + if (sum < -32767) + sum = -32767; + return sum; +} + +#define WRITECHUNK ((IBUFSIZE)/8) + +static void iowrite(struct audioio *aio, const int16_t *samples, unsigned int nr) +{ + struct audioio_sim *audioio = (struct audioio_sim *)aio; + int16_t filt[CHANLEN+WRITECHUNK]; + unsigned int i, k; + + pthread_mutex_lock(&audioio->iomutex); + pthread_cond_broadcast(&audioio->iocondrd); + while (nr > 0) { + pthread_cond_wait(&audioio->iocondwr, &audioio->iomutex); + k = nr; + if (k > WRITECHUNK) + k = WRITECHUNK; + memcpy(filt, audioio->iostate, CHANLEN * sizeof(filt[0])); + memcpy(filt+CHANLEN, samples, k * sizeof(filt[0])); +#ifdef PRINTCHIN + for (i = 0; i < k; i++) + fprintf(stdout, "\t%6d\n", samples[i]); +#endif + samples += k; + nr -= k; + for (i = 0; i < k; i++) + audioio->ibuf[(audioio->ptr+i) % IBUFSIZE] = calcchan(audioio, filt + i); +#ifdef PRINTCHOUT + for (i = 0; i < k; i++) + fprintf(stdout, "\t%6d\n", audioio->ibuf[(audioio->ptr+i) % IBUFSIZE]); +#endif + memcpy(audioio->iostate, filt+k, CHANLEN * sizeof(filt[0])); + audioio->ptr = (audioio->ptr + k) % IBUFSIZE; + audioio->ptime += k; + pthread_cond_broadcast(&audioio->iocondrd); + } + pthread_mutex_unlock(&audioio->iomutex); +} + +static void ioread(struct audioio *aio, int16_t *samples, unsigned int nr, u_int16_t tim) +{ + struct audioio_sim *audioio = (struct audioio_sim *)aio; + unsigned int p; + int i; + + pthread_mutex_lock(&audioio->iomutex); + while (nr > 0) { + if (audioio->termread) { + pthread_mutex_lock(&audioio->iomutex); + pthread_exit(NULL); + } + i = (signed)(int16_t)(audioio->ptime - tim); + if (i > IBUFSIZE) { + pthread_mutex_unlock(&audioio->iomutex); + i -= IBUFSIZE; + if (i > nr) + i = nr; + memset(samples, 0, i * sizeof(samples[0])); + logprintf(1, "ioread: request time %u out of time window [%u,%u)\n", tim, audioio->ptime-IBUFSIZE, audioio->ptime); + samples += i; + nr -= i; + tim += i; + pthread_mutex_lock(&audioio->iomutex); + continue; + } + if (i > 0) { + p = (IBUFSIZE + audioio->ptr - i) % IBUFSIZE; + if (i > nr) + i = nr; + if (i > IBUFSIZE-p) + i = IBUFSIZE-p; + memcpy(samples, &audioio->ibuf[p], i * sizeof(samples[0])); + nr -= i; + samples += i; + tim += i; + continue; + } + pthread_cond_broadcast(&audioio->iocondwr); + pthread_cond_wait(&audioio->iocondrd, &audioio->iomutex); + } + pthread_mutex_unlock(&audioio->iomutex); +} + +static void ioterminateread(struct audioio *aio) +{ + struct audioio_sim *audioio = (struct audioio_sim *)aio; + + pthread_mutex_lock(&audioio->iomutex); + audioio->termread = 1; + pthread_mutex_unlock(&audioio->iomutex); + pthread_cond_broadcast(&audioio->iocondwr); +} + +static u_int16_t iocurtime(struct audioio *aio) +{ + struct audioio_sim *audioio = (struct audioio_sim *)aio; + u_int16_t res; + + pthread_mutex_lock(&audioio->iomutex); + res = audioio->ptime; + pthread_mutex_unlock(&audioio->iomutex); + return res; +} + +struct modemparams ioparams_sim[] = { + { "simchan", "Channel Type", "Channel Type", "0 - Ideal channel", MODEMPAR_COMBO, + { c: { { "0 - Ideal channel", "1 - Measured channel (@11025SPS)", "2 - Measured channel (@11025SPS)" } } } }, + { "snr", "Noise Attenuation", "Noise Attenuation (dB)", "10", MODEMPAR_NUMERIC, { n: { 0, 100, 10, 25 } } }, + { "snrmode", "Noise Mode", "Noise Mode (Spectrum)", "0 - White Gaussian", MODEMPAR_COMBO, + { c: { { "0 - White Gaussian", "1 - f^2 (Limiter Discriminator)" } } } }, + { "srate", "Sampling Rate", "Minimum Sampling Rate", "0", MODEMPAR_NUMERIC, { n: { 0, 100000, 1000, 10000 } } }, + { NULL } +}; + +void iosetsnr(struct audioio *aio, float snr) +{ + struct audioio_sim *audioio = (struct audioio_sim *)aio; + + if (snr < 0) + snr = 0; + if (snr > 100) + snr = 100; + audioio->snrmul = 16384 * pow(10, (-1.0 / 20.0) * snr); + if (audioio->snrmode == 1) + audioio->snrmul *= 0.5; + logprintf(MLOG_INFO, "Simulation SNR: %gdB\n", snr); +} + +static void iorelease(struct audioio *aio) +{ + struct audioio_unix *audioio = (struct audioio_unix *)aio; + + free(audioio); +} + +void ioinit_sim(void) +{ +} + +struct audioio *ioopen_sim(unsigned int *samplerate, unsigned int flags, const char *params[]) +{ + /* channel as measured with a Standard C558 and a C701 */ + /* sampling rate 11025 */ + static const float handychan11025[] = { + -5.21044, -7.23703, 1.00762, 8.56528, -2.49151, -13.1699, -12.1505, -7.80964, + -14.1223, -19.8385, -29.2846, -34.0455, -26.3771, -18.1503, -15.5361, -17.8743, + -14.4932, 9.90765, 50.8552, 90.8269, 106.196, 75.4171, 22.7599, 1.21803, + 41.8775, 113.88, 111.28, -62.4549, -350.544, -546.694, -399.364, 173.873, + 744.975, 514.874, -207.604, -281.118, -47.7039, -6.85458, 10.1011, 13.7335, + 18.0518, 11.7933, 2.29862, 1.39829, -9.07216, -15.4798, -19.0625, -14.4499, + 0.751019, 4.3827, 0.442683, -1.23818, 1.40913, -0.139367, -2.46858, 1.62925, + 11.0248, 17.7949, 11.8747, 0.987705, -4.77601, 1.56657, -0.792208, -11.835 + }; + static const float handychan19200[] = { + -17.1193, -15.5983, -16.0753, -17.7106, -18.1360, -13.4423, -1.1915, 18.4095, + 42.3428, 67.1847, 89.2158, 104.2136, 105.2639, 90.1995, 62.3140, 31.1091, + 7.5503, 0.9127, 16.0135, 50.0826, 93.5381, 126.0888, 122.0893, 61.0704, + -59.4699, -221.2141, -388.5450, -514.7896, -549.2966, -447.8420, -193.3155, 179.3403, + 561.0798, 776.4116, 673.6545, 283.7702, -141.5685, -338.7276, -274.3893, -120.9636, + -29.2744, -8.5477, -3.1922, 8.2671, 14.7713, 13.7291, 15.5945, 18.9467, + 15.2890, 6.4977, 2.3843, 2.2843, 0.8552, -5.2078, -10.9362, -14.6211, + -16.5479, -18.8587, -18.9143, -13.2442, -3.9637, 2.9833, 4.7124, 3.0376 + }; + static const char *ctfstr[] = { "Ideal channel", "Measured channel (@11025SPS)", "Measured channel (@11025SPS)" }; + static const char *snrmodestr[] = { "White Gaussian", "f^2 (Limiter Discriminator)" }; + float snr = 100; + unsigned int sr, ctf = 0, snrmode = 0; + struct audioio_sim *audioio; + + if ((~flags) & IO_RDWR) + return NULL; + audioio = calloc(1, sizeof(struct audioio_sim)); + if (!audioio) + return NULL; + audioio->audioio.release = iorelease; + audioio->audioio.terminateread = ioterminateread; + audioio->audioio.transmitstart = NULL; + audioio->audioio.transmitstop = NULL; + audioio->audioio.write = iowrite; + audioio->audioio.read = ioread; + audioio->audioio.curtime = iocurtime; + audioio->samplerate = *samplerate; + pthread_cond_init(&audioio->iocondrd, NULL); + pthread_cond_init(&audioio->iocondwr, NULL); + pthread_mutex_init(&audioio->iomutex, NULL); + if (params[0]) { + ctf = strtoul(params[0], NULL, 0); + if (ctf > 2) + ctf = 2; + } + if (params[1]) + snr = strtod(params[1], NULL); + if (params[2]) { + snrmode = strtoul(params[2], NULL, 0); + if (snrmode > 1) + snrmode = 1; + } + if (params[3]) { + sr = strtoul(params[3], NULL, 0); + if (sr > 100000) + sr = 100000; + if (sr > audioio->samplerate) + audioio->samplerate = sr; + } + switch(ctf) { + default: + case 0: + audioio->chan[0] = 0.5; + audioio->chanlen = 1; + break; + + case 1: + resamplechannel(audioio, 11025, sizeof(handychan11025)/sizeof(handychan11025[0]), handychan11025); + break; + + case 2: + resamplechannel(audioio, 19200, sizeof(handychan19200)/sizeof(handychan19200[0]), handychan19200); + break; + } + audioio->snrmode = snrmode; + audioio->snrstate = 0; + audioio->termread = 0; + iosetsnr(&audioio->audioio, snr); + logprintf(MLOG_INFO, "Simulation Noise: %s, Channel: %s, srate: %u\n", snrmodestr[snrmode], ctfstr[ctf], audioio->samplerate); + *samplerate = audioio->samplerate; + return &audioio->audioio; +} diff --git a/soundcard/kisspkt.c b/soundcard/kisspkt.c new file mode 100644 index 0000000..5ef7f6d --- /dev/null +++ b/soundcard/kisspkt.c @@ -0,0 +1,955 @@ +/*****************************************************************************/ + +/* + * kisspkt.c -- (M)KISS & HDLC packet IO. + * + * Copyright (C) 1999-2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please note that the GPL allows you to use the driver, NOT the radio. + * In order to use the radio, you need a license from the communications + * authority of your country. + * + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE +#define _REENTRANT + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +#include "soundio.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* glibc2.0 does not have sockaddr_ax25, ifr.ifr_newname and SIOCSIFNAME */ +#ifdef HAVE_LINUX_IF_H +#include +#endif +#ifdef HAVE_LINUX_AX25_H +#include +#endif +#ifdef HAVE_LINUX_SOCKIOS_H +#include +#endif + +#ifdef HAVE_MKISS +#include +#endif + +#ifdef HAVE_NET_IF_ARP_H +#include +#endif + +#ifdef HAVE_PTY_H +#include +#else +extern int openpty(int *amaster, int *aslave, char *name, struct termios *termp, struct winsize *winp); +#endif + +/* ---------------------------------------------------------------------- */ + +#define KISS_FEND ((unsigned char)0300) +#define KISS_FESC ((unsigned char)0333) +#define KISS_TFEND ((unsigned char)0334) +#define KISS_TFESC ((unsigned char)0335) + +#define KISS_CMD_DATA 0 +#define KISS_CMD_TXDELAY 1 +#define KISS_CMD_PPERSIST 2 +#define KISS_CMD_SLOTTIME 3 +#define KISS_CMD_TXTAIL 4 +#define KISS_CMD_FULLDUP 5 +#define KISS_CMD_HARDWARE 6 +#define KISS_CMD_FECLEVEL 8 +#define KISS_CMD_RETURN 255 + +/* ---------------------------------------------------------------------- */ +/* + * the CRC routines are stolen from WAMPES + * by Dieter Deyke + */ + +const u_int16_t crc_ccitt_table[0x100] = { + 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, + 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, + 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, + 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, + 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, + 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, + 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, + 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, + 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, + 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, + 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, + 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, + 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, + 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, + 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, + 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, + 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, + 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, + 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, + 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, + 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, + 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, + 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, + 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, + 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, + 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, + 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, + 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, + 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, + 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, + 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, + 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78 +}; + +/* ---------------------------------------------------------------------- */ + +static inline u_int16_t calc_crc_ccitt(const u_int8_t *buffer, int len) +{ + u_int16_t crc = 0xffff; + + for (;len>0;len--) + crc = (crc >> 8) ^ crc_ccitt_table[(crc ^ *buffer++) & 0xff]; + crc ^= 0xffff; + return crc; +} + +static inline void append_crc_ccitt(u_int8_t *buffer, int len) +{ + u_int16_t crc = calc_crc_ccitt(buffer, len); + buffer[len] = crc; + buffer[len+1] = crc >> 8; +} + +static inline int check_crc_ccitt(const u_int8_t *buffer, int len) +{ + u_int16_t crc = calc_crc_ccitt(buffer, len); + return (crc & 0xffff) == 0x0f47; +} + +/* ---------------------------------------------------------------------- */ + +/* + * high performance HDLC encoder + * yes, it's ugly, but generates pretty good code + */ + +#define ENCODEITERA(j) \ +do { \ + if (!(notbitstream & (0x1f0 << j))) \ + goto stuff##j; \ + encodeend##j:; \ +} while (0) + +#define ENCODEITERB(j) \ +do { \ + stuff##j: \ + bitstream &= ~(0x100 << j); \ + bitbuf = (bitbuf & (((2 << j) << numbit) - 1)) | \ + ((bitbuf & ~(((2 << j) << numbit) - 1)) << 1); \ + numbit++; \ + notbitstream = ~bitstream; \ + goto encodeend##j; \ +} while (0) + +static void hdlc_encode(struct modemchannel *chan, unsigned char *pkt, unsigned int len) +{ + unsigned bitstream, notbitstream, bitbuf, numbit; + unsigned wr = chan->pkt.htx.wr; + + chan->pkt.stat.pkt_out++; + append_crc_ccitt(pkt, len); + len += 2; + bitstream = 0; + bitbuf = 0x7e; + numbit = 8; /* opening flag */ + while (numbit >= 8) { + chan->pkt.htx.buf[wr] = bitbuf; + wr = (wr + 1) % TXBUFFER_SIZE; + if (wr == chan->pkt.htx.rd) + *(int *)0 = 0; /* must not happen! */ + bitbuf >>= 8; + numbit -= 8; + } + for (; len > 0; len--, pkt++) { + bitstream >>= 8; + bitstream |= ((unsigned int)*pkt) << 8; + bitbuf |= ((unsigned int)*pkt) << numbit; + notbitstream = ~bitstream; + ENCODEITERA(0); + ENCODEITERA(1); + ENCODEITERA(2); + ENCODEITERA(3); + ENCODEITERA(4); + ENCODEITERA(5); + ENCODEITERA(6); + ENCODEITERA(7); + goto enditer; + ENCODEITERB(0); + ENCODEITERB(1); + ENCODEITERB(2); + ENCODEITERB(3); + ENCODEITERB(4); + ENCODEITERB(5); + ENCODEITERB(6); + ENCODEITERB(7); + enditer: + numbit += 8; + while (numbit >= 8) { + chan->pkt.htx.buf[wr] = bitbuf; + wr = (wr + 1) % TXBUFFER_SIZE; + if (wr == chan->pkt.htx.rd) + *(int *)0 = 0; /* must not happen! */ + bitbuf >>= 8; + numbit -= 8; + } + } + bitbuf |= 0x7e7e << numbit; + numbit += 16; + while (numbit >= 8) { + chan->pkt.htx.buf[wr] = bitbuf; + wr = (wr + 1) % TXBUFFER_SIZE; + if (wr == chan->pkt.htx.rd) + *(int *)0 = 0; /* must not happen! */ + bitbuf >>= 8; + numbit -= 8; + } + chan->pkt.htx.wr = wr; +} + +/* ---------------------------------------------------------------------- */ + +static void kiss_encodepkt(struct modemchannel *chan, unsigned char *data, unsigned dlen) +{ + unsigned char *kbuf = alloca(dlen * 2 + 3); + unsigned char *bp = kbuf; + int i, len; + + *bp++ = KISS_FEND; + *bp++ = KISS_CMD_DATA; + for (; dlen > 0; dlen--, data++) { + if (*data == KISS_FEND) { + *bp++ = KISS_FESC; + *bp++ = KISS_TFEND; + } else if (*data == KISS_FESC) { + *bp++ = KISS_FESC; + *bp++ = KISS_TFESC; + } else + *bp++ = *data; + } + *bp++ = KISS_FEND; + len = bp - kbuf; + i = write(chan->pkt.kiss.fd, kbuf, len); + if (i < 0) { + if (errno == EAGAIN || errno == EIO) + chan->pkt.stat.kiss_outerr++; + else + logerr(MLOG_FATAL, "kiss: write\n"); + } else if (i < len) + logprintf(MLOG_ERROR, "kiss: write error: %d < %d\n", i, len); + else + chan->pkt.stat.kiss_out++; +} + +static void do_rxpacket(struct modemchannel *chan) +{ + if (chan->pkt.hrx.bufcnt < 3) + return; + if (!check_crc_ccitt(chan->pkt.hrx.buf, chan->pkt.hrx.bufcnt)) + return; + chan->pkt.stat.pkt_in++; + { + char buf[512]; + snprintpkt(buf, sizeof(buf), chan->pkt.hrx.buf, chan->pkt.hrx.bufcnt-2); + if (0) + printf("Rx: %s\n", buf); + } + kiss_encodepkt(chan, chan->pkt.hrx.buf, chan->pkt.hrx.bufcnt-2); +} + +#define DECODEITERA(j) \ +do { \ + if (!(notbitstream & (0x0fc << j))) /* flag or abort */ \ + goto flgabrt##j; \ + if ((bitstream & (0x1f8 << j)) == (0xf8 << j)) /* stuffed bit */ \ + goto stuff##j; \ + enditer##j:; \ +} while (0) + +#define DECODEITERB(j) \ +do { \ + flgabrt##j: \ + if (!(notbitstream & (0x1fc << j))) { /* abort received */ \ + state = 0; \ + goto enditer##j; \ + } \ + if ((bitstream & (0x1fe << j)) != (0x0fc << j)) /* flag received */ \ + goto enditer##j; \ + if (state) \ + do_rxpacket(chan); \ + chan->pkt.hrx.bufcnt = 0; \ + chan->pkt.hrx.bufptr = chan->pkt.hrx.buf; \ + state = 1; \ + numbits = 7-j; \ + goto enditer##j; \ + stuff##j: \ + numbits--; \ + bitbuf = (bitbuf & ((~0xff) << j)) | ((bitbuf & ~((~0xff) << j)) << 1); \ + goto enditer##j; \ +} while (0) + +static inline void hdlc_receive(struct modemchannel *chan, const unsigned char *data, unsigned nrbytes) +{ + unsigned bits, bitbuf, notbitstream, bitstream, numbits, state; + + /* start of HDLC decoder */ + numbits = chan->pkt.hrx.numbits; + state = chan->pkt.hrx.state; + bitstream = chan->pkt.hrx.bitstream; + bitbuf = chan->pkt.hrx.bitbuf; + while (nrbytes > 0) { + bits = *data++; + nrbytes--; + bitstream >>= 8; + bitstream |= ((unsigned int)bits) << 8; + bitbuf >>= 8; + bitbuf |= ((unsigned int)bits) << 8; + numbits += 8; + notbitstream = ~bitstream; + DECODEITERA(0); + DECODEITERA(1); + DECODEITERA(2); + DECODEITERA(3); + DECODEITERA(4); + DECODEITERA(5); + DECODEITERA(6); + DECODEITERA(7); + goto enddec; + DECODEITERB(0); + DECODEITERB(1); + DECODEITERB(2); + DECODEITERB(3); + DECODEITERB(4); + DECODEITERB(5); + DECODEITERB(6); + DECODEITERB(7); + enddec: + while (state && numbits >= 8) { + if (chan->pkt.hrx.bufcnt >= RXBUFFER_SIZE) { + state = 0; + } else { + *(chan->pkt.hrx.bufptr)++ = bitbuf >> (16-numbits); + chan->pkt.hrx.bufcnt++; + numbits -= 8; + } + } + } + chan->pkt.hrx.numbits = numbits; + chan->pkt.hrx.state = state; + chan->pkt.hrx.bitstream = bitstream; + chan->pkt.hrx.bitbuf = bitbuf; +} + +/* ---------------------------------------------------------------------- */ + +static void kiss_process_pkt(struct modemchannel *chan, u_int8_t *pkt, unsigned int len) +{ + if (len < 2) + return; + chan->pkt.stat.kiss_in++; + switch (pkt[0]) { + case KISS_CMD_DATA: + hdlc_encode(chan, pkt+1, len-1); + { + char buf[512]; + snprintpkt(buf, sizeof(buf), pkt+1, len-1); + if (0) + printf("Tx: %s\n", buf); + } + return; + + case KISS_CMD_TXDELAY: + state.chacc.txdelay = pkt[1]*10; + logprintf(MLOG_INFO, "kiss: txdelay = %ums\n", pkt[1]*10); + return; + + case KISS_CMD_TXTAIL: + logprintf(MLOG_INFO, "kiss: txtail = %ums\n", pkt[1]*10); + return; + + case KISS_CMD_PPERSIST: + state.chacc.ppersist = pkt[1]; + logprintf(MLOG_INFO, "kiss: ppersist = %u/256\n", pkt[1]); + return; + + case KISS_CMD_SLOTTIME: + state.chacc.slottime = pkt[1]*10; + logprintf(MLOG_INFO, "kiss: slottime = %ums\n", pkt[1]*10); + return; + + case KISS_CMD_FULLDUP: + state.chacc.fullduplex = !!pkt[1]; + logprintf(MLOG_INFO, "kiss: %sduplex\n", pkt[1] ? "full" : "half"); + return; + + default: + logprintf(MLOG_INFO, "unknown kiss packet: 0x%02x 0x%02x\n", pkt[0], pkt[1]); + return; + } +} + +/* ---------------------------------------------------------------------- */ + +/* we decode inplace */ +static void kiss_decode(struct modemchannel *chan, u_int8_t *b, int len) +{ + int nlen = 0; + u_int8_t *p1 = b, *p2, *iframe; + + iframe = p2 = alloca(len); + while (len > 0) { + if (*p1 != KISS_FESC) { + *p2++ = *p1++; + nlen++; + len--; + } else { + if (len < 2) + goto err; /* invalid escape */ + if (p1[1] == KISS_TFEND) + *p2++ = KISS_FEND; + else if (p1[1] == KISS_TFESC) + *p2++ = KISS_FESC; + else + goto err; /* invalid escape */ + nlen++; + p1 += 2; + len -= 2; + } + } + if (len > 0) + goto err; + kiss_process_pkt(chan, iframe, nlen); + return; + err: + logprintf(MLOG_ERROR, "KISS input error\n"); + chan->pkt.stat.kiss_inerr++; +} + +static void kiss_input(struct modemchannel *chan) +{ + char *cp1, *cp2, *endp; + int i; + + chan->pkt.kiss.ioerr = 0; + i = read(chan->pkt.kiss.fd, chan->pkt.kiss.ibuf + chan->pkt.kiss.ibufptr, sizeof(chan->pkt.kiss.ibuf) - chan->pkt.kiss.ibufptr); + if (i < 0) { + if (errno == EIO) { + chan->pkt.kiss.ioerr = 1; + return; + } + if (errno == EAGAIN) + return; + logerr(MLOG_FATAL, "KISS: read"); + return; + } + if (!i) + return; + chan->pkt.kiss.ibufptr += i; + endp = chan->pkt.kiss.ibuf + chan->pkt.kiss.ibufptr; + cp1 = memchr(chan->pkt.kiss.ibuf, KISS_FEND, chan->pkt.kiss.ibufptr); + while (cp1) { + cp2 = memchr(cp1+1, KISS_FEND, endp - cp1 - 1); + if (!cp2) { + chan->pkt.kiss.ibufptr = endp-cp1; + memmove(chan->pkt.kiss.ibuf, cp1, chan->pkt.kiss.ibufptr); + return; + } + kiss_decode(chan, cp1+1, cp2-cp1-1); + cp1 = cp2; + } +} + +/* ---------------------------------------------------------------------- */ + +static unsigned short random_num(void) +{ + static unsigned short random_seed; + + random_seed = 28629 * random_seed + 157; + return random_seed; +} + +/* ---------------------------------------------------------------------- */ + +static unsigned int terminate = 0; + +static int globaldcd(struct state *state) +{ + struct modemchannel *chan; + + for (chan = state->channels; chan; chan = chan->next) + if (chan->pkt.dcd) + return 1; + return 0; +} + +static RETSIGTYPE sigusr1() +{ + struct modemchannel *chan; + + for (chan = state.channels; chan; chan = chan->next) { + logprintf(MLOG_INFO, "Interface %s:\n" + " KISS: in %u inerr %u out %u outerr %u PKT: in %u out %u\n", + chan->pkt.kiss.ifname, chan->pkt.stat.kiss_in, chan->pkt.stat.kiss_inerr, + chan->pkt.stat.kiss_out, chan->pkt.stat.kiss_outerr, + chan->pkt.stat.pkt_in, chan->pkt.stat.pkt_out); + } +} + +static RETSIGTYPE sigterm() +{ + terminate = 1; +} + +int pktget(struct modemchannel *chan, unsigned char *data, unsigned int len) +{ + unsigned int i, j, n = len; + + i = (chan->pkt.htx.rd - chan->pkt.htx.wr - 1) % TXBUFFER_SIZE; + if (i > KISSINBUF_SIZE*6/5) + kiss_input(chan); + if (chan->pkt.inhibittx || chan->pkt.htx.rd == chan->pkt.htx.wr) + return 0; + while (n > 0) { + if (chan->pkt.htx.wr >= chan->pkt.htx.rd) + j = chan->pkt.htx.wr - chan->pkt.htx.rd; + else + j = TXBUFFER_SIZE - chan->pkt.htx.rd; + if (j > n) + j = n; + if (!j) + break; + memcpy(data, &chan->pkt.htx.buf[chan->pkt.htx.rd], j); + data += j; + n -= j; + chan->pkt.htx.rd = (chan->pkt.htx.rd + j) % TXBUFFER_SIZE; + } + if (n > 0) + memset(data, 0, n); + return (len - n); +} + +void pktput(struct modemchannel *chan, const unsigned char *data, unsigned int len) +{ + hdlc_receive(chan, data, len); +} + +void p3dreceive(struct modemchannel *chan, const unsigned char *pkt, u_int16_t crc) +{ + unsigned char buf[256+16]; + unsigned int i; + + if (crc) + return; + buf[0] = 'Q' << 1; + buf[1] = 'S' << 1; + buf[2] = 'T' << 1; + buf[3] = ' ' << 1; + buf[4] = ' ' << 1; + buf[5] = ' ' << 1; + buf[6] = (0 << 1) | 0x80; + buf[7] = 'A' << 1; + buf[8] = 'O' << 1; + buf[9] = '4' << 1; + buf[10] = '0' << 1; + buf[11] = ' ' << 1; + buf[12] = ' ' << 1; + buf[13] = (1 << 1) | 1; + buf[14] = 0x03; /* UI */ + buf[15] = 0xf0; /* PID */ + memcpy(&buf[16], &pkt[0], 256); + kiss_encodepkt(chan, buf, 256+16); + buf[13] = (2 << 1) | 1; + memcpy(&buf[16], &pkt[256], 256); + kiss_encodepkt(chan, buf, 256+16); +} + +void p3drxstate(struct modemchannel *chan, unsigned int synced, unsigned int carrierfreq) +{ + pktsetdcd(chan, !!synced); +} + +#define NRPFD 8 + +static void waitfortx(struct state *state) +{ + struct modemchannel *chan; + struct pollfd pfd[NRPFD]; + unsigned int nr; + + while (!terminate) { + int tmo = -1; + nr = 0; + for (chan = state->channels; chan; chan = chan->next) { + if (!chan->mod || !state->audioio->write) + continue; + if (chan->pkt.htx.rd != chan->pkt.htx.wr) + return; + kiss_input(chan); + if (chan->pkt.htx.rd != chan->pkt.htx.wr) + return; + if (1 && chan->pkt.kiss.ioerr) { + tmo = 10; + continue; + } + if (nr >= NRPFD) + logprintf(MLOG_FATAL, "pkttransmitloop: too many transmitters\n"); + pfd[nr].events = chan->pkt.kiss.ioerr ? POLLERR : POLLIN; + pfd[nr].fd = chan->pkt.kiss.fd; + nr++; + } + if (!nr && tmo == -1) + return; + if (poll(pfd, nr, tmo) < 0) + logerr(MLOG_FATAL, "KISS: poll\n"); + } +} + +void pkttransmitloop(struct state *state) +{ + struct modemchannel *chan, *chantail; + + signal(SIGUSR1, sigusr1); + signal(SIGHUP, sigterm); + while (!terminate) { + waitfortx(state); + for (;;) { + if (state->chacc.fullduplex) + break; + if (!globaldcd(state) && (random_num() & 0xff) <= state->chacc.ppersist) + break; + usleep(state->chacc.slottime * 1000); + } + pttsetptt(&state->ptt, 1); + if (state->audioio->transmitstart) + state->audioio->transmitstart(state->audioio); + for (chan = state->channels; chan; chan = chan->next) { + if (chan->pkt.htx.rd == chan->pkt.htx.wr) + kiss_input(chan); + if (chan->mod && chan->pkt.htx.rd != chan->pkt.htx.wr) + break; + } + if (!chan) + break; + chan->pkt.inhibittx = 0; + chan->mod->modulate(chan->modstate, state->chacc.txdelay); + chan->pkt.inhibittx = 1; + chantail = chan; + for (chan = chan->next; chan; chan = chan->next) { + if (chan->pkt.htx.rd == chan->pkt.htx.wr) + kiss_input(chan); + if (chan->mod && chan->pkt.htx.rd != chan->pkt.htx.wr) { + chan->pkt.inhibittx = 0; + chan->mod->modulate(chan->modstate, 0); + chan->pkt.inhibittx = 1; + chantail = chan; + } + } + chantail->mod->modulate(chantail->modstate, state->chacc.txtail); + if (state->audioio->transmitstop) + state->audioio->transmitstop(state->audioio); + pttsetptt(&state->ptt, 0); + } +} + +void pktsetdcd(struct modemchannel *chan, int dcd) +{ + chan->pkt.dcd = !!dcd; + pttsetdcd(&chan->state->ptt, globaldcd(chan->state)); + logprintf(250, "DCD: %s\n", dcd ? "on" : "off"); +} + +void pktrelease(struct modemchannel *chan) +{ + close(chan->pkt.kiss.fd); + if (chan->pkt.kiss.fdmaster != -1) + close(chan->pkt.kiss.fdmaster); + chan->pkt.kiss.fd = chan->pkt.kiss.fdmaster = -1; +} + +struct modemparams pktkissparams[] = { + { "file", "File", "File (symlink) to send the KISS stream to", "/dev/soundmodem0", + MODEMPAR_COMBO, { c: { { "/dev/soundmodem0", "/dev/soundmodem1", "/dev/soundmodem2", "/dev/soundmodem3" } } } }, + { "unlink", "Unlink File", "Unlink File (above) on setup", "1", MODEMPAR_CHECKBUTTON }, + { NULL } +}; + +void pktinit(struct modemchannel *chan, const char *params[]) +{ + const char *file = params[0]; + int dounlink; + struct termios tm; + char ttyname[32]; + int master, slave; + + memset(&chan->pkt, 0, sizeof(chan->pkt)); + chan->pkt.inhibittx = 1; + if (!params[1]) + dounlink = 1; + else + dounlink = !strcmp(params[1], "1"); + if (!file) + logprintf(MLOG_FATAL, "KISS: No file name specified\n"); + strncpy(chan->pkt.kiss.ifname, file, sizeof(chan->pkt.kiss.ifname)); + if (openpty(&master, &slave, ttyname, NULL, NULL)) + logerr(MLOG_FATAL, "openpty"); + /* set mode to raw */ + memset(&tm, 0, sizeof(tm)); + tm.c_cflag = CS8 | CREAD | CLOCAL; + if (tcsetattr(master, TCSANOW, &tm)) + logerr(MLOG_ERROR, "master: tcsetattr"); + memset(&tm, 0, sizeof(tm)); + tm.c_cflag = CS8 | CREAD | CLOCAL; + if (tcsetattr(slave, TCSANOW, &tm)) + logerr(MLOG_FATAL, "slave: tcsetattr"); + //fchmod(slave, 0600); + if (dounlink) + unlink(file); + if (symlink(ttyname, file)) + logprintf(MLOG_ERROR, "kiss: symlink error: %s -> %s\n", ttyname, file); + chan->pkt.kiss.fd = master; + chan->pkt.kiss.fdmaster = -1; + chan->pkt.kiss.ioerr = 1; + close(slave); + fcntl(chan->pkt.kiss.fd, F_SETFL, fcntl(chan->pkt.kiss.fd, F_GETFL, 0) | O_NONBLOCK); + chan->pkt.kiss.ibufptr = 0; + chan->pkt.dcd = 0; +} + +/* ---------------------------------------------------------------------- */ + +#ifdef HAVE_MKISS + +struct modemparams pktmkissparams[] = { + { "ifname", "Interface Name", "Name of the Kernel KISS Interface", "sm0", MODEMPAR_COMBO, + { c: { { "sm0", "sm1", "sm2", "ax0" } } } }, + { "hwaddr", "Callsign", "Callsign (Hardware Address)", "", MODEMPAR_STRING }, + { "ip", "IP Address", "IP Address (mandatory)", "10.0.0.1", MODEMPAR_STRING }, + { "netmask", "Network Mask", "Network Mask", "255.255.255.0", MODEMPAR_STRING }, + { "broadcast", "Broadcast Address", "Broadcast Address", "10.0.0.255", MODEMPAR_STRING }, + { NULL } +}; + +static int parsehw(ax25_address *hwaddr, const char *cp) +{ + const char *cp1; + unsigned int i, j; + + if (!cp || !*cp) + return 0; + memset(hwaddr->ax25_call, ' ', 6); + cp1 = strchr(cp, '-'); + if (cp1) { + i = cp1 - cp; + j = strtoul(cp1 + 1, NULL, 0); + hwaddr->ax25_call[6] = j & 15; + } else { + i = strlen(cp); + hwaddr->ax25_call[6] = 0; + } + if (i > 6) + i = 6; + memcpy(hwaddr->ax25_call, cp, i); + for (i = 0; i < 6; i++) + if (hwaddr->ax25_call[i] >= 'a' && hwaddr->ax25_call[i] <= 'z') + hwaddr->ax25_call[i] += 'A' - 'a'; + for (i = 0; i < 7; i++) + hwaddr->ax25_call[i] <<= 1; + return 1; +} + +static int parseip(struct in_addr *ipaddr, const char *cp) +{ + if (!cp || !*cp) + return 0; + if (inet_aton(cp, ipaddr)) + return 1; + ipaddr->s_addr = 0; + logprintf(MLOG_ERROR, "mkiss: invalid IP address \"%s\"\n", cp); + return 0; +} + +void pktinitmkiss(struct modemchannel *chan, const char *params[]) +{ + struct termios tm; + char ttyname[32]; + int master, slave, fd, disc = N_AX25, encap = 4; + struct ifreq ifr; + char mbuf[512], *mptr = mbuf; + struct sockaddr_ax25 sax25; + struct sockaddr_in sin; + unsigned i; + + memset(&chan->pkt, 0, sizeof(chan->pkt)); + chan->pkt.inhibittx = 1; + if (!params[0]) + logprintf(MLOG_FATAL, "MKISS: No interface name specified\n"); + strncpy(chan->pkt.kiss.ifname, params[0], sizeof(chan->pkt.kiss.ifname)); + if (openpty(&master, &slave, ttyname, NULL, NULL)) + logerr(MLOG_FATAL, "openpty"); + /* set mode to raw */ + memset(&tm, 0, sizeof(tm)); + tm.c_cflag = CS8 | CREAD | CLOCAL; + if (tcsetattr(master, TCSANOW, &tm)) + logerr(MLOG_FATAL, "master: tcsetattr"); + memset(&tm, 0, sizeof(tm)); + tm.c_cflag = CS8 | CREAD | CLOCAL; + if (tcsetattr(slave, TCSANOW, &tm)) + logerr(MLOG_FATAL, "slave: tcsetattr"); + /* set the line discipline */ + if (ioctl(master, TIOCSETD, &disc) == -1) + logerr(MLOG_FATAL, "ioctl: TIOCSETD"); + if (ioctl(master, SIOCSIFENCAP, &encap) == -1) + logerr(MLOG_FATAL, "ioctl: SIOCSIFENCAP"); + /* try to set the interface name */ + if (params[0]) { + if (ioctl(master, SIOCGIFNAME, &ifr) == -1) + logerr(MLOG_FATAL, "ioctl: SIOCGIFNAME"); + if (strcmp(params[0], ifr.ifr_name)) { + if ((fd = socket(PF_INET, SOCK_DGRAM, 0)) == -1) + logerr(MLOG_FATAL, "socket (setifname)"); + strncpy(ifr.ifr_newname, params[0], sizeof(ifr.ifr_newname)); + ifr.ifr_newname[sizeof(ifr.ifr_newname) - 1] = 0; + if (ioctl(fd, SIOCSIFNAME, &ifr) == -1) { + logerr(1, "ioctl: SIOCSIFNAME"); + logprintf(1, "mkiss: cannot set ifname to %s, using %s (old kernel version?)\n", + params[0], ifr.ifr_name); + } + close(fd); + } + } + if (ioctl(master, SIOCGIFNAME, &ifr) == -1) + logerr(MLOG_FATAL, "ioctl: SIOCGIFNAME"); + strncpy(chan->pkt.kiss.ifname, ifr.ifr_name, sizeof(chan->pkt.kiss.ifname)); + /* start the interface */ + if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) + logerr(MLOG_FATAL, "socket"); + mptr += sprintf(mptr, "ifname %s mtu 256", ifr.ifr_name); + ifr.ifr_mtu = 256; + if (ioctl(fd, SIOCSIFMTU, &ifr) == -1) + logerr(MLOG_FATAL, "ioctl: SIOCSIFMTU"); + if (parsehw(&sax25.sax25_call, params[1])) { + sax25.sax25_family = ARPHRD_AX25; + sax25.sax25_ndigis = 0; + memcpy(&ifr.ifr_hwaddr, &sax25, sizeof(ifr.ifr_hwaddr)); + if (ioctl(fd, SIOCSIFHWADDR, &ifr) == -1) + logerr(MLOG_ERROR, "ioctl: SIOCSIFHWADDR"); + else { + mptr += sprintf(mptr, " hwaddr "); + for (i = 0; i < 6; i++) + if (sax25.sax25_call.ax25_call[i] != (' ' << 1)) + *mptr++ = (sax25.sax25_call.ax25_call[i] >> 1) & 0x7f; + mptr += sprintf(mptr, "-%d", (sax25.sax25_call.ax25_call[6] >> 1) & 0x7f); + } + } + if (parseip(&sin.sin_addr, params[2])) { + sin.sin_family = AF_INET; + memcpy(&ifr.ifr_addr, &sin, sizeof(ifr.ifr_addr)); + if (ioctl(fd, SIOCSIFADDR, &ifr) == -1) + logerr(MLOG_ERROR, "ioctl: SIOCSIFADDR"); + else + mptr += sprintf(mptr, " ipaddr %s", inet_ntoa(sin.sin_addr)); + } + if (parseip(&sin.sin_addr, params[3])) { + sin.sin_family = AF_INET; + memcpy(&ifr.ifr_netmask, &sin, sizeof(ifr.ifr_netmask)); + if (ioctl(fd, SIOCSIFNETMASK, &ifr) == -1) + logerr(MLOG_ERROR, "ioctl: SIOCSIFNETMASK"); + else + mptr += sprintf(mptr, " netmask %s", inet_ntoa(sin.sin_addr)); + } + if (parseip(&sin.sin_addr, params[4])) { + sin.sin_family = AF_INET; + memcpy(&ifr.ifr_broadaddr, &sin, sizeof(ifr.ifr_broadaddr)); + if (ioctl(fd, SIOCSIFBRDADDR, &ifr) == -1) + logerr(MLOG_ERROR, "ioctl: SIOCSIFBRDADDR"); + else + mptr += sprintf(mptr, " broadcast %s", inet_ntoa(sin.sin_addr)); + } + if (ioctl(fd, SIOCGIFFLAGS, &ifr) == -1) + logerr(0, "ioctl: SIOCGIFFLAGS"); + ifr.ifr_flags &= ~IFF_NOARP; + ifr.ifr_flags |= IFF_UP | IFF_RUNNING; + if (ioctl(fd, SIOCSIFFLAGS, &ifr) == -1) + logerr(MLOG_FATAL, "ioctl: SIOCSIFFLAGS"); + + close(fd); + logprintf(MLOG_INFO, "mkiss: %s\n", mbuf); + /* prepare for using it */ + chan->pkt.kiss.fd = slave; + chan->pkt.kiss.fdmaster = master; + chan->pkt.kiss.ioerr = 0; + fcntl(chan->pkt.kiss.fd, F_SETFL, fcntl(chan->pkt.kiss.fd, F_GETFL, 0) | O_NONBLOCK); + chan->pkt.kiss.ibufptr = 0; + chan->pkt.dcd = 0; +} + +#else /* HAVE_MKISS */ + +struct modemparams pktmkissparams[] = { + { NULL } +}; + +void pktinitmkiss(struct modemchannel *chan, const char *params[]) +{ + logprintf(MLOG_FATAL, "mkiss not supported on this architecture\n"); +} + +#endif /* HAVE_MKISS */ +/* ---------------------------------------------------------------------- */ diff --git a/soundcard/kisspkt.h b/soundcard/kisspkt.h new file mode 100644 index 0000000..cbe5db0 --- /dev/null +++ b/soundcard/kisspkt.h @@ -0,0 +1,90 @@ +/*****************************************************************************/ + +/* + * kisspkt.h -- Internal kisspkt data structures. + * + * Copyright (C) 2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +/*****************************************************************************/ + +#ifndef _KISSPKT_H +#define _KISSPKT_H + +/* ---------------------------------------------------------------------- */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* ---------------------------------------------------------------------- */ + +#define MAXFLEN 512U +#define RXBUFFER_SIZE ((MAXFLEN*6U/5U)+8U) +#define TXBUFFER_SIZE 4096U /* must be a power of 2 and >= MAXFLEN*6/5+8; NOTE: in words */ + +#define KISSINBUF_SIZE (2*MAXFLEN+8) + +#define IFNAMELEN 128 + +/* ---------------------------------------------------------------------- */ + +struct chacc { + unsigned int txdelay; + unsigned int ppersist; + unsigned int slottime; + unsigned int fullduplex; + unsigned int txtail; +}; + +struct kisspkt { + unsigned int dcd; + unsigned int inhibittx; + + struct { + unsigned rd, wr; + unsigned char buf[TXBUFFER_SIZE]; + } htx; + + struct { + unsigned int bitbuf, bitstream, numbits, state; + unsigned char *bufptr; + int bufcnt; + unsigned char buf[RXBUFFER_SIZE]; + } hrx; + + struct { + int fd, fdmaster, ioerr; + unsigned iframelen, ibufptr; + char ifname[IFNAMELEN]; + unsigned char ibuf[KISSINBUF_SIZE]; + } kiss; + + struct { + unsigned int kiss_in; + unsigned int kiss_inerr; + unsigned int kiss_out; + unsigned int kiss_outerr; + unsigned int pkt_in; + unsigned int pkt_out; + } stat; +}; + +/* ---------------------------------------------------------------------- */ +#endif /* _KISSPKT_H */ diff --git a/soundcard/log.c b/soundcard/log.c new file mode 100644 index 0000000..5f87498 --- /dev/null +++ b/soundcard/log.c @@ -0,0 +1,112 @@ +/*****************************************************************************/ + +/* + * log.c -- Logging functions. + * + * Copyright (C) 1999-2000 Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please note that the GPL allows you to use the driver, NOT the radio. + * In order to use the radio, you need a license from the communications + * authority of your country. + * + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE +#define _REENTRANT + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "soundio.h" + +#ifdef HAVE_SYSLOG_H +#include +#endif + +#include +#include +#include +#include +#include +#include + +/* ---------------------------------------------------------------------- */ + +static unsigned int tosyslog = 0; +unsigned int log_verblevel = 0; + +/* ---------------------------------------------------------------------- */ + +void logrelease(void) +{ +#ifdef HAVE_CLOSELOG + if (tosyslog) + closelog(); +#endif + tosyslog = 0; +} + +void loginit(unsigned int vl, unsigned int tosysl) +{ + log_verblevel = vl; + tosyslog = 0; +#ifdef HAVE_OPENLOG + if (tosysl) { + openlog("soundmodem", LOG_PID, LOG_DAEMON); + tosyslog = 1; + } +#endif +} + +void logvprintf(unsigned int level, const char *fmt, va_list args) +{ + static const int vltosev[] = { LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE }; + + if (level <= log_verblevel) { +#ifdef HAVE_SYSLOG + if (tosyslog) { + char tmp[512]; + vsnprintf(tmp, sizeof(tmp), fmt, args); + syslog((level >= 256) ? LOG_DEBUG : (level >= 4) ? LOG_INFO : vltosev[level], tmp); + } else +#endif + { + fprintf(stderr, "sm[%lu]: ", (unsigned long)getpid()); + vfprintf(stderr, fmt, args); + } + } + if (!level) + exit(1); +} + +void logprintf(unsigned int level, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + logvprintf(level, fmt, args); + va_end(args); +} + +void logerr(unsigned int level, const char *st) +{ + logprintf(level, "%s: %s (%d)\n", st, strerror(errno), errno); +} + diff --git a/soundcard/main.c b/soundcard/main.c new file mode 100644 index 0000000..14a2d85 --- /dev/null +++ b/soundcard/main.c @@ -0,0 +1,512 @@ +/*****************************************************************************/ + +/* + * main.c -- Soundmodem main. + * + * Copyright (C) 1999-2001, 2003, 2010 + * Thomas Sailer (t.sailer@alumni.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please note that the GPL allows you to use the driver, NOT the radio. + * In order to use the radio, you need a license from the communications + * authority of your country. + * + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE +#define _REENTRANT + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "soundio.h" +#include "simd.h" + +#include "getopt.h" + +#include +#include +#include +#include + +/* libxml includes */ +#include +#include + +#ifdef HAVE_SCHED_H +#include +#endif + +#include +#include + +/* ---------------------------------------------------------------------- */ + +struct state state = { + NULL, NULL, NULL, + { 150, 40, 100, 0, 10 }, {} +}; + +static struct modemparams chaccparams[] = { + { "txdelay", "TxDelay", "Transmitter Keyup delay in ms", "150", MODEMPAR_NUMERIC, { n: { 0, 2550, 10, 50 } } }, + { "slottime", "Slot Time", "Slot Time in ms (normally 100ms)", "100", MODEMPAR_NUMERIC, { n: { 0, 2550, 10, 50 } } }, + { "ppersist", "P-Persistence", "P-Persistence", "40", MODEMPAR_NUMERIC, { n: { 0, 255, 1, 10 } } }, + { "fulldup", "Full Duplex", "Full Duplex", "0", MODEMPAR_CHECKBUTTON }, + { "txtail", "TxTail", "Transmitter Tail delay in ms", "10", MODEMPAR_NUMERIC, { n: { 0, 2550, 10, 50 } } }, + { NULL } +}; + +#ifdef HAVE_ALSA +#define ALSA_STR , "alsa" +#else /* HAVE_ALSA */ +#define ALSA_STR +#endif /* HAVE_ALSA */ + +static struct modemparams ioparam_type[] = { + { "type", "Audio IO Mode", "Audio IO Mode", "soundcard", MODEMPAR_COMBO, + { c: { { "soundcard", "file", "simulation" ALSA_STR } } } }, + { NULL } +}; + +#undef ALSA_STR + +/* ---------------------------------------------------------------------- */ + +void audiowrite(struct modemchannel *chan, const int16_t *samples, unsigned int nr) +{ + struct audioio *audioio = chan->state->audioio; + + if (!audioio->write) + return; + audioio->write(audioio, samples, nr); +} + +void audioread(struct modemchannel *chan, int16_t *samples, unsigned int nr, u_int16_t tim) +{ + struct audioio *audioio = chan->state->audioio; + + if (!audioio->read) { + pthread_exit(NULL); + return; + } + audioio->read(audioio, samples, nr, tim); +} + +u_int16_t audiocurtime(struct modemchannel *chan) +{ + struct audioio *audioio = chan->state->audioio; + + if (!audioio->curtime) + return 0; + return audioio->curtime(audioio); +} + +/* ---------------------------------------------------------------------- */ + +#define MAXPAR 16 + +static void getparam(xmlDocPtr doc, xmlNodePtr node, const struct modemparams *par, const char *parstr[MAXPAR]) +{ + unsigned int i; + + memset(parstr, 0, sizeof(parstr)); + if (!par || !node) + return; + for (i = 0; i < MAXPAR && par->name; i++, par++) + parstr[i] = xmlGetProp(node, par->name); +} + +static void *demodthread(void *state) +{ + struct modemchannel *chan = state; + chan->demod->demodulate(chan->demodstate); + logprintf(MLOG_FATAL, "Receiver %s has returned\n", chan->demod->name); + return NULL; +} + +static void parsechannel(xmlDocPtr doc, xmlNodePtr node, struct state *state, unsigned int *samplerate) +{ + xmlNodePtr pkt = NULL, mod = NULL, demod = NULL; + struct modulator *mc = NULL; + struct demodulator *dc = NULL; + struct modemchannel *chan; + char *cp; + const char *par[MAXPAR]; + unsigned int sr, ismkiss = 0; + + for (; node; node = node->next) { + if (node->type != XML_ELEMENT_NODE) + continue; + if (!node->name) + logprintf(MLOG_FATAL, "Node has no name\n"); + if (!strcmp(node->name, "pkt")) { + pkt = node; + ismkiss = 0; + cp = xmlGetProp(node, "mode"); + if (cp && (!strcmp(cp, "mkiss") || !strcmp(cp, "MKISS"))) + ismkiss = 1; + continue; + } + if (!strcmp(node->name, "mod")) { + mod = node; + continue; + } + if (!strcmp(node->name, "demod")) { + demod = node; + continue; + } + logprintf(MLOG_ERROR, "unknown node \"%s\"\n", node->name); + } + if (mod) { + cp = xmlGetProp(mod, "mode"); + if (cp) { + for (mc = modchain; mc && strcmp(mc->name, cp); mc = mc->next); + if (!mc) + logprintf(MLOG_ERROR, "Modulator \"%s\" unknown\n", cp); + } + } + if (demod) { + cp = xmlGetProp(demod, "mode"); + if (cp) { + for (dc = demodchain; dc && strcmp(dc->name, cp); dc = dc->next); + if (!dc) + logprintf(MLOG_ERROR, "Demodulator \"%s\" unknown\n", cp); + } + } + if ((!mc && !dc) || !pkt) + return; + if (!(chan = malloc(sizeof(struct modemchannel)))) + logprintf(MLOG_FATAL, "out of memory\n"); + memset(chan, 0, sizeof(struct modemchannel)); + chan->next = state->channels; + chan->state = state; + chan->mod = mc; + chan->demod = dc; + chan->modstate = NULL; + chan->demodstate = NULL; + if (ismkiss) { + getparam(doc, pkt, pktmkissparams, par); + pktinitmkiss(chan, par); + } else { + getparam(doc, pkt, pktkissparams, par); + pktinit(chan, par); + } + if (mc) { + getparam(doc, mod, mc->params, par); + sr = *samplerate; + chan->modstate = mc->config(chan, &sr, par); + if (sr > *samplerate) + *samplerate = sr; + } + if (dc) { + getparam(doc, demod, dc->params, par); + sr = *samplerate; + chan->demodstate = dc->config(chan, &sr, par); + if (sr > *samplerate) + *samplerate = sr; + } + state->channels = chan; +} + +static int parsecfg(xmlDocPtr doc, xmlNodePtr node, struct state *state, unsigned int *schedrr) +{ + xmlNodePtr audio = NULL; + xmlNodePtr ptt = NULL; + const char *par[MAXPAR]; + struct modemchannel *chan; + pthread_attr_t rxattr; + size_t stacksize; + unsigned int samplerate = 5000, mode; + + for (; node; node = node->next) { + if (node->type != XML_ELEMENT_NODE) + continue; + if (!node->name) + logprintf(MLOG_FATAL, "Node has no name\n"); + if (!strcmp(node->name, "audio")) { + audio = node; + continue; + } + if (!strcmp(node->name, "ptt")) { + ptt = node; + continue; + } + if (!strcmp(node->name, "chaccess")) { + getparam(doc, node, chaccparams, par); + if (par[0]) + state->chacc.txdelay = strtoul(par[0], NULL, 0); + if (par[1]) + state->chacc.slottime = strtoul(par[1], NULL, 0); + if (par[2]) + state->chacc.ppersist = strtoul(par[2], NULL, 0); + if (par[3]) + state->chacc.fullduplex = !!strtoul(par[3], NULL, 0); + if (par[4]) + state->chacc.txtail = strtoul(par[4], NULL, 0); + continue; + } + if (!strcmp(node->name, "channel")) { + if (node->children) + parsechannel(doc, node->children, state, &samplerate); + continue; + } + logprintf(MLOG_ERROR, "unknown node \"%s\"\n", node->name); + } + /* find audio mode */ + mode = 0; + for (chan = state->channels; chan; chan = chan->next) { + if (chan->demod && chan->demod->demodulate) + mode |= IO_RDONLY; + if (chan->mod && chan->mod->modulate) + mode |= IO_WRONLY; + } + if (!state->channels || !mode) { + logprintf(MLOG_ERROR, "no channels configured\n"); + return -1; + } + /* open PTT */ + getparam(doc, ptt, pttparams, par); + if (pttinit(&state->ptt, par)) + logprintf(MLOG_ERROR, "cannot start PTT output\n"); + /* open audio */ + getparam(doc, audio, ioparam_type, par); + if (par[0] && !strcmp(par[0], ioparam_type[0].u.c.combostr[1])) { + getparam(doc, audio, ioparams_filein, par); + state->audioio = ioopen_filein(&samplerate, IO_RDONLY, par); + if (schedrr) + *schedrr = 0; + } else if (par[0] && !strcmp(par[0], ioparam_type[0].u.c.combostr[2])) { + getparam(doc, audio, ioparams_sim, par); + state->audioio = ioopen_sim(&samplerate, IO_RDWR, par); + if (schedrr) + *schedrr = 0; +#ifdef HAVE_ALSA + } else if (par[0] && !strcmp(par[0], ioparam_type[0].u.c.combostr[3])) { + getparam(doc, audio, ioparams_alsasoundcard, par); + state->audioio = ioopen_alsasoundcard(&samplerate, mode, par); +#endif /* HAVE_ALSA */ + } else { + getparam(doc, audio, ioparams_soundcard, par); + state->audioio = ioopen_soundcard(&samplerate, mode, par); + } + if (!state->audioio) + logprintf(MLOG_FATAL, "cannot start audio\n"); + for (chan = state->channels; chan; chan = chan->next) { + if (chan->demod) { + chan->demod->init(chan->demodstate, samplerate, &chan->rxbitrate); + if (pthread_attr_init(&rxattr)) + logerr(MLOG_FATAL, "pthread_attr_init"); + /* needed on FreeBSD, according to driehuis@playbeing.org */ + if (pthread_attr_getstacksize(&rxattr, &stacksize)) + logerr(MLOG_ERROR, "pthread_attr_getstacksize"); + else if (stacksize < 256*1024) + if (pthread_attr_setstacksize(&rxattr, 256*1024)) + logerr(MLOG_ERROR, "pthread_attr_setstacksize"); +#ifdef HAVE_SCHED_H + if (schedrr && *schedrr) { + struct sched_param schp; + memset(&schp, 0, sizeof(schp)); + schp.sched_priority = sched_get_priority_min(SCHED_RR)+1; + if (pthread_attr_setschedpolicy(&rxattr, SCHED_RR)) + logerr(MLOG_ERROR, "pthread_attr_setschedpolicy"); + if (pthread_attr_setschedparam(&rxattr, &schp)) + logerr(MLOG_ERROR, "pthread_attr_setschedparam"); + } +#endif /* HAVE_SCHED_H */ + if (pthread_create(&chan->rxthread, &rxattr, demodthread, chan)) + logerr(MLOG_FATAL, "pthread_create"); + pthread_attr_destroy(&rxattr); + } + if (chan->mod) + chan->mod->init(chan->modstate, samplerate); + } + return 0; +} + +/* ---------------------------------------------------------------------- */ + +#ifdef HAVE_MLOCKALL +#define MLOCKOPT "M" +#define MLOCKHLP " [-M]" +#else /* HAVE_MLOCKALL */ +#define MLOCKOPT "" +#define MLOCKHLP "" +#endif /* HAVE_MLOCKALL */ + +static void parseopts(int argc, char *argv[]) +{ + static const struct option long_options[] = { + { "config", 1, 0, 'c' }, + { "syslog", 0, 0, 's' }, + { "nosimd", 0, 0, 'S' }, + { "daemonize", 0, 0, 'D' }, + { 0, 0, 0, 0 } + }; + char *configname = NULL, *cfgname, *filename = "/etc/ax25/soundmodem.conf"; + unsigned int verblevel = 2, tosyslog = 0, simd = 1, schedrr = 0, lockmem = 0, daemonize = 0; + int c, err = 0; + xmlDocPtr doc; + xmlNodePtr node; + int pfds[2]; + pid_t pid; + unsigned char uch; + + while ((c = getopt_long(argc, argv, "v:sSc:RD" MLOCKOPT, long_options, NULL)) != EOF) { + switch (c) { + case 'v': + verblevel = strtoul(optarg, NULL, 0); + break; + + case 's': + tosyslog = 1; + break; + + case 'S': + simd = 0; + break; + + case 'c': + configname = optarg; + break; + + case 'R': + schedrr = 1; + break; + +#ifdef HAVE_MLOCKALL + case 'M': + lockmem = 1; + break; +#endif /* HAVE_MLOCKALL */ + + case 'D': + daemonize = 1; + break; + + default: + err++; + break; + } + } + if (err) { + fprintf(stderr, "usage: [-v ] [-s] [-S] [-R]" MLOCKHLP " [-c ] \n"); + exit(1); + } + loginit(verblevel, tosyslog); + if (daemonize) { + if (pipe(pfds)) + logerr(MLOG_FATAL, "pipe"); + switch (pid = fork()) { + case -1: + logerr(MLOG_FATAL, "fork"); + + case 0: /* child process */ + close(pfds[0]); + setsid(); /* become a process group leader and drop controlling terminal */ + fclose(stdin); /* no more standard in */ + break; + + default: /* parent process */ + close(pfds[1]); + err = read(pfds[0], &uch, sizeof(uch)); + if (err != sizeof(uch)) + logprintf(MLOG_FATAL, "SoundModem init failed\n"); + exit(0); + } + } + initsimd(simd); +#if 0 + if (optind >= argc) + logprintf(MLOG_FATAL, "no configuration file specified\n"); +#endif + if (optind < argc) + filename = argv[optind]; + doc = xmlParseFile(filename); + if (!doc || !doc->children || !doc->children->name) + logprintf(MLOG_FATAL, "Error parsing config file \"%s\"\n", filename); + if (strcmp(doc->children->name, "modem")) + logprintf(MLOG_FATAL, "Config file does not contain modem data\n"); + for (node = doc->children->children; node; node = node->next) { + if (!node->name || strcmp(node->name, "configuration")) + continue; + if (!configname) + break; + cfgname = xmlGetProp(node, "name"); + if (cfgname && !strcmp(cfgname, configname)) + break; + } + if (!node) + logprintf(MLOG_FATAL, "Configuartion not found\n"); + if (!node->children) + logprintf(MLOG_FATAL, "Configuration empty\n"); + err = parsecfg(doc, node->children, &state, &schedrr); + xmlFreeDoc(doc); + if (err) + exit(1); + /* + * lock memory down + */ +#ifdef HAVE_MLOCKALL + if (lockmem) { + if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1) + logerr(MLOG_ERROR, "mlockall"); + } +#endif /* HAVE_MLOCKALL */ +#ifdef HAVE_SCHED_H + if (schedrr) { + struct sched_param schp; + memset(&schp, 0, sizeof(schp)); + schp.sched_priority = sched_get_priority_min(SCHED_RR)+1; + if (sched_setscheduler(0, SCHED_RR, &schp) != 0) + logerr(MLOG_ERROR, "sched_setscheduler"); + } +#endif /* HAVE_SCHED_H */ + if (daemonize) { + uch = 0; + if (write(pfds[1], &uch, sizeof(uch)) != sizeof(uch)) + logerr(MLOG_ERROR, "write"); + close(pfds[1]); + } +} + +/* ---------------------------------------------------------------------- */ + +struct modulator *modchain = &afskmodulator; +struct demodulator *demodchain = &afskdemodulator; + +int main(int argc, char *argv[]) +{ + afskmodulator.next = &fskmodulator; + afskdemodulator.next = &fskdemodulator; + fskmodulator.next = &pammodulator; + fskdemodulator.next = &fskpspdemodulator; + fskpspdemodulator.next = &fskeqdemodulator; + fskeqdemodulator.next = &pamdemodulator; + pammodulator.next = &pskmodulator; + pamdemodulator.next = &pskdemodulator; + pskmodulator.next = &newqpskmodulator; + pskdemodulator.next = &newqpskdemodulator; + newqpskdemodulator.next = &p3ddemodulator; + ioinit_filein(); + ioinit_soundcard(); + ioinit_sim(); + parseopts(argc, argv); + pkttransmitloop(&state); + exit(0); +} diff --git a/soundcard/modem.h b/soundcard/modem.h new file mode 100644 index 0000000..b8c3a5f --- /dev/null +++ b/soundcard/modem.h @@ -0,0 +1,188 @@ +/*****************************************************************************/ + +/* + * modem.h -- Defines for the modem. + * + * Copyright (C) 1999-2000 Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please note that the GPL allows you to use the driver, NOT the radio. + * In order to use the radio, you need a license from the communications + * authority of your country. + * + */ + +/*****************************************************************************/ + +#ifndef _MODEM_H +#define _MODEM_H + +/* ---------------------------------------------------------------------- */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +/* ---------------------------------------------------------------------- */ + +/* + * Bittypes + */ + +#ifndef HAVE_SIGNED_BITTYPES + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) +typedef int int8_t __attribute__((__mode__(__QI__))); +typedef int int16_t __attribute__((__mode__(__HI__))); +typedef int int32_t __attribute__((__mode__(__SI__))); +typedef int int64_t __attribute__((__mode__(__DI__))); +#else +typedef char /* deduced */ int8_t __attribute__((__mode__(__QI__))); +typedef short /* deduced */ int16_t __attribute__((__mode__(__HI__))); +typedef long /* deduced */ int32_t __attribute__((__mode__(__SI__))); +typedef long long /* deduced */ int64_t __attribute__((__mode__(__DI__))); +#endif + +#endif /* !HAVE_SIGNED_BITTYPES */ + +#ifndef HAVE_UNSIGNED_BITTYPES + +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) +typedef unsigned int u_int8_t __attribute__((__mode__(__QI__))); +typedef unsigned int u_int16_t __attribute__((__mode__(__HI__))); +typedef unsigned int u_int32_t __attribute__((__mode__(__SI__))); +typedef unsigned int u_int64_t __attribute__((__mode__(__DI__))); +#else +typedef unsigned char /* deduced */ u_int8_t __attribute__((__mode__(__QI__))); +typedef unsigned short /* deduced */ u_int16_t __attribute__((__mode__(__HI__))); +typedef unsigned long /* deduced */ u_int32_t __attribute__((__mode__(__SI__))); +typedef unsigned long long /* deduced */ u_int64_t __attribute__((__mode__(__DI__))); +#endif + +#endif /* !HAVE_UNSIGNED_BITTYPES */ + +/* ---------------------------------------------------------------------- */ + +struct modemchannel; + +extern void audiowrite(struct modemchannel *chan, const int16_t *samples, unsigned int nr); +extern void audioread(struct modemchannel *chan, int16_t *samples, unsigned int nr, u_int16_t tim); +extern u_int16_t audiocurtime(struct modemchannel *chan); + +extern int pktget(struct modemchannel *chan, unsigned char *data, unsigned int len); +extern void pktput(struct modemchannel *chan, const unsigned char *data, unsigned int len); +extern void pktsetdcd(struct modemchannel *chan, int dcd); + +extern void p3dreceive(struct modemchannel *chan, const unsigned char *pkt, u_int16_t crc); +extern void p3drxstate(struct modemchannel *chan, unsigned int synced, unsigned int carrierfreq); + +#define MLOG_FATAL 0 +#define MLOG_ERROR 1 +#define MLOG_WARNING 2 +#define MLOG_NOTICE 3 +#define MLOG_INFO 4 +#define MLOG_DEBUG 5 + +extern void logvprintf(unsigned int level, const char *fmt, va_list args); +extern void logprintf(unsigned int level, const char *fmt, ...); +extern void logerr(unsigned int level, const char *st); +extern unsigned int log_verblevel; +extern inline int logcheck(unsigned int vl) +{ + return vl <= log_verblevel; +} + +#define MODEMPAR_STRING 0 +#define MODEMPAR_COMBO 1 +#define MODEMPAR_NUMERIC 2 +#define MODEMPAR_CHECKBUTTON 3 + +struct modemparams { + const char *name; + const char *label; + const char *tooltip; + const char *dflt; + unsigned int type; + union { + struct { + float min; + float max; + float step; + float pagestep; + } n; + struct { + const char *combostr[8]; + } c; + } u; +}; + +struct modulator { + struct modulator *next; + const char *name; + const struct modemparams *params; + void *(*config)(struct modemchannel *chan, unsigned int *samplerate, const char *params[]); + void (*init)(void *, unsigned int samplerate); + void (*modulate)(void *, unsigned int txdelay); + void (*free)(void *); +}; + +struct demodulator { + struct demodulator *next; + const char *name; + const struct modemparams *params; + void *(*config)(struct modemchannel *chan, unsigned int *samplerate, const char *params[]); + void (*init)(void *, unsigned int samplerate, unsigned int *bitrate); + void (*demodulate)(void *); + void (*free)(void *); +}; + +/* ---------------------------------------------------------------------- */ + +extern struct modulator afskmodulator; +extern struct demodulator afskdemodulator; + +extern struct modulator fskmodulator; +extern struct demodulator fskdemodulator; +extern struct demodulator fskpspdemodulator; +extern struct demodulator fskeqdemodulator; + +extern struct modulator pammodulator; +extern struct demodulator pamdemodulator; + +extern struct modulator pskmodulator; +extern struct demodulator pskdemodulator; + +extern struct modulator newqpskmodulator; +extern struct demodulator newqpskdemodulator; + +extern struct modulator p3dmodulator; +extern struct demodulator p3ddemodulator; + +/* ---------------------------------------------------------------------- */ + +#ifndef HAVE_VSNPRINTF +extern int vsnprintf(char *str, size_t n, char const *fmt, va_list args); +#endif + +#ifndef HAVE_SNPRINTF +extern int snprintf(char *str, size_t n, char const *fmt, ...) __attribute__ ((format (printf, 3, 4))); +#endif + +/* ---------------------------------------------------------------------- */ +#endif /* _MODEM_H */ diff --git a/soundcard/pktberr.c b/soundcard/pktberr.c new file mode 100644 index 0000000..b2d46ac --- /dev/null +++ b/soundcard/pktberr.c @@ -0,0 +1,218 @@ +/*****************************************************************************/ + +/* + * pktberr.c -- Simple "packet" generator that counts bit errors. + * + * Copyright (C) 1999-2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE +#define _REENTRANT + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "soundio.h" + +#include +#include +#include +#include +#include + +/* ---------------------------------------------------------------------- */ + +extern void iosetsnr(struct state *state, float snr); + +#define TXDELAYBITS 5000 +#define TXTAILBITS 5000 + +static struct simstate { + unsigned int terminate; + float snr, snrend, snrstep; + unsigned int nrbits, txcnt, rxcnt, rxerr; + unsigned int rxshreg, txshreg; +} simstate = { + 0, 30, -2, 6, 100000, 0, 0, 0, 0, 1 +}; + +static RETSIGTYPE sigterm() +{ + simstate.terminate = 1; +} + +struct modemparams pktmkissparams[] = { + { NULL } +}; + +struct modemparams pktkissparams[] = { + { "snrstart", "SNR Start", "SNR start value", "30", MODEMPAR_NUMERIC, { n: { 0, 100, 1, 10 } } }, + { "snrend", "SNR End", "SNR end value", "5", MODEMPAR_NUMERIC, { n: { 0, 100, 1, 10 } } }, + { "snrstep", "SNR Step", "SNR increment/decrement", "-2", MODEMPAR_NUMERIC, { n: { -100, 100, 1, 10 } } }, + { "bits", "Simulation Bits", "Number of Bits for Simulation", "10000", MODEMPAR_NUMERIC, { n: { 10, 1000000000, 10000, 1000000 } } }, + { NULL } +}; + +void pktinit(struct modemchannel *chan, const char *params[]) +{ + if (params[0]) + simstate.snr = strtod(params[0], NULL); + if (params[1]) + simstate.snrend = strtod(params[1], NULL); + if (params[2]) + simstate.snrstep = strtod(params[2], NULL); + if (params[3]) + simstate.nrbits = strtoul(params[3], NULL, 0); +} + +void pktinitmkiss(struct modemchannel *chan, const char *params[]) +{ + pktinit(chan, params); +} + +#define DESCRAM10_TAPSH1 0 +#define DESCRAM10_TAPSH2 7 +#define DESCRAM10_TAPSH3 10 + +#define SCRAM10_TAP1 1 +#define SCRAM10_TAPN ((1<> 1) & 0x55); + res = (res & 0x33) + ((res >> 2) & 0x33); + return (res & 0x0F) + ((res >> 4) & 0x0F); +} + +int pktget(struct modemchannel *chan, unsigned char *data, unsigned int len) +{ + unsigned int mask1, mask2, i, j; + + if (simstate.rxcnt >= simstate.nrbits || + simstate.txcnt >= simstate.nrbits+TXDELAYBITS+TXTAILBITS) + return 0; + for (i = 0; i < len; i++, data++) { + for (j = 0, mask1 = SCRAM10_TAP1, mask2 = SCRAM10_TAPN; j < 8; j++, mask1 <<= 1, mask2 <<= 1) + if (simstate.txshreg & mask1) + simstate.txshreg ^= mask2; + data[0] = simstate.txshreg; + simstate.txshreg >>= 8; + simstate.txcnt += 8; + if (!(simstate.txcnt & 1023)) { + fprintf(stderr, "%7u %7u %7u\r", simstate.txcnt, simstate.rxcnt, simstate.rxerr); + fflush(stderr); + } + } + return simstate.terminate ? 0 : len; +} + +void pktput(struct modemchannel *chan, const unsigned char *data, unsigned int len) +{ + unsigned int i, j; + + for (i = 0; i < len; i++, data++) { + if (simstate.rxcnt >= simstate.nrbits) + return; + simstate.rxshreg |= ((unsigned int)data[0]) << DESCRAM10_TAPSH3; + j = ((simstate.rxshreg >> DESCRAM10_TAPSH1) ^ + (simstate.rxshreg >> DESCRAM10_TAPSH2) ^ + (simstate.rxshreg >> DESCRAM10_TAPSH3)) & 0xff; + simstate.rxshreg >>= 8; + if (simstate.txcnt < TXDELAYBITS) + continue; + simstate.rxcnt += 8; + if (j) + simstate.rxerr += hweight8(j); + } +} + +void pkttransmitloop(struct state *state) +{ + struct modemchannel *chan; + unsigned int nrtx; + time_t tstart, tend; + +#ifndef WIN32 + signal(SIGHUP, sigterm); +#endif + pttsetptt(&state->ptt, 1); + simstate.rxcnt = simstate.rxerr = simstate.txcnt = 0; + iosetsnr(state, simstate.snr); + logprintf(MLOG_INFO, "Simulation: SNR range %.3f...%.3f step %.3f bits %u\n", + simstate.snr, simstate.snrend, simstate.snrstep, simstate.nrbits); + printf("%% Simulation: SNR range %.3f...%.3f step %.3f bits %u\n" + "%% snr nrbits txcnt rxcnt rxerr\n" + "result = [\n", + simstate.snr, simstate.snrend, simstate.snrstep, simstate.nrbits); + time(&tstart); + while (!simstate.terminate) { + if (simstate.rxcnt >= simstate.nrbits || + simstate.txcnt >= simstate.nrbits+TXDELAYBITS+TXTAILBITS) { + printf(" %10.5f %7u %7u %7u %7u\n", + simstate.snr, simstate.nrbits, simstate.txcnt, simstate.rxcnt, simstate.rxerr); + fflush(stdout); + simstate.snr += simstate.snrstep; + simstate.rxcnt = simstate.rxerr = simstate.txcnt = 0; + if (simstate.snrstep < 0) { + if (simstate.snr < simstate.snrend) + break; + } else { + if (simstate.snr > simstate.snrend) + break; + } + iosetsnr(state, simstate.snr); + } + nrtx = 0; + for (chan = state->channels; chan; chan = chan->next) + if (chan->mod) { + chan->mod->modulate(chan->modstate, 0); + nrtx++; + } + if (!nrtx) + break; + } + time(&tend); + printf("]\n" + "%% simulation time: %lu seconds\n" + "semilogy(result(:,1),result(:,5)/3/result(:,4));\n", (long unsigned int)(tend-tstart)); + pttsetptt(&state->ptt, 0); +} + +void pktsetdcd(struct modemchannel *chan, int dcd) +{ + pttsetdcd(&chan->state->ptt, dcd); +} + +void pktrelease(struct modemchannel *chan) +{ +} + +void p3dreceive(struct modemchannel *chan, const unsigned char *pkt, u_int16_t crc) +{ +} + +void p3drxstate(struct modemchannel *chan, unsigned int synced, unsigned int carrierfreq) +{ + pktsetdcd(chan, !!synced); +} + +/* ---------------------------------------------------------------------- */ diff --git a/soundcard/pktsimple.c b/soundcard/pktsimple.c new file mode 100644 index 0000000..a545dee --- /dev/null +++ b/soundcard/pktsimple.c @@ -0,0 +1,147 @@ +/*****************************************************************************/ + +/* + * pktsimple.c -- Simple packet generator/sink. + * + * Copyright (C) 1999-2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE +#define _REENTRANT + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "soundio.h" + +#include +#include +#include +#include +#include + +/* ---------------------------------------------------------------------- */ + +static unsigned int terminate = 0; + +static RETSIGTYPE sigterm() +{ + terminate = 1; +} + +struct modemparams pktmkissparams[] = { + { NULL } +}; + +struct modemparams pktkissparams[] = { + { NULL } +}; + +void pktinit(struct modemchannel *chan, const char *params[]) +{ + return; +} + +void pktinitmkiss(struct modemchannel *chan, const char *params[]) +{ + return; +} + +int pktget(struct modemchannel *chan, unsigned char *data, unsigned int len) +{ + static unsigned int pktnr = 0; + unsigned int i; + +#if 0 + memset(data, 0x55, len); + return terminate ? 0 : len; +#endif + if (len < 5) { + for (i = 0; i < len; i++) + data[i] = '@' + i; + return terminate ? 0 : len; + } + snprintf(data, len, "%04X", pktnr); + pktnr = (pktnr + 1) & 0xffff; + for (i = 4; i < len; i++) + data[i] = '@' - 4 + i; + return terminate ? 0 : len; +} + +void pktput(struct modemchannel *chan, const unsigned char *data, unsigned int len) +{ + unsigned int i; + + fprintf(stderr, "Data: "); + for (i = 0; i < len; i++) +#if 1 + if (data[i] >= ' ' && data[i] <= 0x7f) + putc(data[i], stderr); + else + putc('.', stderr); +#else + fprintf(stderr, "%02x", data[i]); +#endif + fprintf(stderr, "\n"); +} + +void pkttransmitloop(struct state *state) +{ + struct modemchannel *chan; + unsigned int nrtx; + +#ifndef WIN32 + signal(SIGHUP, sigterm); +#endif + pttsetptt(&state->ptt, 1); + while (!terminate) { + nrtx = 0; + for (chan = state->channels; chan; chan = chan->next) + if (chan->mod) { + chan->mod->modulate(chan->modstate, 0); + nrtx++; + } + if (!nrtx) + break; + } + pttsetptt(&state->ptt, 0); +} + +void pktsetdcd(struct modemchannel *chan, int dcd) +{ + pttsetdcd(&chan->state->ptt, dcd); +} + +void pktrelease(struct modemchannel *chan) +{ +} + +void p3dreceive(struct modemchannel *chan, const unsigned char *pkt, u_int16_t crc) +{ +} + +void p3drxstate(struct modemchannel *chan, unsigned int synced, unsigned int carrierfreq) +{ + pktsetdcd(chan, !!synced); +} + +/* ---------------------------------------------------------------------- */ diff --git a/soundcard/ppdev.h b/soundcard/ppdev.h new file mode 100644 index 0000000..976374a --- /dev/null +++ b/soundcard/ppdev.h @@ -0,0 +1,74 @@ +/* + * linux/drivers/char/ppdev.h + * + * User-space parallel port device driver (header file). + * + * Copyright (C) 1998-9 Tim Waugh + * + * 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. + * + */ + +#define PP_MAJOR 99 + +#define PP_IOCTL 'p' + +/* Set mode for read/write (e.g. IEEE1284_MODE_EPP) */ +#define PPSETMODE _IOW(PP_IOCTL, 0x80, int) + +/* Read status */ +#define PPRSTATUS _IOR(PP_IOCTL, 0x81, unsigned char) +#define PPWSTATUS OBSOLETE__IOW(PP_IOCTL, 0x82, unsigned char) + +/* Read/write control */ +#define PPRCONTROL _IOR(PP_IOCTL, 0x83, unsigned char) +#define PPWCONTROL _IOW(PP_IOCTL, 0x84, unsigned char) + +struct ppdev_frob_struct { + unsigned char mask; + unsigned char val; +}; +#define PPFCONTROL _IOW(PP_IOCTL, 0x8e, struct ppdev_frob_struct) + +/* Read/write data */ +#define PPRDATA _IOR(PP_IOCTL, 0x85, unsigned char) +#define PPWDATA _IOW(PP_IOCTL, 0x86, unsigned char) + +/* Read/write econtrol (not used) */ +#define PPRECONTROL OBSOLETE__IOR(PP_IOCTL, 0x87, unsigned char) +#define PPWECONTROL OBSOLETE__IOW(PP_IOCTL, 0x88, unsigned char) + +/* Read/write FIFO (not used) */ +#define PPRFIFO OBSOLETE__IOR(PP_IOCTL, 0x89, unsigned char) +#define PPWFIFO OBSOLETE__IOW(PP_IOCTL, 0x8a, unsigned char) + +/* Claim the port to start using it */ +#define PPCLAIM _IO(PP_IOCTL, 0x8b) + +/* Release the port when you aren't using it */ +#define PPRELEASE _IO(PP_IOCTL, 0x8c) + +/* Yield the port (release it if another driver is waiting, + * then reclaim) */ +#define PPYIELD _IO(PP_IOCTL, 0x8d) + +/* Register device exclusively (must be before PPCLAIM). */ +#define PPEXCL _IO(PP_IOCTL, 0x8f) + +/* Data line direction: non-zero for input mode. */ +#define PPDATADIR _IOW(PP_IOCTL, 0x90, int) + +/* Negotiate a particular IEEE 1284 mode. */ +#define PPNEGOT _IOW(PP_IOCTL, 0x91, int) + +/* Set control lines when an interrupt occurs. */ +#define PPWCTLONIRQ _IOW(PP_IOCTL, 0x92, unsigned char) + +/* Clear (and return) interrupt count. */ +#define PPCLRIRQ _IOR(PP_IOCTL, 0x93, int) + +/* Set the IEEE 1284 phase that we're in (e.g. IEEE1284_PH_FWD_IDLE) */ +#define PPSETPHASE _IOW(PP_IOCTL, 0x94, int) diff --git a/soundcard/ptt.c b/soundcard/ptt.c new file mode 100644 index 0000000..88e25aa --- /dev/null +++ b/soundcard/ptt.c @@ -0,0 +1,385 @@ +/*****************************************************************************/ + +/* + * ptt.c -- PTT signalling. + * + * Copyright (C) 1999-2000, 2002 + * Thomas Sailer (t.sailer@alumni.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Support for CM108 GPIO control of PTT by Andrew Errington ZL3AME May 2011 + * CM108/Hidraw detection by Thomas Sailer + * + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE +#define _REENTRANT + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "modem.h" +#include "pttio.h" + +#include +#include +#include +#include +#include +#include +#include + +#include + + +#ifdef HAVE_SYS_IOCCOM_H +#include +#endif + +#ifdef HAVE_LINUX_PPDEV_H +#include +#else +#include "ppdev.h" +#endif + +#if defined HAVE_STRING_H +# include +#else +# include +#endif + +#ifdef HAVE_LINUX_HIDRAW_H +#include +#endif + +/* ---------------------------------------------------------------------- */ +struct modemparams pttparams[] = { + { "file", "PTT Driver", "Path name of the serial, parallel or USB HID port for outputting PTT", "none", MODEMPAR_COMBO, + { c: { { "none", "/dev/ttyS0", "/dev/ttyS1", "/dev/parport0", "/dev/parport1","/dev/hidraw0","/dev/hidraw1" } } } }, +#ifdef HAVE_LINUX_HIDRAW_H + { "gpio", "GPIO", "GPIO bit number on CM108 or compatible USB sound card", "0", MODEMPAR_COMBO, + { c: {{ "0","1","2","3","4","5","6","7"}}}}, +#endif +#ifdef HAVE_LIBHAMLIB + { "hamlib_model", "Hamlib model", "Model number", "", MODEMPAR_STRING }, + { "hamlib_params", "Rig configuration params", "Rig configuration params", "", MODEMPAR_STRING }, +#endif + + { NULL } +}; + +/* ---------------------------------------------------------------------- */ + +int pttinit(struct pttio *state, const char *params[]) +{ + const char *path = params[0]; + int fd; + unsigned char x; + unsigned int y = 0; +#ifdef HAVE_LINUX_HIDRAW_H + struct hidraw_devinfo hiddevinfo; + const char *gpio_pin = params[1]; +#define PAR_HAMLIBMODEL 2 +#define PAR_HAMLIBPARAMS 3 +#else +#define PAR_HAMLIBMODEL 1 +#define PAR_HAMLIBPARAMS 2 +#endif + + state->mode = noport; + state->gpio = 0; + if (!path || !path[0] || !strcasecmp(path, "none")) + return 0; +#ifdef HAVE_LIBHAMLIB + const char *hamlib_model = params[PAR_HAMLIBMODEL]; + if (hamlib_model && hamlib_model[0]) { + int my_rig_error = ~RIG_OK; + char *hamlib_params = params[PAR_HAMLIBPARAMS] ? strdup(params[3]) : NULL; + int rig_modl ; + char *ptr_key = hamlib_params; + + logprintf(MLOG_INFO, "Hamlib: pttinit: path=%s model=%s params=%s\n", + path ? path : "NULL", + hamlib_model ? hamlib_model : "NULL", + hamlib_params ? hamlib_params : "NULL"); + if (1 != sscanf(hamlib_model, "%d", &rig_modl)) { + logprintf(MLOG_ERROR, "Hamlib: Invalid model:\"%s\"\n", hamlib_model); + goto the_end; + } + state->mode = hamlibport; + state->u.rig_ptr = rig_init(rig_modl); + if(state->u.rig_ptr == NULL) { + logprintf(MLOG_ERROR, "Hamlib: rig_init model=%dn", rig_modl); + goto the_end; + } + strncpy(state->u.rig_ptr->state.rigport.pathname, path, FILPATHLEN); + + logprintf(MLOG_INFO, "Hamlib: pttinit parsing %s\n", ptr_key ? ptr_key : "NULL" ); + + while (ptr_key && *ptr_key != '\0') { + char * ptr_val = strchr(ptr_key, '='); + if (ptr_val) { + *ptr_val++ = '\0'; + } + + char * ptr_key_next = ptr_val ? strchr(ptr_val, ',') : NULL ; + if (ptr_key_next) { + *ptr_key_next++ = '\0'; + } + my_rig_error = rig_set_conf(state->u.rig_ptr, + rig_token_lookup(state->u.rig_ptr, ptr_key), ptr_val); + if (my_rig_error != RIG_OK) { + logprintf(MLOG_ERROR, + "Hamlib: rig_set_conf: %s=%s : %s\n", + ptr_key ? ptr_key : NULL, + ptr_val ? ptr_val : NULL, + rigerror(my_rig_error)); + goto the_end; + } + ptr_key = ptr_key_next; + } + my_rig_error = rig_open(state->u.rig_ptr); + if (RIG_OK != my_rig_error) { + logprintf(MLOG_ERROR, "Hamlib: rig_open: %s\n", rigerror(my_rig_error)); + goto the_end; + } + pttsetptt(state, 0); + pttsetdcd(state, 0); + my_rig_error = RIG_OK; + the_end: + free(hamlib_params); + return my_rig_error == RIG_OK ? 0 : -1 ; + } +#endif + + logprintf(MLOG_INFO, "Opening PTT device \"%s\"\n", path); + if ((fd = open(path, O_RDWR, 0)) < 0) { + logprintf(MLOG_ERROR, "Cannot open PTT device \"%s\"\n", path); + return -1; + } + if (!ioctl(fd, TIOCMBIC, &y)) { + state->u.fd = fd; + state->mode = serport; + } else if (!ioctl(fd, PPCLAIM, 0) && !ioctl(fd, PPRDATA, &x)) { + state->u.fd = fd; + state->mode = parport; +#ifdef HAVE_LINUX_HIDRAW_H + } else if (!ioctl(fd, HIDIOCGRAWINFO, &hiddevinfo) && hiddevinfo.vendor == 0x0d8c + && hiddevinfo.product >= 0x0008 && hiddevinfo.product <= 0x000f) { + state->u.fd = fd; + state->mode = cm108; + state->gpio = strtoul(gpio_pin, NULL, 0); + logprintf(MLOG_INFO, "pttinit gpio bit number %d\n", state->gpio); +#endif + } else { + logprintf(MLOG_ERROR, "Device \"%s\" neither parport nor serport nor CM108\n", path); + close(fd); + return -1; + } + pttsetptt(state, 0); + pttsetdcd(state, 0); + return 0; +} + +void pttsetptt(struct pttio *state, int pttx) +{ + unsigned char reg; + + if (!state) + return; + state->ptt = !!pttx; + switch (state->mode) { +#ifdef HAVE_LIBHAMLIB + case hamlibport: + { + if (!state->u.rig_ptr) + return; + logprintf(MLOG_INFO, "Hamlib: pttsetptt state=%d\n", state->ptt); + ptt_t my_ptt ; + int my_rig_error; + if (state->ptt) + my_ptt = RIG_PTT_ON; + else + my_ptt = RIG_PTT_OFF; + my_rig_error = rig_set_ptt(state->u.rig_ptr, RIG_VFO_CURR, my_ptt); + if(RIG_OK != my_rig_error) { + logprintf(MLOG_ERROR, "Hamlib: rig_set_ptt %s\n", rigerror(my_rig_error) ); + } + return; + } +#endif + + case serport: + { + if (state->u.fd == -1) + return; +#if 0 + unsigned int y = TIOCM_RTS; + ioctl(state->u.fd, state->ptt ? TIOCMBIS : TIOCMBIC, &y); +#else + unsigned int y; + ioctl(state->u.fd, TIOCMGET, &y); + if (state->ptt) + y |= TIOCM_RTS; + else + y &= ~TIOCM_RTS; + ioctl(state->u.fd, TIOCMSET, &y); +#endif + return; + } + + case parport: + { + if (state->u.fd == -1) + return; + reg = state->ptt | (state->dcd << 1); + ioctl(state->u.fd, PPWDATA, ®); + return; + } + +#ifdef HAVE_LINUX_HIDRAW_H + case cm108: + { + // Build two packets for CM108 HID. One turns a GPIO bit on. The other turns it off. + // Packet is 4 bytes, preceded by a 'report number' byte + // 0x00 report number + // Write data packet (from CM108 documentation) + // byte 0: 00xx xxxx Write GPIO + // byte 1: xxxx dcba GPIO3-0 output values (1=high) + // byte 2: xxxx dcba GPIO3-0 data-direction register (1=output) + // byte 3: xxxx xxxx SPDIF + + char out_rep[] = { + 0x00, // report number + // HID output report + 0x00, + state->ptt ? (1 << (state->gpio)) : 0, // set GPIO + 1 << (state->gpio), // Data direction register (1=output) + 0x00 + }; + ssize_t nw; + + if (state->u.fd == -1) + return; + logprintf(MLOG_INFO, "pttsetptt gpio=%d\n", state->gpio); + /* Can't do anything with DCD */ + logprintf(MLOG_INFO, "sm_CM108: pttsetptt state=%d\n", state->ptt); + nw = write(state->u.fd, out_rep, sizeof(out_rep)); + if (nw < 0) { + logprintf(MLOG_ERROR, "sm_CM108: write error\n"); + } + return; + } +#endif + + default: + return; + } +} + +void pttsetdcd(struct pttio *state, int dcd) +{ + unsigned char reg; + + if (!state) + return; + state->dcd = !!dcd; + switch (state->mode) { +#ifdef HAVE_LIBHAMLIB + /* For Hamlib, it does not make sense to set DCD. */ + case hamlibport: + return; +#endif + + case serport: + { + if (state->u.fd == -1) + return; +#if 0 + unsigned int y = TIOCM_DTR; + ioctl(state->u.fd, state->dcd ? TIOCMBIS : TIOCMBIC, &y); +#else + unsigned int y; + ioctl(state->u.fd, TIOCMGET, &y); + if (state->dcd) + y |= TIOCM_DTR; + else + y &= ~TIOCM_DTR; + ioctl(state->u.fd, TIOCMSET, &y); +#endif + return; + } + + case parport: + { + if (state->u.fd == -1) + return; + reg = state->ptt | (state->dcd << 1); + ioctl(state->u.fd, PPWDATA, ®); + return; + } + +#ifdef HAVE_LINUX_HIDRAW_H + case cm108: + { + /* For CM108 it does not make sense to set DCD */ + return; + } +#endif + + default: + return; + } +} + +void pttrelease(struct pttio *state) +{ + if (!state) + return; + pttsetptt(state, 0); + pttsetdcd(state, 0); + switch (state->mode) { +#ifdef HAVE_LIBHAMLIB + case hamlibport: + { + logprintf(MLOG_INFO, "Hamlib: pttrelease\n"); + int my_rig_error; + my_rig_error = rig_close(state->u.rig_ptr); + if(RIG_OK != my_rig_error) { + logprintf(MLOG_ERROR, "Hamlib: rig_close: %s\n", rigerror(my_rig_error) ); + } + my_rig_error = rig_cleanup(state->u.rig_ptr); + if(RIG_OK != my_rig_error) { + logprintf(MLOG_ERROR, "Hamlib: rig_cleanup: %s\n", rigerror(my_rig_error) ); + } + break; + } +#endif + + case serport: + case parport: + case cm108: + close(state->u.fd); + break; + + default: + break; + } + state->mode = noport; +} diff --git a/soundcard/pttio.h b/soundcard/pttio.h new file mode 100644 index 0000000..7bc83d6 --- /dev/null +++ b/soundcard/pttio.h @@ -0,0 +1,81 @@ +/*****************************************************************************/ + +/* + * pttio.h -- Internal PTT input/output data structures and routines. + * + * Copyright (C) 2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +/*****************************************************************************/ + +#ifndef _PTTIO_H +#define _PTTIO_H + +/* ---------------------------------------------------------------------- */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifdef WIN32 +#include +#endif + +/* ---------------------------------------------------------------------- */ + +#ifdef WIN32 + +struct pttio { + HANDLE h; + unsigned int ptt; + unsigned int dcd; +}; + +#else + +#ifdef HAVE_LIBHAMLIB +#include +#endif + +struct pttio { + enum { noport, serport, parport, hamlibport, cm108 } mode; + unsigned int ptt; + unsigned int dcd; + unsigned int gpio; + + union { + int fd; +#ifdef HAVE_LIBHAMLIB + RIG *rig_ptr; +#endif + } u; +}; + +#endif + +/* ---------------------------------------------------------------------- */ + +extern struct modemparams pttparams[]; +extern int pttinit(struct pttio *state, const char *params[]); +extern void pttsetptt(struct pttio *state, int pttx); +extern void pttsetdcd(struct pttio *state, int dcd); +extern void pttrelease(struct pttio *state); + +/* ---------------------------------------------------------------------- */ +#endif /* _PTTIO_H */ diff --git a/soundcard/simd.c b/soundcard/simd.c new file mode 100644 index 0000000..66d686d --- /dev/null +++ b/soundcard/simd.c @@ -0,0 +1,98 @@ +/*****************************************************************************/ + +/* + * simd.c -- SIMD (aka MMX and VIS) routines. + * + * Copyright (C) 1999 Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please note that the GPL allows you to use the driver, NOT the radio. + * In order to use the radio, you need a license from the communications + * authority of your country. + * + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE +#define _REENTRANT + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif + +#include "modem.h" + +/* ---------------------------------------------------------------------- */ + +#if defined(USEMMX) + +unsigned int simd_enabled = 0; + +static inline unsigned int cpucapability(void) +{ + unsigned int a, b, c, d; + + asm("pushfl \n\t" + "popl %0 \n\t" + "movl %0,%1 \n\t" + "xorl $0x00200000,%0 \n\t" + "pushl %0 \n\t" + "popfl \n\t" + "pushfl \n\t" + "popl %0 \n\t" + : "=r" (a), "=r" (b)); + if (a == b) + return 0; + asm("cpuid" : "=a" (a), "=b" (b), "=c" (c), "=d" (d) : "0" (1)); + return d; +} + +void initsimd(int enable) +{ + unsigned int cap = cpucapability(); + + simd_enabled = (enable && (cap & 0x800000)) ? 1 : 0; + logprintf(3, "x86 CPU capability %08x, MMX %s%sabled\n", cap, enable ? "" : "manually ", + simd_enabled ? "en" : "dis"); +} + +#elif defined(USEVIS) + +unsigned int simd_enabled = 0; + +void initsimd(int enable) +{ + simd_enabled = !!enable; + logprintf(3, "VIS %sabled\n", simd_enabled ? "en" : "dis"); +} + +#endif diff --git a/soundcard/simd.h b/soundcard/simd.h new file mode 100644 index 0000000..6b6ab3b --- /dev/null +++ b/soundcard/simd.h @@ -0,0 +1,169 @@ +/*****************************************************************************/ + +/* + * simd.h -- SIMD filter procedures (aka MMX, VIS, etc). + * + * Copyright (C) 1999-2000 Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please note that the GPL allows you to use the driver, NOT the radio. + * In order to use the radio, you need a license from the communications + * authority of your country. + * + */ + +/*****************************************************************************/ + +#ifndef _SIMD_H +#define _SIMD_H + +/* ---------------------------------------------------------------------- */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "modem.h" + +/* ---------------------------------------------------------------------- */ + +/* + * SIMD stuff + */ + +#if !defined(__i386__) +#undef USEMMX +#endif + +#if !defined(__sparc__) && !defined(__sparc64__) +#undef USEVIS +#endif + +#if !defined(USEMMX) && !defined(USEVIS) + +extern inline void initsimd(int enable) +{ +} + +extern inline int checksimd(void) +{ + return 0; +} + +extern inline int simdfir16(const int16_t *p1, const int16_t *p2, unsigned int nr) +{ + int s = 0; + + for (; nr > 0; nr--, p1++, p2++) + s += (*p1) * (*p2); + return s; +} + +extern inline void simdpreparefpu(void) +{ +} + +#else + +extern unsigned int simd_enabled; + +extern void initsimd(int enable); + +extern inline int checksimd(void) +{ + return simd_enabled; +} + +#if defined(USEMMX) + +#define MMXCLOBBER "st", "st(1)", "st(2)", "st(3)", "st(4)", "st(5)", "st(6)", "st(7)" + +extern inline int simdfir16(const int16_t *p1, const int16_t *p2, unsigned int nr) +{ + unsigned int i, j; + int s = 0; + + if (checksimd()) { + j = nr >> 2; + nr &= 3; + asm volatile("pxor\t%%mm0,%%mm0" : : : MMXCLOBBER); + for (i = 0; i < j; i++, p1 += 4, p2 += 4) + asm volatile("\n\tmovq\t%0,%%mm1" + "\n\tpmaddwd\t%1,%%mm1" + "\n\tpaddd\t%%mm1,%%mm0" : : "m" (*p1), "m" (*p2) : MMXCLOBBER); + asm volatile("\n\tmovq\t%%mm0,%%mm1 " + "\n\tpunpckhdq\t%%mm1,%%mm1" + "\n\tpaddd\t%%mm1,%%mm0" + "\n\tmovd\t%%mm0,%0" : "=m" (s) : : MMXCLOBBER); + } + for (; nr > 0; nr--, p1++, p2++) + s += (*p1) * (*p2); + return s; +} + +extern inline void simdpreparefpu(void) +{ + if (checksimd()) + asm volatile("emms"); +} + +#elif defined(USEVIS) + +/*extern inline*/static int simdfir16(const int16_t *p1, const int16_t *p2, unsigned int nr) +{ + double dsum1, dsum2, dsum3, dsum4, arg1, arg2, arg3, arg4; + float sum, sum1, sum2; + unsigned int i, j; + int s = 0, sx[1]; + + if (checksimd()) { + j = nr >> 1; + nr &= 1; + asm("fzeros %0" : "=f" (sum)); + for (i = 0; i < j; i++) { + asm volatile("ldda [%2] 0xd2, %0 ! ASI_FL16_P \n\t" + "ldda [%3] 0xd2, %1 ! ASI_FL16_P \n\t": "=e" (arg1), "=e" (arg2) : "r" (p1), "r" (p2)); + p1++; p2++; + asm volatile("ldda [%2] 0xd2, %0 ! ASI_FL16_P \n\t" + "ldda [%3] 0xd2, %1 ! ASI_FL16_P \n\t": "=e" (arg3), "=e" (arg4) : "r" (p1), "r" (p2)); + p1++; p2++; + asm volatile("fmuld8sux16 %L2,%L3,%0 \n\t" + "fmuld8ulx16 %L2,%L3,%1 \n\t" : "=&e" (dsum1), "=&e" (dsum2) : "e" (arg1), "e" (arg2)); + asm volatile("fmuld8sux16 %L2,%L3,%0 \n\t" + "fmuld8ulx16 %L2,%L3,%1 \n\t" : "=&e" (dsum3), "=&e" (dsum4) : "e" (arg3), "e" (arg4)); + asm volatile("fpadd32s %L1,%L2,%0" : "=f" (sum1) : "e" (dsum1), "e" (dsum2)); + asm volatile("fpadd32s %L1,%L2,%0" : "=f" (sum2) : "e" (dsum3), "e" (dsum4)); + asm volatile("fpadd32s %1,%2,%0" : "=f" (sum) : "f" (sum1), "f" (sum)); + asm volatile("fpadd32s %1,%2,%0" : "=f" (sum) : "f" (sum2), "f" (sum)); + }; + asm("st %1,%0" : "=m" (sx) : "f" (sum)); + s = sx[0]; + } + for (; nr > 0; nr--, p1++, p2++) + s += (*p1) * (*p2); + return s; +} + +extern inline void simdpreparefpu(void) +{ +} + +#endif + +#endif + +/* ---------------------------------------------------------------------- */ +#endif /* _SIMD_H */ diff --git a/soundcard/snprintpkt.c b/soundcard/snprintpkt.c new file mode 100644 index 0000000..057e417 --- /dev/null +++ b/soundcard/snprintpkt.c @@ -0,0 +1,299 @@ +/*****************************************************************************/ + +/* + * snprintpkt.c -- Print an AX.25 packet (with header) into a buffer. + * + * Copyright (C) 1999 Thomas Sailer (sailer@ife.ee.ethz.ch) + * Swiss Federal Institute of Technology (ETH), Electronics Lab + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + * This is the Linux realtime sound output driver + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE +#define _REENTRANT +#include +#include +#include +#include + +#include "modem.h" + +/* --------------------------------------------------------------------- */ + +#define ADDCH(c) \ +do { \ + if (p + 1 >= endp) \ + return -1; \ + *p++ = (c); \ +} while(0) + +#define ADDSTR(s) \ +do { \ + int l = strlen(s); \ + if (p + l >= endp) \ + return -1; \ + memcpy(p, s, l); \ + p += l; \ +} while(0) + +#ifdef HAVE_SNPRINTF + +#define ADDF(fmt, args...) \ +do { \ + int xlen = snprintf(p, endp-p, fmt, ## args); \ + if (xlen < 0) \ + return -1; \ + p += xlen; \ +} while(0) + +#else /* HAVE_SNPRINTF */ + +#define ADDF(fmt, args...) \ +do { \ + char xbuf[64]; \ + int xlen = sprintf(xbuf, fmt, ## args); \ + if (p + xlen >= endp) \ + return -1; \ + memcpy(p, xbuf, xlen); \ + p += xlen; \ +} while(0) + +#endif /* HAVE_SNPRINTF */ + +static int hextoint(const u_int8_t *p, unsigned int l) +{ + char buf[16], *e; + unsigned int r; + + memcpy(buf, p, l); + buf[l] = 0; + r = strtoul(buf, &e, 16); + if (*e) + return -1; + return r; +} + +int snprintpkt(char *buf, size_t sz, const u_int8_t *pkt, unsigned int len) +{ + static const u_int8_t dp0ais_str[6] = { 'D' << 1, 'P' << 1, '0' << 1, 'A' << 1, 'I' << 1, 'S' << 1 }; + static const u_int8_t data1_str[6] = { 'D' << 1, 'A' << 1, 'T' << 1, 'A' << 1, '1' << 1, ' ' << 1 }; + u_int8_t v1 = 1, cmd = 0, dp0ais = 1, data1 = 1; + u_int8_t i, j; + char *p = buf; + char *endp = buf + sz; + const u_int8_t *pkt1; + unsigned int len1; + + if (sz < 2) + return -1; + *buf = 0; + if (!pkt || len < 8) + return 0; + if (pkt[1] & 1) { + /* + * FlexNet Header Compression + */ + v1 = 0; + cmd = (pkt[1] & 2) != 0; + ADDSTR("fm ? to "); + i = (pkt[2] >> 2) & 0x3f; + if (i) { + ADDCH(i+0x20); + } + i = ((pkt[2] << 4) | ((pkt[3] >> 4) & 0xf)) & 0x3f; + if (i) { + ADDCH(i+0x20); + } + i = ((pkt[3] << 2) | ((pkt[4] >> 6) & 3)) & 0x3f; + if (i) { + ADDCH(i+0x20); + } + i = pkt[4] & 0x3f; + if (i) { + ADDCH(i+0x20); + } + i = (pkt[5] >> 2) & 0x3f; + if (i) { + ADDCH(i+0x20); + } + i = ((pkt[5] << 4) | ((pkt[6] >> 4) & 0xf)) & 0x3f; + if (i) { + ADDCH(i+0x20); + } + ADDF("-%u QSO Nr %u", pkt[6] & 0xf, (pkt[0] << 6) | (pkt[1] >> 2)); + pkt += 7; + len -= 7; + dp0ais = 0; + } else { + /* + * normal header + */ + if (len < 15) + return 0; + if ((pkt[6] & 0x80) != (pkt[13] & 0x80)) { + v1 = 0; + cmd = (pkt[6] & 0x80); + } + ADDSTR("fm "); + for(i = 7; i < 13; i++) { + if ((pkt[i] &0xfe) != 0x40) { + ADDCH(pkt[i] >> 1); + } + if ((pkt[i] &0xfe) != dp0ais_str[i-7]) + dp0ais = 0; + } + ADDF("-%u to ", (pkt[13] >> 1) & 0xf); + for(i = 0; i < 6; i++) { + if ((pkt[i] &0xfe) != 0x40) { + ADDCH(pkt[i] >> 1); + } + if ((pkt[i] &0xfe) != data1_str[i]) + data1 = 0; + } + ADDF("-%u", (pkt[6] >> 1) & 0xf); + pkt += 14; + len -= 14; + if (!dp0ais) { + if ((!(pkt[-1] & 1)) && (len >= 7)) { + ADDSTR(" via "); + } + while ((!(pkt[-1] & 1)) && (len >= 7)) { + for(i = 0; i < 6; i++) + if ((pkt[i] &0xfe) != 0x40) { + ADDCH(pkt[i] >> 1); + } + ADDF("-%u", (pkt[6] >> 1) & 0xf); + pkt += 7; + len -= 7; + if ((!(pkt[-1] & 1)) && (len >= 7)) { + ADDCH(','); + } + } + } + } + if (!len) { + *p = 0; + return p - buf; + } + i = *pkt++; + len--; + j = v1 ? ((i & 0x10) ? '!' : ' ') : + ((i & 0x10) ? (cmd ? '+' : '-') : (cmd ? '^' : 'v')); + if (!(i & 1)) { + /* + * Info frame + */ + ADDF(" I%u%u%c", (i >> 5) & 7, (i >> 1) & 7, j); + } else if (i & 2) { + /* + * U frame + */ + switch (i & (~0x10)) { + case 0x03: + ADDF(" UI%c", j); + break; + case 0x2f: + ADDF(" SABM%c", j); + break; + case 0x43: + ADDF(" DISC%c", j); + break; + case 0x0f: + ADDF(" DM%c", j); + break; + case 0x63: + ADDF(" UA%c", j); + break; + case 0x87: + ADDF(" FRMR%c", j); + break; + default: + ADDF(" unknown U (0x%x)%c", i & (~0x10), j); + break; + } + } else { + /* + * supervisory + */ + switch (i & 0xf) { + case 0x1: + ADDF(" RR%u%c", (i >> 5) & 7, j); + break; + case 0x5: + ADDF(" RNR%u%c", (i >> 5) & 7, j); + break; + case 0x9: + ADDF(" REJ%u%c", (i >> 5) & 7, j); + break; + default: + ADDF(" unknown S (0x%x)%u%c", i & 0xf, (i >> 5) & 7, j); + break; + } + } + if (!len) { + ADDCH('\n'); + *p = 0; + return p - buf; + } + ADDF(" pid=%02X\n", *pkt++); + len--; + pkt1 = pkt; + len1 = len; + j = 0; + while (len) { + i = *pkt++; + if ((i >= 32) && (i < 128)) { + ADDCH(i); + } + else if (i == 13) { + if (j) { + ADDCH('\n'); + } + j = 0; + } else { + ADDCH('.'); + } + if (i >= 32) + j = 1; + len--; + } + if (j) { + ADDCH('\n'); + } + if (dp0ais && data1 && len1 >= 20) { + ADDF("Timestamp: %u\n" + "Temp Board: %5.2f°C\n" + "Temp RF PA: %5.2f°C\n" + "U/Battery: %5.2fV\n" + "U/5V: %5.2fV\n" + "U/3.3V: %5.2fV\n" + "Bit Errors: %u\n", + hextoint(pkt1, 4), + hextoint(pkt1 + 4, 4) * 0.5, + hextoint(pkt1 + 8, 4) * 0.5, + hextoint(pkt1 + 12, 2) * 0.1, + (hextoint(pkt1 + 14, 2) + 512) * 0.01, + (hextoint(pkt1 + 16, 2) + 256) * 0.01, + hextoint(pkt1 + 18, 2)); + } + *p = 0; + return p - buf; +} + diff --git a/soundcard/soundio.h b/soundcard/soundio.h new file mode 100644 index 0000000..b044dc6 --- /dev/null +++ b/soundcard/soundio.h @@ -0,0 +1,93 @@ +/*****************************************************************************/ + +/* + * soundio.h -- Internal data structures. + * + * Copyright (C) 2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +/*****************************************************************************/ + +#ifndef _SOUNDIO_H +#define _SOUNDIO_H + +/* ---------------------------------------------------------------------- */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "modem.h" +#include "kisspkt.h" +#include "pttio.h" +#include "audioio.h" + +#include + +#ifdef WIN32 +#include +#endif + +/* ---------------------------------------------------------------------- */ + +struct state { + struct modemchannel *channels; + struct state *next; + struct audioio *audioio; + + struct chacc chacc; + + struct pttio ptt; + +}; + +struct modemchannel +{ + struct modemchannel *next; + struct state *state; + struct modulator *mod; + struct demodulator *demod; + void *modstate; + void *demodstate; + unsigned int rxbitrate; + pthread_t rxthread; + struct kisspkt pkt; +}; + +extern struct state state; + +/* ---------------------------------------------------------------------- */ + +extern struct modemparams pktmkissparams[]; +extern struct modemparams pktkissparams[]; +extern void pktinit(struct modemchannel *chan, const char *params[]); +extern void pktinitmkiss(struct modemchannel *chan, const char *params[]); +extern void pktrelease(struct modemchannel *chan); +extern void pkttransmitloop(struct state *state); + +extern int snprintpkt(char *buf, size_t sz, const u_int8_t *pkt, unsigned len); + +extern void logrelease(void); +extern void loginit(unsigned int vl, unsigned int tosysl); + +extern struct modulator *modchain; +extern struct demodulator *demodchain; + +/* ---------------------------------------------------------------------- */ +#endif /* _SOUNDIO_H */ diff --git a/soundcard/soundmodem.8 b/soundcard/soundmodem.8 new file mode 100644 index 0000000..e04fe29 --- /dev/null +++ b/soundcard/soundmodem.8 @@ -0,0 +1,61 @@ +.\" Copyright 2000 Thomas Sailer (sailer@ife.ee.ethz.ch) +.\" May be distributed under the GNU General Public License +.\" +.\" " +.TH SOUNDMODEM 8 "1 August 2000" "SOUNDMODEM 0.2" "Linux AX.25 Utilities Manual" +.SH NAME +soundmodem \- Soundcard modem driver +.SH SYNOPSIS +.B soundmodem +.B "[ configfile ]" +.B "[ \-sSRM ]" +.B "[\-v verbosity level]" +.B "[\-c configuration name]" + + +.SH DESCRIPTION +.B soundmodem +is a user mode driver for packet radio using a standard soundcard +supported by OSS/Free. It integrates tightly with the kernel MKISS +driver (enable CONFIG_MKISS). +.B soundmodem +is controlled by a configuration file. The default filename is +/etc/ax25/soundmodem.conf. Any other name may be specified on the command line. + + + +.SH OPTIONS +.B soundmodem +accepts the following options: + +.TP +.B \-h +.B \--help +Display an overview of the available command line parameters and exit. +.TP +.B \-v level +Set the verbosity level. 0 only displays fatal errors. +.TP +.B \-c configname +Use the named configuration. If absent the first is taken. +.TP +.B \-s +Log messages to syslog instead of standard out. +.TP +.B \-S +Disable the use of SIMD instructions (aka MMX, VIS, etc). +.TP +.B \-R +Run with realtime scheduling (SCHED_RR). Use with caution. +.TP +.B \-M +Lock memory down in RAM; disables swapping soundmodem out. + + +.SH "SEE ALSO" +.nf +.BR ifconfig "\ (8), " soundmodemconfig "\ (8)" +.fi + +.SH AUTHOR +soundmodem was written by Thomas Sailer, HB9JNX/AE4WA (sailer@ife.ee.ethz.ch). diff --git a/soundcard/test.xml b/soundcard/test.xml new file mode 100644 index 0000000..3f9ee65 --- /dev/null +++ b/soundcard/test.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + diff --git a/soundcard/testkiss.c b/soundcard/testkiss.c new file mode 100644 index 0000000..db8c47d --- /dev/null +++ b/soundcard/testkiss.c @@ -0,0 +1,140 @@ +/*****************************************************************************/ + +/* + * testkiss.c -- Test the HDLC/KISS encoder/decoder. + * + * Copyright (C) 1999-2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +/*****************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "soundio.h" + +#include +#include +#include +#include +#include + +/* ---------------------------------------------------------------------- */ + +static struct modemchannel chan = { + NULL, &state, NULL, NULL, NULL, NULL, 0, +#if 0 + /* gcc3 no longer accepts {} as initializer */ + {}, { 0, } +#endif +}; + +struct state state = { + &chan, NULL, NULL, + { 150, 40, 100, 0 }, {} +}; + +/* ---------------------------------------------------------------------- */ + +#define DATABYTES 64 + +void iotransmitstart(struct audioio *audioio) +{ +} + +void iotransmitstop(struct audioio *audioio) +{ +} + +void pttsetptt(struct pttio *state, int pttx) +{ +} + +void pttsetdcd(struct pttio *state, int dcd) +{ +} + +static void loopback(void) +{ + unsigned char tmp[DATABYTES]; + unsigned char *bp; + unsigned int i, j, k; + + pktsetdcd(state.channels, 0); + for (;;) { + if (pktget(state.channels, tmp, sizeof(tmp))) { + for (bp = tmp, i = 0; i < sizeof(tmp); i++, bp++) { + j = *bp; + for (k = 0; k < 8; k++, j >>= 1) + putc_unlocked('0' + (j & 1), stdout); + } + printf("\n"); + pktput(state.channels, tmp, sizeof(tmp)); + } + } +} + +/* ---------------------------------------------------------------------- */ + +int main(int argc, char *argv[]) +{ + unsigned int verblevel = ~0, tosyslog = 0; + const char *par[16] = { NULL, }; + int c, err = 0, mkiss = 0; + + while ((c = getopt(argc, argv, "v:sd:m")) != EOF) { + switch (c) { + case 'v': + verblevel = strtoul(optarg, NULL, 0); + break; + + case 's': + tosyslog = 1; + break; + + case 'd': + par[0] = optarg; + break; + +#ifdef HAVE_MKISS + case 'm': + mkiss = 1; + break; +#endif + + default: + err++; + break; + } + } + if (err) { + fprintf(stderr, "usage: [-v ] [-s] [-K ]\n"); + exit(1); + } + loginit(verblevel, tosyslog); +#ifdef HAVE_MKISS + if (mkiss) { + pktinitmkiss(state.channels, par); + } else +#endif + pktinit(state.channels, par); + loopback(); + exit(0); +} diff --git a/soundcard/winaudioio.c b/soundcard/winaudioio.c new file mode 100644 index 0000000..d010034 --- /dev/null +++ b/soundcard/winaudioio.c @@ -0,0 +1,627 @@ +/*****************************************************************************/ + +/* + * winaudioio.c -- Audio I/O for Win32 (DirectX). + * + * Copyright (C) 1999-2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please note that the GPL allows you to use the driver, NOT the radio. + * In order to use the radio, you need a license from the communications + * authority of your country. + * + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE +#define _REENTRANT + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "audioio.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* ---------------------------------------------------------------------- */ + +struct audioio_directx { + struct audioio audioio; + unsigned int samplerate; + LPDIRECTSOUND dsplay; + LPDIRECTSOUNDCAPTURE dsrec; + LPDIRECTSOUNDBUFFER playbuf; + LPDIRECTSOUNDCAPTUREBUFFER recbuf; + DWORD playbufsz, playptr, recbufsz; + unsigned int playstart; + pthread_mutex_t iomutex; + unsigned int flags; + unsigned int ptr; + u_int16_t ptime; +}; + +static struct dsdrivers { + GUID guid; + char name[64]; +} dsplaydrv[8], dscaptdrv[8]; + +static HANDLE hinst; + +struct modemparams ioparams_soundcard[] = { + { "dsplay", "Output Driver", "Name of the output driver", dsplaydrv[0].name, MODEMPAR_COMBO, + { c: { { dsplaydrv[0].name, dsplaydrv[1].name, dsplaydrv[2].name, dsplaydrv[3].name, + dsplaydrv[4].name, dsplaydrv[5].name, dsplaydrv[6].name, dsplaydrv[7].name } } } }, + { "dscapture", "Input Driver", "Name of the output driver", dscaptdrv[0].name, MODEMPAR_COMBO, + { c: { { dscaptdrv[0].name, dscaptdrv[1].name, dscaptdrv[2].name, dscaptdrv[3].name, + dscaptdrv[4].name, dscaptdrv[5].name, dscaptdrv[6].name, dscaptdrv[7].name } } } }, + { NULL, } +}; + +#define FLG_ARMINCREMENT 0x100 +#define FLG_TERMINATERX 0x200 + +/* ---------------------------------------------------------------------- */ + +static BOOL CALLBACK DSEnumProc(LPGUID guid, LPCSTR lpszDesc, LPCSTR lpszDrvName, LPVOID lpcontext) +{ + struct dsdrivers *drv = lpcontext; + unsigned int i; + + for (i = 0; i < 8 && drv->name[0]; i++, drv++); + if (i >= 8) + return TRUE; + if (guid) + drv->guid = *guid; + else + drv->guid = GUID_NULL; + if (!lpszDrvName) + snprintf(drv->name, sizeof(drv->name), "%s", lpszDesc); + else + snprintf(drv->name, sizeof(drv->name), "%s (%s)", lpszDesc, lpszDrvName); + drv->name[sizeof(drv->name)-1] = 0; + logprintf(MLOG_INFO, "has %sGUID, desc %s drvname %s\n", guid ? "" : "no ", lpszDesc, lpszDrvName); + return TRUE; +} + +void ioinit_soundcard(void) +{ + unsigned int i; + + memset(dsplaydrv, 0, sizeof(dsplaydrv)); + memset(dscaptdrv, 0, sizeof(dscaptdrv)); + logprintf(MLOG_INFO, "DirectSound drivers\n"); + DirectSoundEnumerateA(DSEnumProc, dsplaydrv); + logprintf(MLOG_INFO, "DirectSoundCapture drivers\n"); + DirectSoundCaptureEnumerateA(DSEnumProc, dscaptdrv); + for (i = 0; i < 8 && dsplaydrv[i].name[0]; i++); + for (; i < 8; i++) + ioparams_soundcard[0].u.c.combostr[i] = NULL; + for (i = 0; i < 8 && dscaptdrv[i].name[0]; i++); + for (; i < 8; i++) + ioparams_soundcard[1].u.c.combostr[i] = NULL; + hinst = GetModuleHandleA(0); +} + +/* ---------------------------------------------------------------------- */ + +static void iorelease(struct audioio *aio) +{ + struct audioio_directx *audioio = (struct audioio_directx *)aio; + + if (audioio->flags & IO_WRONLY) { + IDirectSoundBuffer_Stop(audioio->playbuf); + IDirectSoundBuffer_Release(audioio->playbuf); + } + if (audioio->flags & IO_RDONLY) { + IDirectSoundCaptureBuffer_Stop(audioio->recbuf); + IDirectSoundCaptureBuffer_Release(audioio->recbuf); + IDirectSoundCapture_Release(audioio->dsrec); + } + if (audioio->flags & IO_WRONLY) + IDirectSound_Release(audioio->dsplay); + free(audioio); +} + +static void iowrite(struct audioio *aio, const int16_t *samples, unsigned int nr) +{ + struct audioio_directx *audioio = (struct audioio_directx *)aio; + HRESULT res; + DWORD cappos, playszhalf, playszquart; + void *lptr1, *lptr2; + DWORD lbytes1, lbytes2; + unsigned int free; + + playszhalf = audioio->playbufsz/2; + playszquart = playszhalf / 2; + while (nr > 0) { + if (FAILED(res = IDirectSoundBuffer_GetCurrentPosition(audioio->playbuf, &cappos, NULL))) + logprintf(MLOG_FATAL, "IDirectSoundBuffer_GetCurrentPosition error 0x%lx\n", res); + cappos /= 2; + /* compute buffer fill grade */ + free = (playszhalf + audioio->playptr - cappos) % playszhalf; + if (free >= playszquart) { + /* underrun */ + audioio->playptr = cappos; + free = 0; + } + free = playszquart - 1 - free; + if (!free) { + Sleep(20); + continue; + } + if (free > nr) + free = nr; + if (FAILED(res = IDirectSoundBuffer_Lock(audioio->playbuf, audioio->playptr*2, free*2, &lptr1, &lbytes1, &lptr2, &lbytes2, 0))) + logprintf(MLOG_FATAL, "IDirectSoundBuffer_Lock error 0x%lx\n", res); + memcpy(lptr1, samples, lbytes1); + if (lbytes2) + memcpy(lptr2, ((char *)samples)+lbytes1, lbytes2); + if (FAILED(res = IDirectSoundBuffer_Unlock(audioio->playbuf, lptr1, lbytes1, lptr2, lbytes2))) + logprintf(MLOG_FATAL, "IDirectSoundBuffer_Unlock error 0x%lx\n", res); + samples += free; + nr -= free; + audioio->playptr = (audioio->playptr + free) % playszhalf; + } +} + +/* use the "safe to read" pointer; the hwpointer gives bad data */ + +static void ioread(struct audioio *aio, int16_t *samples, unsigned int nr, u_int16_t tim) +{ + struct audioio_directx *audioio = (struct audioio_directx *)aio; + HRESULT res; + DWORD cappos, recszhalf, cpos2; + u_int16_t ctime; + int i; + void *lptr1, *lptr2; + DWORD lbytes1, lbytes2; + unsigned int p; + + recszhalf = audioio->recbufsz/2; + pthread_mutex_lock(&audioio->iomutex); + while (nr > 0) { + if (audioio->flags & FLG_TERMINATERX) { + pthread_mutex_unlock(&audioio->iomutex); + pthread_exit(NULL); + } + if (FAILED(res = IDirectSoundCaptureBuffer_GetCurrentPosition(audioio->recbuf, &cpos2, &cappos))) + logprintf(MLOG_FATAL, "IDirectSoundCaptureBuffer_GetCurrentPosition error 0x%lx\n", res); + //logprintf(MLOG_INFO, "Cappositions: %6u %6u\n", cappos, cpos2); + if (cappos < recszhalf) { + if (audioio->flags & FLG_ARMINCREMENT) { + audioio->flags &= ~FLG_ARMINCREMENT; + audioio->ptime += recszhalf; + } + } else { + audioio->flags |= FLG_ARMINCREMENT; + } + cappos /= 2; + ctime = audioio->ptime + cappos; + i = (signed)(int16_t)(ctime - tim); + if (i > recszhalf) { + pthread_mutex_unlock(&audioio->iomutex); + i -= recszhalf; + if (i > nr) + i = nr; + memset(samples, 0, i * sizeof(samples[0])); + logprintf(MLOG_ERROR, "ioread: request time %u out of time window [%u,%u)\n", tim, ctime-recszhalf, ctime); + samples += i; + nr -= i; + tim += i; + pthread_mutex_lock(&audioio->iomutex); + continue; + } + if (i > 0) { + p = (recszhalf + cappos - i) % recszhalf; + if (i > nr) + i = nr; + if (FAILED(res = IDirectSoundCaptureBuffer_Lock(audioio->recbuf, 2*p, 2*i, &lptr1, &lbytes1, &lptr2, &lbytes2, 0))) + logprintf(MLOG_FATAL, "IDirectSoundCaptureBuffer_Lock error 0x%lx\n", res); + memcpy(samples, lptr1, lbytes1); + if (lbytes2) + memcpy(((char *)samples)+lbytes1, lptr2, lbytes2); + if (FAILED(res = IDirectSoundCaptureBuffer_Unlock(audioio->recbuf, lptr1, lbytes1, lptr2, lbytes2))) + logprintf(MLOG_FATAL, "IDirectSoundCaptureBuffer_Unlock error 0x%lx\n", res); + nr -= i; + samples += i; + tim += i; + continue; + } + pthread_mutex_unlock(&audioio->iomutex); + Sleep(50); + pthread_mutex_lock(&audioio->iomutex); + } + pthread_mutex_unlock(&audioio->iomutex); +} + +static u_int16_t iocurtime(struct audioio *aio) +{ + struct audioio_directx *audioio = (struct audioio_directx *)aio; + HRESULT res; + DWORD cappos, recszhalf; + u_int16_t ctime; + + recszhalf = audioio->recbufsz/2; + pthread_mutex_lock(&audioio->iomutex); + if (FAILED(res = IDirectSoundCaptureBuffer_GetCurrentPosition(audioio->recbuf, NULL, &cappos))) + logprintf(MLOG_FATAL, "IDirectSoundCaptureBuffer_GetCurrentPosition error 0x%lx\n", res); + if (cappos < recszhalf) { + if (audioio->flags & FLG_ARMINCREMENT) { + audioio->flags &= ~FLG_ARMINCREMENT; + audioio->ptime += recszhalf; + } + } else { + audioio->flags |= FLG_ARMINCREMENT; + } + ctime = audioio->ptime + cappos/2; + pthread_mutex_unlock(&audioio->iomutex); + return ctime; +} + +static void iotransmitstart(struct audioio *aio) +{ + struct audioio_directx *audioio = (struct audioio_directx *)aio; + HRESULT res; + DWORD cappos; + + /* needed for half duplex */ + if (FAILED(res = IDirectSoundBuffer_GetCurrentPosition(audioio->playbuf, &cappos, NULL))) + logprintf(MLOG_FATAL, "IDirectSoundBuffer_GetCurrentPosition error 0x%lx\n", res); + audioio->playptr = cappos / 2; +} + +static void iotransmitstop(struct audioio *aio) +{ + struct audioio_directx *audioio = (struct audioio_directx *)aio; + HRESULT res; + void *lptr1; + DWORD lbytes1; + unsigned int i, j; + int16_t zbuf[128]; + + /* fill half of the buffer with zero */ + memset(zbuf, 0, sizeof(zbuf)); + i = audioio->playbufsz/4; + while (i > 0) { + j = i; + if (j > sizeof(zbuf)/sizeof(zbuf[0])) + j = sizeof(zbuf)/sizeof(zbuf[0]); + iowrite(&audioio->audioio, zbuf, j); + i -= j; + } + /* playback finished, zero whole buffer */ + if (FAILED(res = IDirectSoundBuffer_Lock(audioio->playbuf, 0, audioio->playbufsz, &lptr1, &lbytes1, NULL, NULL, 0))) + logprintf(MLOG_FATAL, "DirectSoundBufferLock error 0x%lx\n", res); + memset(lptr1, 0, lbytes1); + if (FAILED(res = IDirectSoundBuffer_Unlock(audioio->playbuf, lptr1, lbytes1, NULL, 0))) + logprintf(MLOG_FATAL, "DirectSoundBufferUnlock error 0x%lx\n", res); +} + +static void ioterminateread(struct audioio *aio) +{ + struct audioio_directx *audioio = (struct audioio_directx *)aio; + + pthread_mutex_lock(&audioio->iomutex); + audioio->flags |= FLG_TERMINATERX; + pthread_mutex_unlock(&audioio->iomutex); +} + +struct audioio *ioopen_soundcard(unsigned int *samplerate, unsigned int flags, const char *params[]) +{ + LPGUID lpguid; + HRESULT res; + WAVEFORMATEX waveformat; + DSBUFFERDESC bdesc; + DSCBUFFERDESC cbdesc; + DSCAPS caps; + DSCCAPS ccaps; + DSBCAPS bcaps; + DSCBCAPS cbcaps; + unsigned int i, isprimary = 0; + void *lptr1; + DWORD lbytes1; + HWND hwnd = GetDesktopWindow(); + struct audioio_directx *audioio; + + audioio = calloc(1, sizeof(struct audioio_directx)); + if (!audioio) + return NULL; + audioio->audioio.release = iorelease; + if (flags & IO_RDONLY) { + audioio->audioio.terminateread = ioterminateread; + audioio->audioio.read = ioread; + audioio->audioio.curtime = iocurtime; + } + if (flags & IO_WRONLY) { + audioio->audioio.transmitstart = iotransmitstart; + audioio->audioio.transmitstop = iotransmitstop; + audioio->audioio.write = iowrite; + } + audioio->samplerate = *samplerate; + pthread_mutex_init(&audioio->iomutex, NULL); + audioio->playptr = audioio->ptr = audioio->ptime = audioio->playstart = 0; + audioio->flags = flags & IO_RDWR; + if (audioio->flags & IO_WRONLY) { + lpguid = NULL; + if (params[0]) + for (i = 0; i < 8; i++) + if (dsplaydrv[i].name && !strcmp(dsplaydrv[i].name, params[0]) && + memcmp(&dsplaydrv[i].guid, &GUID_NULL, sizeof(dsplaydrv[i].guid))) + lpguid = &dsplaydrv[i].guid; + if (FAILED(res = DirectSoundCreate(lpguid, &audioio->dsplay, NULL))) { + logprintf(MLOG_ERROR, "DirectSoundCreate error 0x%lx\n", res); + goto errdscreate; + } + if (FAILED(res = IDirectSound_SetCooperativeLevel(audioio->dsplay, hwnd, DSSCL_WRITEPRIMARY))) { + logprintf(MLOG_WARNING, "SetCooperativeLevel DSSCL_WRITEPRIMARY error 0x%lx\n", res); + if (FAILED(res = IDirectSound_SetCooperativeLevel(audioio->dsplay, hwnd, DSSCL_EXCLUSIVE))) { + logprintf(MLOG_ERROR, "SetCooperativeLevel DSSCL_EXCLUSIVE error 0x%lx\n", res); + goto errdsb; + } + } else + isprimary = 1; + } + if (audioio->flags & IO_RDONLY) { + lpguid = NULL; + if (params[1]) + for (i = 0; i < 8; i++) + if (dscaptdrv[i].name && !strcmp(dscaptdrv[i].name, params[1]) && + memcmp(&dscaptdrv[i].guid, &GUID_NULL, sizeof(dscaptdrv[i].guid))) + lpguid = &dscaptdrv[i].guid; + if (FAILED(res = DirectSoundCaptureCreate(lpguid, &audioio->dsrec, NULL))) { + logprintf(MLOG_ERROR, "DirectSoundCaptureCreate error 0x%lx\n", res); + goto errdsb; + } + } + /* DirectSound capabilities */ + if (audioio->flags & IO_WRONLY) { + caps.dwSize = sizeof(caps); + if (FAILED(res = IDirectSound_GetCaps(audioio->dsplay, &caps))) { + logprintf(MLOG_ERROR, "DirectSoundGetCaps error 0x%lx\n", res); + goto errdscb; + } + logprintf(MLOG_INFO, "DirectSound capabilities:\n" + " Flags 0x%04x\n" + " SampleRate min %u max %u\n" + " # Primary Buffers %u\n", + caps.dwFlags, caps.dwMinSecondarySampleRate, caps.dwMaxSecondarySampleRate, caps.dwPrimaryBuffers); + } + /* DirectSoundCapture capabilities */ + if (audioio->flags & IO_RDONLY) { + ccaps.dwSize = sizeof(ccaps); + if (FAILED(res = IDirectSoundCapture_GetCaps(audioio->dsrec, &ccaps))) { + logprintf(MLOG_ERROR, "DirectSoundCaptureGetCaps error 0x%lx\n", res); + goto errdscb; + } + logprintf(MLOG_INFO, "DirectSoundCapture capabilities:\n" + " Flags 0x%04x\n" + " Formats 0x%04x\n" + " Channels %u\n", + ccaps.dwFlags, ccaps.dwFormats, ccaps.dwChannels); + } + /* adjust sampling rate */ + if (audioio->flags & IO_WRONLY) { + if (audioio->samplerate < caps.dwMinSecondarySampleRate) + audioio->samplerate = caps.dwMinSecondarySampleRate; + } + if (audioio->flags & IO_RDONLY) { + if (audioio->samplerate < 11025) + audioio->samplerate = 11025; + if (audioio->samplerate <= 22050 && (audioio->samplerate > 11025 || !(ccaps.dwFormats & WAVE_FORMAT_1M16))) + audioio->samplerate = 22050; + if (audioio->samplerate <= 44100 && (audioio->samplerate > 22050 || !(ccaps.dwFormats & WAVE_FORMAT_2M16))) + audioio->samplerate = 44100; + if (audioio->samplerate > 44100 || (audioio->samplerate == 44100 && !(ccaps.dwFormats & WAVE_FORMAT_4M16))) { + logprintf(MLOG_ERROR, "Unsupported capture sampling rate\n"); + goto errdscb; + } + } + if (audioio->flags & IO_WRONLY) { + if (!(caps.dwFlags & DSCAPS_PRIMARY16BIT) || !(caps.dwFlags & DSCAPS_PRIMARYMONO)) { + logprintf(MLOG_ERROR, "Unsupported playback format 16bit mono\n"); + goto errdscb; + } + if (audioio->samplerate < caps.dwMinSecondarySampleRate || audioio->samplerate > caps.dwMaxSecondarySampleRate) { + logprintf(MLOG_ERROR, "Unsupported playback sampling rate %u\n", audioio->samplerate); + goto errdscb; + } + } + /* create capture buffer */ + if (audioio->flags & IO_RDONLY) { + memset(&waveformat, 0, sizeof(waveformat)); + waveformat.wFormatTag = WAVE_FORMAT_PCM; + waveformat.wBitsPerSample = 16; + waveformat.nChannels = 1; + waveformat.nSamplesPerSec = audioio->samplerate; + waveformat.nBlockAlign = waveformat.nChannels * waveformat.wBitsPerSample / 8; + waveformat.nAvgBytesPerSec = waveformat.nSamplesPerSec * waveformat.nBlockAlign; + memset(&cbdesc, 0, sizeof(cbdesc)); + cbdesc.dwSize = sizeof(cbdesc); + cbdesc.dwFlags = /* DSCBCAPS_WAVEMAPPED */ 0; + cbdesc.dwBufferBytes = 65536; + cbdesc.lpwfxFormat = &waveformat; + if (FAILED(res = IDirectSoundCapture_CreateCaptureBuffer(audioio->dsrec, &cbdesc, &audioio->recbuf, NULL))) { + logprintf(MLOG_ERROR, "CreateSoundCaptureBuffer error 0x%lx\n", res); + goto errdscb; + } + } + /* create playback buffer */ + if (audioio->flags & IO_WRONLY) { + if (isprimary) { + memset(&bdesc, 0, sizeof(bdesc)); + bdesc.dwSize = sizeof(bdesc); + bdesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_PRIMARYBUFFER; + bdesc.dwBufferBytes = 0; + bdesc.lpwfxFormat = NULL; + if (FAILED(res = IDirectSound_CreateSoundBuffer(audioio->dsplay, &bdesc, &audioio->playbuf, NULL))) { + logprintf(MLOG_ERROR, "DirectSoundCreateSoundBuffer error 0x%lx\n", res); + goto errdspb; + } + memset(&waveformat, 0, sizeof(waveformat)); + waveformat.wFormatTag = WAVE_FORMAT_PCM; + waveformat.wBitsPerSample = 16; + waveformat.nChannels = 1; + waveformat.nSamplesPerSec = audioio->samplerate; + waveformat.nBlockAlign = waveformat.nChannels * waveformat.wBitsPerSample / 8; + waveformat.nAvgBytesPerSec = waveformat.nSamplesPerSec * waveformat.nBlockAlign; + if (FAILED(res = IDirectSoundBuffer_SetFormat(audioio->playbuf, &waveformat))) { + logprintf(MLOG_ERROR, "DirectSoundBufferSetFormat error 0x%lx\n", res); + goto errsnd; + } + if (FAILED(res = IDirectSoundBuffer_GetFormat(audioio->playbuf, &waveformat, sizeof(waveformat), NULL))) { + logprintf(MLOG_ERROR, "DirectSoundBufferGetFormat error 0x%lx\n", res); + goto errsnd; + } + logprintf(MLOG_INFO, "Sampling rates: Recording %u Playback %u\n", audioio->samplerate, waveformat.nSamplesPerSec); + if (audioio->samplerate != waveformat.nSamplesPerSec) { + logprintf(MLOG_ERROR, "sampling rates (%u,%u) too different\n", audioio->samplerate, waveformat.nSamplesPerSec); + goto errsnd; + } + } else { + /* first try to set the format of the primary buffer */ + memset(&bdesc, 0, sizeof(bdesc)); + bdesc.dwSize = sizeof(bdesc); + bdesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_PRIMARYBUFFER; + bdesc.dwBufferBytes = 0; + bdesc.lpwfxFormat = NULL; + if (FAILED(res = IDirectSound_CreateSoundBuffer(audioio->dsplay, &bdesc, &audioio->playbuf, NULL))) { + logprintf(MLOG_ERROR, "DirectSoundCreateSoundBuffer (primary) error 0x%lx\n", res); + } else { + memset(&waveformat, 0, sizeof(waveformat)); + waveformat.wFormatTag = WAVE_FORMAT_PCM; + waveformat.wBitsPerSample = 16; + waveformat.nChannels = 1; + waveformat.nSamplesPerSec = audioio->samplerate; + waveformat.nBlockAlign = waveformat.nChannels * waveformat.wBitsPerSample / 8; + waveformat.nAvgBytesPerSec = waveformat.nSamplesPerSec * waveformat.nBlockAlign; + if (FAILED(res = IDirectSoundBuffer_SetFormat(audioio->playbuf, &waveformat))) { + logprintf(MLOG_ERROR, "DirectSoundBufferSetFormat (primary) error 0x%lx\n", res); + } + IDirectSoundBuffer_Release(audioio->playbuf); + } + /* create secondary */ + memset(&waveformat, 0, sizeof(waveformat)); + waveformat.wFormatTag = WAVE_FORMAT_PCM; + waveformat.wBitsPerSample = 16; + waveformat.nChannels = 1; + waveformat.nSamplesPerSec = audioio->samplerate; + waveformat.nBlockAlign = waveformat.nChannels * waveformat.wBitsPerSample / 8; + waveformat.nAvgBytesPerSec = waveformat.nSamplesPerSec * waveformat.nBlockAlign; + memset(&bdesc, 0, sizeof(bdesc)); + bdesc.dwSize = sizeof(bdesc); + bdesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GLOBALFOCUS; + bdesc.dwBufferBytes = 65536; + bdesc.lpwfxFormat = &waveformat; + if (FAILED(res = IDirectSound_CreateSoundBuffer(audioio->dsplay, &bdesc, &audioio->playbuf, NULL))) { + logprintf(MLOG_ERROR, "DirectSoundCreateSoundBuffer error 0x%lx\n", res); + goto errdspb; + } + } + } + /* find out buffer size */ + if (audioio->flags & IO_WRONLY) { + bcaps.dwSize = sizeof(bcaps); + if (FAILED(res = IDirectSoundBuffer_GetCaps(audioio->playbuf, &bcaps))) { + logprintf(MLOG_ERROR, "DirectSoundBufferGetCaps error 0x%lx\n", res); + goto errsnd; + } + logprintf(MLOG_INFO, "Playback buffer characteristics:\n" + " Flags 0x%04x\n" + " Buffer Bytes %u\n" + " Unlock Transfer rate %u\n" + " CPU overhead %u\n", + bcaps.dwFlags, bcaps.dwBufferBytes, bcaps.dwUnlockTransferRate, bcaps.dwPlayCpuOverhead); + audioio->playbufsz = bcaps.dwBufferBytes; + } + if (audioio->flags & IO_RDONLY) { + cbcaps.dwSize = sizeof(cbcaps); + if (FAILED(res = IDirectSoundCaptureBuffer_GetCaps(audioio->recbuf, &cbcaps))) { + logprintf(MLOG_ERROR, "DirectSoundCaptureBufferGetCaps error 0x%lx\n", res); + goto errsnd; + } + logprintf(MLOG_INFO, "Recording buffer characteristics:\n" + " Flags 0x%04x\n" + " Buffer Bytes %u\n", + cbcaps.dwFlags, cbcaps.dwBufferBytes); + audioio->recbufsz = cbcaps.dwBufferBytes; + if (FAILED(res = IDirectSoundCaptureBuffer_Start(audioio->recbuf, DSCBSTART_LOOPING))) { + logprintf(MLOG_ERROR, "DirectSoundCaptureBufferStart error 0x%lx\n", res); + goto errsnd; + } + } + /* + * zero playback buffer and start it + */ + if (audioio->flags & IO_WRONLY) { + if (FAILED(res = IDirectSoundBuffer_Lock(audioio->playbuf, 0, audioio->playbufsz, &lptr1, &lbytes1, NULL, NULL, 0))) { + if (res != DSERR_BUFFERLOST) { + logprintf(MLOG_ERROR, "DirectSoundBufferLock error 0x%lx\n", res); + goto errsnd; + } + if (FAILED(res = IDirectSoundBuffer_Restore(audioio->playbuf))) { + logprintf(MLOG_ERROR, "DirectSoundBufferRestore error 0x%lx\n", res); + goto errsnd; + } + if (FAILED(res = IDirectSoundBuffer_Lock(audioio->playbuf, 0, audioio->playbufsz, &lptr1, &lbytes1, NULL, NULL, 0))) { + logprintf(MLOG_ERROR, "DirectSoundBufferLock error 0x%lx\n", res); + goto errsnd; + } + } + memset(lptr1, 0, lbytes1); + if (FAILED(res = IDirectSoundBuffer_Unlock(audioio->playbuf, lptr1, lbytes1, NULL, 0))) { + logprintf(MLOG_ERROR, "DirectSoundBufferUnlock error 0x%lx\n", res); + goto errsnd; + } + if (FAILED(res = IDirectSoundBuffer_Play(audioio->playbuf, 0, 0, DSBPLAY_LOOPING))) { + logprintf(MLOG_ERROR, "DirectSoundBufferPlay error 0x%lx\n", res); + goto errsnd; + } + } + *samplerate = audioio->samplerate; + return &audioio->audioio; + + errsnd: + if (audioio->flags & IO_WRONLY) { + IDirectSoundBuffer_Stop(audioio->playbuf); + IDirectSoundBuffer_Release(audioio->playbuf); + } + errdspb: + if (audioio->flags & IO_RDONLY) { + IDirectSoundCaptureBuffer_Stop(audioio->recbuf); + IDirectSoundCaptureBuffer_Release(audioio->recbuf); + } + errdscb: + if (audioio->flags & IO_RDONLY) + IDirectSoundCapture_Release(audioio->dsrec); + errdsb: + if (audioio->flags & IO_WRONLY) + IDirectSound_Release(audioio->dsplay); + errdscreate: + free(audioio); + return NULL; +} + +/* ---------------------------------------------------------------------- */ diff --git a/soundcard/winlog.c b/soundcard/winlog.c new file mode 100644 index 0000000..492c50b --- /dev/null +++ b/soundcard/winlog.c @@ -0,0 +1,112 @@ +/*****************************************************************************/ + +/* + * winlog.c -- Win32 Logging functions. + * + * Copyright (C) 1999-2000 Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please note that the GPL allows you to use the driver, NOT the radio. + * In order to use the radio, you need a license from the communications + * authority of your country. + * + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE +#define _REENTRANT + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "soundio.h" + +#include +#include +#include +#include +#include + +/* ---------------------------------------------------------------------- */ + +unsigned int log_verblevel = 0; +static HANDLE logh = NULL; + +/* ---------------------------------------------------------------------- */ + +void logrelease(void) +{ + if (logh) { + DeregisterEventSource(logh); + logh = NULL; + } +} + +void loginit(unsigned int vl, unsigned int tosysl) +{ + logrelease(); + log_verblevel = vl; + if (tosysl) { + logh = RegisterEventSource(NULL, /* uses local computer */ "soundmodem"); + if (!logh) + OutputDebugString("Cannot open event log\n"); + } +} + +void logvprintf(unsigned int level, const char *fmt, va_list args) +{ + static const WORD vltosev[] = { EVENTLOG_ERROR_TYPE, EVENTLOG_ERROR_TYPE, + EVENTLOG_WARNING_TYPE, EVENTLOG_INFORMATION_TYPE }; + + if (level <= log_verblevel) { + char tmp[512]; + vsnprintf(tmp, sizeof(tmp), fmt, args); + if (logh) { + if (!ReportEvent(logh, + (level >= 4) ? EVENTLOG_INFORMATION_TYPE : vltosev[level], /* event type */ + level, /* category */ + /*MSG_ERR_EXIST*/0, /* event identifier */ /* FIX ME */ + NULL, /* no user security identifier */ + 1, /* one substitution string */ + 0, /* no data */ + &tmp, /* pointer to string array */ + NULL)) { /* pointer to data */ + OutputDebugString("ReportEvent failed\n"); + exit(1); + } + } else { + OutputDebugString(tmp); + } + } + if (!level) + exit(1); +} + +void logprintf(unsigned int level, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + logvprintf(level, fmt, args); + va_end(args); +} + +void logerr(unsigned int level, const char *st) +{ + logprintf(level, "%s: %s (%d)\n", st, strerror(errno), errno); +} diff --git a/soundcard/winptt.c b/soundcard/winptt.c new file mode 100644 index 0000000..99b7c68 --- /dev/null +++ b/soundcard/winptt.c @@ -0,0 +1,141 @@ +/*****************************************************************************/ + +/* + * winptt.c -- Windows32 PTT signalling. + * + * Copyright (C) 1999-2000 + * Thomas Sailer (sailer@ife.ee.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE +#define _REENTRANT + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "modem.h" +#include "pttio.h" + +#include +#include +#include +#include +#include + +/* ---------------------------------------------------------------------- */ + +#define IOCTL_SERIAL_SET_BAUD_RATE CTL_CODE(FILE_DEVICE_SERIAL_PORT, 1,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_SET_QUEUE_SIZE CTL_CODE(FILE_DEVICE_SERIAL_PORT, 2,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_SET_LINE_CONTROL CTL_CODE(FILE_DEVICE_SERIAL_PORT, 3,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_SET_BREAK_ON CTL_CODE(FILE_DEVICE_SERIAL_PORT, 4,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_SET_BREAK_OFF CTL_CODE(FILE_DEVICE_SERIAL_PORT, 5,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_IMMEDIATE_CHAR CTL_CODE(FILE_DEVICE_SERIAL_PORT, 6,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_SET_TIMEOUTS CTL_CODE(FILE_DEVICE_SERIAL_PORT, 7,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_GET_TIMEOUTS CTL_CODE(FILE_DEVICE_SERIAL_PORT, 8,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_SET_DTR CTL_CODE(FILE_DEVICE_SERIAL_PORT, 9,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_CLR_DTR CTL_CODE(FILE_DEVICE_SERIAL_PORT,10,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_RESET_DEVICE CTL_CODE(FILE_DEVICE_SERIAL_PORT,11,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_SET_RTS CTL_CODE(FILE_DEVICE_SERIAL_PORT,12,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_CLR_RTS CTL_CODE(FILE_DEVICE_SERIAL_PORT,13,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_SET_XOFF CTL_CODE(FILE_DEVICE_SERIAL_PORT,14,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_SET_XON CTL_CODE(FILE_DEVICE_SERIAL_PORT,15,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_GET_WAIT_MASK CTL_CODE(FILE_DEVICE_SERIAL_PORT,16,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_SET_WAIT_MASK CTL_CODE(FILE_DEVICE_SERIAL_PORT,17,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_WAIT_ON_MASK CTL_CODE(FILE_DEVICE_SERIAL_PORT,18,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_PURGE CTL_CODE(FILE_DEVICE_SERIAL_PORT,19,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_GET_BAUD_RATE CTL_CODE(FILE_DEVICE_SERIAL_PORT,20,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_GET_LINE_CONTROL CTL_CODE(FILE_DEVICE_SERIAL_PORT,21,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_GET_CHARS CTL_CODE(FILE_DEVICE_SERIAL_PORT,22,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_SET_CHARS CTL_CODE(FILE_DEVICE_SERIAL_PORT,23,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_GET_HANDFLOW CTL_CODE(FILE_DEVICE_SERIAL_PORT,24,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_SET_HANDFLOW CTL_CODE(FILE_DEVICE_SERIAL_PORT,25,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_GET_MODEMSTATUS CTL_CODE(FILE_DEVICE_SERIAL_PORT,26,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_GET_COMMSTATUS CTL_CODE(FILE_DEVICE_SERIAL_PORT,27,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_XOFF_COUNTER CTL_CODE(FILE_DEVICE_SERIAL_PORT,28,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_GET_PROPERTIES CTL_CODE(FILE_DEVICE_SERIAL_PORT,29,METHOD_BUFFERED,FILE_ANY_ACCESS) +#define IOCTL_SERIAL_GET_DTRRTS CTL_CODE(FILE_DEVICE_SERIAL_PORT,30,METHOD_BUFFERED,FILE_ANY_ACCESS) + +/* ---------------------------------------------------------------------- */ + +struct modemparams pttparams[] = { + { "file", "PTT Driver", "Path name of the serial or parallel port driver for outputting PTT", "\\\\.\\COM1", MODEMPAR_COMBO, + { c: { { "\\\\.\\COM1", "\\\\.\\COM2", "\\\\.\\COM3", "\\\\.\\COM4" } } } }, + { NULL } +}; + +/* ---------------------------------------------------------------------- */ + +int pttinit(struct pttio *state, const char *params[]) +{ + const char *path = params[0]; + HANDLE h; + BOOLEAN res; + DWORD val; + + if (!path || !path[0]) + return 0; + state->h = INVALID_HANDLE_VALUE; + h = CreateFile(path, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); + if (h == INVALID_HANDLE_VALUE) { + logprintf(MLOG_ERROR, "Cannot open PTT device \"%s\"\n", path); + return -1; + } + res = DeviceIoControl(h, IOCTL_SERIAL_CLR_RTS, NULL, 0, NULL, 0, &val, NULL); + if (!res) { + logprintf(MLOG_ERROR, "Device \"%s\" not a serport\n", path); + CloseHandle(h); + return -1; + } + state->h = h; + pttsetptt(state, 0); + pttsetdcd(state, 0); + return 0; +} + +void pttsetptt(struct pttio *state, int pttx) +{ + DWORD val; + + if (!state || state->h == INVALID_HANDLE_VALUE) + return; + state->ptt = !!pttx; + DeviceIoControl(state->h, state->ptt ? IOCTL_SERIAL_SET_RTS : IOCTL_SERIAL_CLR_RTS, NULL, 0, NULL, 0, &val, NULL); +} + +void pttsetdcd(struct pttio *state, int dcd) +{ + DWORD val; + + if (!state || state->h == INVALID_HANDLE_VALUE) + return; + state->dcd = !!dcd; + DeviceIoControl(state->h, state->dcd ? IOCTL_SERIAL_SET_DTR : IOCTL_SERIAL_CLR_DTR, NULL, 0, NULL, 0, &val, NULL); +} + +void pttrelease(struct pttio *state) +{ + if (!state || state->h == INVALID_HANDLE_VALUE) + return; + pttsetptt(state, 0); + pttsetdcd(state, 0); + CloseHandle(state->h); + state->h = INVALID_HANDLE_VALUE; +} diff --git a/soundcard/winptt2.c b/soundcard/winptt2.c new file mode 100644 index 0000000..6e13722 --- /dev/null +++ b/soundcard/winptt2.c @@ -0,0 +1,104 @@ +/*****************************************************************************/ + +/* + * winptt2.c -- Windows32 PTT signalling. + * + * Copyright (C) 1999-2001 + * Thomas Sailer (t.sailer@alumni.ethz.ch) + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +/*****************************************************************************/ + +#define _GNU_SOURCE +#define _REENTRANT + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "modem.h" +#include "pttio.h" + +#include +#include +#include +#include + +/* ---------------------------------------------------------------------- */ + +struct modemparams pttparams[] = { + { "file", "PTT Driver", "Device name of the serial port for outputting PTT", "COM1", MODEMPAR_COMBO, + { c: { { "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8" } } } }, + { NULL } +}; + +/* ---------------------------------------------------------------------- */ + +int pttinit(struct pttio *state, const char *params[]) +{ + const char *path = params[0]; + HANDLE h; + DCB dcb; + + if (!path || !path[0]) + return 0; + state->h = INVALID_HANDLE_VALUE; + h = CreateFile(path, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); + if (h == INVALID_HANDLE_VALUE) { + logprintf(MLOG_ERROR, "Cannot open PTT device \"%s\"\n", path); + return -1; + } + /* Check if it is a comm device */ + if (!GetCommState(h, &dcb)) { + logprintf(MLOG_ERROR, "Device \"%s\" not a COM device\n", path); + CloseHandle(h); + return -1; + } + state->h = h; + pttsetptt(state, 0); + pttsetdcd(state, 0); + return 0; +} + +void pttsetptt(struct pttio *state, int pttx) +{ + if (!state || state->h == INVALID_HANDLE_VALUE) + return; + state->ptt = !!pttx; + if (!EscapeCommFunction(state->h, state->ptt ? SETRTS : CLRRTS)) + logprintf(MLOG_ERROR, "EscapeCommFunction (ptt) Error 0x%lx\n", GetLastError()); +} + +void pttsetdcd(struct pttio *state, int dcd) +{ + if (!state || state->h == INVALID_HANDLE_VALUE) + return; + state->dcd = !!dcd; + if (!EscapeCommFunction(state->h, state->dcd ? SETDTR : CLRDTR)) + logprintf(MLOG_ERROR, "EscapeCommFunction (dcd) Error 0x%lx\n", GetLastError()); +} + +void pttrelease(struct pttio *state) +{ + if (!state || state->h == INVALID_HANDLE_VALUE) + return; + pttsetptt(state, 0); + pttsetdcd(state, 0); + CloseHandle(state->h); + state->h = INVALID_HANDLE_VALUE; +} diff --git a/soundmodem.initscript b/soundmodem.initscript new file mode 100755 index 0000000..2ce5963 --- /dev/null +++ b/soundmodem.initscript @@ -0,0 +1,56 @@ +#! /bin/sh +# +# soundmodem Start Soundmodem driver. +# +# Author: Thomas Sailer, +# +# chkconfig: 345 50 50 +# description: This script starts/stops the Soundmodem driver +# processname: soundmodem +# pidfile: /var/run/soundmodem.pid + +# Source function library. +. /etc/rc.d/init.d/functions + +# Get config. +. /etc/sysconfig/network + +## Check that networking is up. +#if [ ${NETWORKING} = "no" ] +#then +# exit 0 +#fi + +[ -f /usr/sbin/soundmodem ] || exit 0 + +# See how we were called. +case "$1" in + start) + echo -n "Starting Soundmodem: " + daemon /usr/sbin/soundmodem --daemonize + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/soundmodem + ;; + stop) + echo -n "Stopping Soundmodem: " + killproc soundmodem + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/soundmodem + ;; + restart|reload) + $0 stop + $0 start + RETVAL=$? + ;; + status) + status soundmodem + RETVAL=$? + ;; + *) + echo "Usage: soundmodem {start|stop|restart|status}" + exit 1 +esac + +exit $RETVAL diff --git a/soundmodem.spec b/soundmodem.spec new file mode 100644 index 0000000..b07cfe6 --- /dev/null +++ b/soundmodem.spec @@ -0,0 +1,50 @@ +# Note that this is NOT a relocatable package +%define ver 0.10 +%define rel 1 +%define prefix /usr + +Summary: Driver and diagnostic utility for Usermode SoundModem +Name: soundmodem +Version: %ver +Release: %rel +License: GPL +Group: Networking/Hamradio +Source: soundmodem-%{ver}.tar.gz +BuildRoot: /tmp/soundmodem-root +Packager: Thomas Sailer +# Requires: /sbin/ifconfig /sbin/route /sbin/arp + +%description +This package contains the driver and the diagnostic utility for +userspace SoundModem. It allows you to use soundcards supported +by OSS/Free as Amateur Packet Radio modems. + +%prep +%setup + +%build +%configure --enable-mmx +make + +%install +rm -rf $RPM_BUILD_ROOT +%makeinstall +install -m 0755 -d $RPM_BUILD_ROOT/etc/rc.d/init.d +install -m 0755 soundmodem.initscript $RPM_BUILD_ROOT/etc/rc.d/init.d/soundmodem +install -m 0755 -d $RPM_BUILD_ROOT/etc/ax25 +touch $RPM_BUILD_ROOT/etc/ax25/soundmodem.conf +chmod 0600 $RPM_BUILD_ROOT/etc/ax25/soundmodem.conf +rm -rf $RPM_BUILD_ROOT/usr/include + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-, root, root) + +%doc AUTHORS COPYING ChangeLog INSTALL NEWS README newqpsk/README.newqpsk +%{prefix}/sbin/* +%{prefix}/bin/* +%{prefix}/share/man/*/* +%config /etc/rc.d/init.d/soundmodem +%config /etc/ax25/soundmodem.conf