From 9a4263e499b328a6943e75d97358933597d390cb Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 16 Oct 2012 18:45:39 +0000 Subject: converted OSCx to the Library Template and bumped the version to 0.3.1 svn path=/branches/pd-extended/0.43/externals/oscx/; revision=16399 --- LICENSE | 371 --- LICENSE.txt | 371 +++ Makefile | 454 +++ OSC-client.c | 479 ++++ OSC-client.h | 176 ++ OSC-common.h | 84 + OSC-help.pd | 10 + OSC-pattern-match.c | 192 ++ OSC-pattern-match.h | 35 + OSC-system-dependent.c | 82 + OSC-timetag.c | 170 ++ OSC-timetag.h | 88 + OSC.c | 72 + OSCroute-help.pd | 98 + OSCroute.c | 452 +++ README.txt | 70 +- SConscript | 17 - config.guess | 1317 --------- config.h.in | 0 config.sub | 1411 ---------- configure | 6647 -------------------------------------------- configure.ac | 181 -- doc/OSC-help.pd | 10 - doc/OSCroute-help.pd | 98 - doc/dumpOSC-help.pd | 11 - doc/sendOSC-help.pd | 62 - dumpOSC-help.pd | 11 + dumpOSC.c | 1056 +++++++ htmsocket.c | 387 +++ htmsocket.h | 48 + install.sh | 0 libOSC/LIBOSC.001 | 94 - libOSC/LIBOSC.002 | 100 - libOSC/LIBOSC.DSP | 100 - libOSC/LIBOSC.DSW | 29 - libOSC/LIBOSC.PLG | 19 - libOSC/Makefile.in | 27 - libOSC/OSC-client.c | 479 ---- libOSC/OSC-client.h | 176 -- libOSC/OSC-timetag.c | 170 -- libOSC/OSC-timetag.h | 88 - libOSC/test_OSC.c | 149 - libOSC/test_OSC_timeTag.c | 36 - oscx-meta.pd | 7 + send+dump/Makefile.in | 30 - send+dump/dumpOSC.c | 723 ----- send+dump/dumpUDP.c | 190 -- send+dump/htmsocket.c | 313 --- send+dump/htmsocket.h | 48 - send+dump/sendOSC.c | 602 ---- sendOSC-help.pd | 62 + sendOSC.c | 585 ++++ src/INVENTORY.txt | 21 - src/Makefile.in | 65 - src/OSC-common.h | 84 - src/OSC-pattern-match.c | 192 -- src/OSC-pattern-match.h | 35 - src/OSC-system-dependent.c | 82 - src/OSC.001 | 147 - src/OSC.c | 72 - src/OSC.dsp | 152 - src/OSC.dsw | 29 - src/OSCroute.c | 452 --- src/TODO.txt | 27 - src/VERSION | 1 - src/dumpOSC.c | 1056 ------- src/htmsocket.c | 387 --- src/htmsocket.h | 48 - src/sendOSC.c | 585 ---- test_OSC.c | 149 + test_OSC_timeTag.c | 36 + 71 files changed, 5146 insertions(+), 16961 deletions(-) delete mode 100644 LICENSE create mode 100644 LICENSE.txt create mode 100644 Makefile create mode 100644 OSC-client.c create mode 100644 OSC-client.h create mode 100644 OSC-common.h create mode 100644 OSC-help.pd create mode 100644 OSC-pattern-match.c create mode 100644 OSC-pattern-match.h create mode 100644 OSC-system-dependent.c create mode 100644 OSC-timetag.c create mode 100644 OSC-timetag.h create mode 100644 OSC.c create mode 100644 OSCroute-help.pd create mode 100644 OSCroute.c delete mode 100644 SConscript delete mode 100755 config.guess delete mode 100644 config.h.in delete mode 100755 config.sub delete mode 100755 configure delete mode 100644 configure.ac delete mode 100644 doc/OSC-help.pd delete mode 100644 doc/OSCroute-help.pd delete mode 100644 doc/dumpOSC-help.pd delete mode 100644 doc/sendOSC-help.pd create mode 100644 dumpOSC-help.pd create mode 100644 dumpOSC.c create mode 100644 htmsocket.c create mode 100644 htmsocket.h delete mode 100644 install.sh delete mode 100644 libOSC/LIBOSC.001 delete mode 100644 libOSC/LIBOSC.002 delete mode 100644 libOSC/LIBOSC.DSP delete mode 100644 libOSC/LIBOSC.DSW delete mode 100644 libOSC/LIBOSC.PLG delete mode 100644 libOSC/Makefile.in delete mode 100644 libOSC/OSC-client.c delete mode 100644 libOSC/OSC-client.h delete mode 100644 libOSC/OSC-timetag.c delete mode 100644 libOSC/OSC-timetag.h delete mode 100644 libOSC/test_OSC.c delete mode 100644 libOSC/test_OSC_timeTag.c create mode 100644 oscx-meta.pd delete mode 100644 send+dump/Makefile.in delete mode 100644 send+dump/dumpOSC.c delete mode 100644 send+dump/dumpUDP.c delete mode 100644 send+dump/htmsocket.c delete mode 100644 send+dump/htmsocket.h delete mode 100644 send+dump/sendOSC.c create mode 100644 sendOSC-help.pd create mode 100644 sendOSC.c delete mode 100644 src/INVENTORY.txt delete mode 100644 src/Makefile.in delete mode 100644 src/OSC-common.h delete mode 100644 src/OSC-pattern-match.c delete mode 100644 src/OSC-pattern-match.h delete mode 100644 src/OSC-system-dependent.c delete mode 100644 src/OSC.001 delete mode 100644 src/OSC.c delete mode 100644 src/OSC.dsp delete mode 100644 src/OSC.dsw delete mode 100644 src/OSCroute.c delete mode 100644 src/TODO.txt delete mode 100644 src/VERSION delete mode 100644 src/dumpOSC.c delete mode 100644 src/htmsocket.c delete mode 100644 src/htmsocket.h delete mode 100644 src/sendOSC.c create mode 100644 test_OSC.c create mode 100644 test_OSC_timeTag.c diff --git a/LICENSE b/LICENSE deleted file mode 100644 index d6c4924..0000000 --- a/LICENSE +++ /dev/null @@ -1,371 +0,0 @@ -Copyright © 1998. The Regents of the University of California (Regents). -All Rights Reserved. - -Written by Matt Wright, The Center for New Music and Audio Technologies, -University of California, Berkeley. - -Permission to use, copy, modify, distribute, and distribute modified versions -of this software and its documentation without fee and without a signed -licensing agreement, is hereby granted, provided that the above copyright -notice, this paragraph and the following two paragraphs appear in all copies, -modifications, and distributions. - -IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING -OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED -HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE -MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - -The OpenSound Control WWW page is - http://www.cnmat.berkeley.edu/OpenSoundControl - - - -Additions and modifications to this code by Hans-Christoph Steiner are only -available under the GNU GPL: - - - 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 PDP.LICENSE, 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/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..d6c4924 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,371 @@ +Copyright © 1998. The Regents of the University of California (Regents). +All Rights Reserved. + +Written by Matt Wright, The Center for New Music and Audio Technologies, +University of California, Berkeley. + +Permission to use, copy, modify, distribute, and distribute modified versions +of this software and its documentation without fee and without a signed +licensing agreement, is hereby granted, provided that the above copyright +notice, this paragraph and the following two paragraphs appear in all copies, +modifications, and distributions. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING +OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED +HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + +The OpenSound Control WWW page is + http://www.cnmat.berkeley.edu/OpenSoundControl + + + +Additions and modifications to this code by Hans-Christoph Steiner are only +available under the GNU GPL: + + + 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 PDP.LICENSE, 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/Makefile b/Makefile new file mode 100644 index 0000000..fc30328 --- /dev/null +++ b/Makefile @@ -0,0 +1,454 @@ +## Pd library template version 1.0.14 +# For instructions on how to use this template, see: +# http://puredata.info/docs/developer/MakefileTemplate +LIBRARY_NAME = oscx + +# add your .c source files, one object per file, to the SOURCES +# variable, help files will be included automatically, and for GUI +# objects, the matching .tcl file too +SOURCES = dumpOSC.c sendOSC.c OSCroute.c OSC.c + +# list all pd objects (i.e. myobject.pd) files here, and their helpfiles will +# be included automatically +PDOBJECTS = + +# example patches and related files, in the 'examples' subfolder +EXAMPLES = + +# manuals and related files, in the 'manual' subfolder +MANUAL = + +# if you want to include any other files in the source and binary tarballs, +# list them here. This can be anything from header files, test patches, +# documentation, etc. README.txt and LICENSE.txt are required and therefore +# automatically included +EXTRA_DIST = htmsocket.h OSC-client.h OSC-common.h OSC-pattern-match.h OSC-timetag.h + +# unit tests and related files here, in the 'unittests' subfolder +UNITTESTS = + + +# Additional source files +SHARED_SOURCE = htmsocket.c OSC-client.c OSC-pattern-match.c OSC-system-dependent.c OSC-timetag.c +SHARED_LIB = lib$(LIBRARY_NAME).$(SHARED_EXTENSION) + + +#------------------------------------------------------------------------------# +# +# things you might need to edit if you are using other C libraries +# +#------------------------------------------------------------------------------# + +ALL_CFLAGS = -I"$(PD_INCLUDE)" +ALL_LDFLAGS = +SHARED_LDFLAGS = +ALL_LIBS = + + +#------------------------------------------------------------------------------# +# +# you shouldn't need to edit anything below here, if we did it right :) +# +#------------------------------------------------------------------------------# + +# these can be set from outside without (usually) breaking the build +CFLAGS = -Wall -W -g +LDFLAGS = +LIBS = + +# get library version from meta file +LIBRARY_VERSION = $(shell sed -n 's|^\#X text [0-9][0-9]* [0-9][0-9]* VERSION \(.*\);|\1|p' $(LIBRARY_NAME)-meta.pd) + +ALL_CFLAGS += -DPD -DVERSION='"$(LIBRARY_VERSION)"' + +PD_INCLUDE = $(PD_PATH)/include/pd +# where to install the library, overridden below depending on platform +prefix = /usr/local +libdir = $(prefix)/lib +pkglibdir = $(libdir)/pd-externals +objectsdir = $(pkglibdir) + +INSTALL = install +INSTALL_PROGRAM = $(INSTALL) -p -m 644 +INSTALL_DATA = $(INSTALL) -p -m 644 +INSTALL_DIR = $(INSTALL) -p -m 755 -d + +ALLSOURCES := $(SOURCES) $(SOURCES_android) $(SOURCES_cygwin) $(SOURCES_macosx) \ + $(SOURCES_iphoneos) $(SOURCES_linux) $(SOURCES_windows) + +DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION) +ORIGDIR=pd-$(LIBRARY_NAME:~=)_$(LIBRARY_VERSION) + +UNAME := $(shell uname -s) +ifeq ($(UNAME),Darwin) + CPU := $(shell uname -p) + ifeq ($(CPU),arm) # iPhone/iPod Touch + SOURCES += $(SOURCES_iphoneos) + EXTENSION = pd_darwin + SHARED_EXTENSION = dylib + OS = iphoneos + PD_PATH = /Applications/Pd-extended.app/Contents/Resources + IPHONE_BASE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin + CC=$(IPHONE_BASE)/gcc + CPP=$(IPHONE_BASE)/cpp + CXX=$(IPHONE_BASE)/g++ + ISYSROOT = -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk + IPHONE_CFLAGS = -miphoneos-version-min=3.0 $(ISYSROOT) -arch armv6 + OPT_CFLAGS = -fast -funroll-loops -fomit-frame-pointer + ALL_CFLAGS := $(IPHONE_CFLAGS) $(ALL_CFLAGS) + ALL_LDFLAGS += -arch armv6 -bundle -undefined dynamic_lookup $(ISYSROOT) + SHARED_LDFLAGS += -arch armv6 -dynamiclib -undefined dynamic_lookup $(ISYSROOT) + ALL_LIBS += -lc $(LIBS_iphoneos) + STRIP = strip -x + DISTBINDIR=$(DISTDIR)-$(OS) + else # Mac OS X + SOURCES += $(SOURCES_macosx) + EXTENSION = pd_darwin + SHARED_EXTENSION = dylib + OS = macosx + PD_PATH = /Applications/Pd-extended.app/Contents/Resources + OPT_CFLAGS = -ftree-vectorize -ftree-vectorizer-verbose=2 -fast +# build universal 32-bit on 10.4 and 32/64 on newer + ifeq ($(shell uname -r | sed 's|\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*|\1|'), 8) + FAT_FLAGS = -arch ppc -arch i386 -mmacosx-version-min=10.4 + else + SOURCES += $(SOURCES_iphoneos) +# Starting with Xcode 4.0, the PowerPC compiler is not installed by default + ifeq ($(wildcard /usr/llvm-gcc-4.2/libexec/gcc/powerpc*), ) + FAT_FLAGS = -arch i386 -arch x86_64 -mmacosx-version-min=10.5 + else + FAT_FLAGS = -arch ppc -arch i386 -arch x86_64 -mmacosx-version-min=10.4 + endif + endif + ALL_CFLAGS += $(FAT_FLAGS) -fPIC -I/sw/include + # if the 'pd' binary exists, check the linking against it to aid with stripping + BUNDLE_LOADER = $(shell test ! -e $(PD_PATH)/bin/pd || echo -bundle_loader $(PD_PATH)/bin/pd) + ALL_LDFLAGS += $(FAT_FLAGS) -headerpad_max_install_names -bundle $(BUNDLE_LOADER) \ + -undefined dynamic_lookup -L/sw/lib + SHARED_LDFLAGS += $(FAT_FLAGS) -dynamiclib -undefined dynamic_lookup \ + -install_name @loader_path/$(SHARED_LIB) -compatibility_version 1 -current_version 1.0 + ALL_LIBS += -lc $(LIBS_macosx) + STRIP = strip -x + DISTBINDIR=$(DISTDIR)-$(OS) +# install into ~/Library/Pd on Mac OS X since /usr/local isn't used much + pkglibdir=$(HOME)/Library/Pd + endif +endif +# Tho Android uses Linux, we use this fake uname to provide an easy way to +# setup all this things needed to cross-compile for Android using the NDK +ifeq ($(UNAME),ANDROID) + CPU := arm + SOURCES += $(SOURCES_android) + EXTENSION = so + SHARED_EXTENSION = so + OS = android + PD_PATH = /usr + NDK_BASE := /usr/local/android-ndk + NDK_PLATFORM_LEVEL ?= 5 + NDK_ABI=arm + NDK_SYSROOT=$(NDK_BASE)/platforms/android-$(NDK_PLATFORM_LEVEL)/arch-$(NDK_ABI) + NDK_UNAME := $(shell uname -s | tr '[A-Z]' '[a-z]') + NDK_COMPILER_VERSION=4.6 + NDK_TOOLCHAIN=$(wildcard \ + $(NDK_BASE)/toolchains/$(NDK_ABI)*-$(NDK_COMPILER_VERSION)/prebuilt/$(NDK_UNAME)-x86) + CC := $(wildcard $(NDK_TOOLCHAIN)/bin/*-linux-android*-gcc) --sysroot=$(NDK_SYSROOT) + OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer + CFLAGS += + LDFLAGS += -rdynamic -shared + SHARED_LDFLAGS += -Wl,-soname,$(SHARED_LIB) -shared + LIBS += -lc $(LIBS_android) + STRIP := $(wildcard $(NDK_TOOLCHAIN)/bin/$(NDK_ABI)-linux-android*-strip) \ + --strip-unneeded -R .note -R .comment + DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m) +endif +ifeq ($(UNAME),Linux) + CPU := $(shell uname -m) + SOURCES += $(SOURCES_linux) + EXTENSION = pd_linux + SHARED_EXTENSION = so + OS = linux + PD_PATH = /usr + OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer + ALL_CFLAGS += -fPIC + ALL_LDFLAGS += -rdynamic -shared -fPIC -Wl,-rpath,"\$$ORIGIN",--enable-new-dtags + SHARED_LDFLAGS += -Wl,-soname,$(SHARED_LIB) -shared + ALL_LIBS += -lc $(LIBS_linux) + STRIP = strip --strip-unneeded -R .note -R .comment + DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m) +endif +ifeq ($(UNAME),GNU) + # GNU/Hurd, should work like GNU/Linux for basically all externals + CPU := $(shell uname -m) + SOURCES += $(SOURCES_linux) + EXTENSION = pd_linux + SHARED_EXTENSION = so + OS = linux + PD_PATH = /usr + OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer + ALL_CFLAGS += -fPIC + ALL_LDFLAGS += -rdynamic -shared -fPIC -Wl,-rpath,"\$$ORIGIN",--enable-new-dtags + SHARED_LDFLAGS += -shared -Wl,-soname,$(SHARED_LIB) + ALL_LIBS += -lc $(LIBS_linux) + STRIP = strip --strip-unneeded -R .note -R .comment + DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m) +endif +ifeq ($(UNAME),GNU/kFreeBSD) + # Debian GNU/kFreeBSD, should work like GNU/Linux for basically all externals + CPU := $(shell uname -m) + SOURCES += $(SOURCES_linux) + EXTENSION = pd_linux + SHARED_EXTENSION = so + OS = linux + PD_PATH = /usr + OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer + ALL_CFLAGS += -fPIC + ALL_LDFLAGS += -rdynamic -shared -fPIC -Wl,-rpath,"\$$ORIGIN",--enable-new-dtags + SHARED_LDFLAGS += -shared -Wl,-soname,$(SHARED_LIB) + ALL_LIBS += -lc $(LIBS_linux) + STRIP = strip --strip-unneeded -R .note -R .comment + DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m) +endif +ifeq (CYGWIN,$(findstring CYGWIN,$(UNAME))) + CPU := $(shell uname -m) + SOURCES += $(SOURCES_cygwin) + EXTENSION = dll + SHARED_EXTENSION = dll + OS = cygwin + PD_PATH = $(shell cygpath $$PROGRAMFILES)/pd + OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer + ALL_CFLAGS += + ALL_LDFLAGS += -rdynamic -shared -L"$(PD_PATH)/src" -L"$(PD_PATH)/bin" + SHARED_LDFLAGS += -shared -Wl,-soname,$(SHARED_LIB) + ALL_LIBS += -lc -lpd $(LIBS_cygwin) + STRIP = strip --strip-unneeded -R .note -R .comment + DISTBINDIR=$(DISTDIR)-$(OS) +endif +ifeq (MINGW,$(findstring MINGW,$(UNAME))) + CPU := $(shell uname -m) + SOURCES += $(SOURCES_windows) + EXTENSION = dll + SHARED_EXTENSION = dll + OS = windows + PD_PATH = $(shell cd "$$PROGRAMFILES/pd" && pwd) + # MinGW doesn't seem to include cc so force gcc + CC=gcc + OPT_CFLAGS = -O3 -funroll-loops -fomit-frame-pointer + ALL_CFLAGS += -mms-bitfields + ALL_LDFLAGS += -s -shared -Wl,--enable-auto-import + SHARED_LDFLAGS += -shared + ALL_LIBS += -L"$(PD_PATH)/src" -L"$(PD_PATH)/bin" -L"$(PD_PATH)/obj" \ + -lpd -lwsock32 -lkernel32 -luser32 -lgdi32 -liberty $(LIBS_windows) + STRIP = strip --strip-unneeded -R .note -R .comment + DISTBINDIR=$(DISTDIR)-$(OS) +endif + +# in case somebody manually set the HELPPATCHES above +HELPPATCHES ?= $(SOURCES:.c=-help.pd) $(PDOBJECTS:.pd=-help.pd) + +ALL_CFLAGS := $(ALL_CFLAGS) $(CFLAGS) $(OPT_CFLAGS) +ALL_LDFLAGS := $(LDFLAGS) $(ALL_LDFLAGS) +ALL_LIBS := $(LIBS) $(ALL_LIBS) + +SHARED_SOURCE ?= $(wildcard lib$(LIBRARY_NAME).c) +SHARED_HEADER ?= $(shell test ! -e $(LIBRARY_NAME).h || echo $(LIBRARY_NAME).h) +SHARED_LIB ?= $(SHARED_SOURCE:.c=.$(SHARED_EXTENSION)) +SHARED_TCL_LIB = $(wildcard lib$(LIBRARY_NAME).tcl) + +.PHONY = install libdir_install single_install install-doc install-examples install-manual install-unittests clean distclean dist etags $(LIBRARY_NAME) + +all: $(SOURCES:.c=.$(EXTENSION)) $(SHARED_LIB) + +%.o: %.c + $(CC) $(ALL_CFLAGS) -o "$*.o" -c "$*.c" + +%.$(EXTENSION): %.o $(SHARED_LIB) + $(CC) $(ALL_LDFLAGS) -o "$*.$(EXTENSION)" "$*.o" $(ALL_LIBS) $(SHARED_LIB) + chmod a-x "$*.$(EXTENSION)" + +# this links everything into a single binary file +$(LIBRARY_NAME): $(SOURCES:.c=.o) $(LIBRARY_NAME).o lib$(LIBRARY_NAME).o + $(CC) $(ALL_LDFLAGS) -o $(LIBRARY_NAME).$(EXTENSION) $(SOURCES:.c=.o) \ + $(LIBRARY_NAME).o lib$(LIBRARY_NAME).o $(ALL_LIBS) + chmod a-x $(LIBRARY_NAME).$(EXTENSION) + +$(SHARED_LIB): $(SHARED_SOURCE:.c=.o) + $(CC) $(SHARED_LDFLAGS) -o $(SHARED_LIB) $(SHARED_SOURCE:.c=.o) $(ALL_LIBS) + +install: libdir_install + +# The meta and help files are explicitly installed to make sure they are +# actually there. Those files are not optional, then need to be there. +libdir_install: $(SOURCES:.c=.$(EXTENSION)) $(SHARED_LIB) install-doc install-examples install-manual install-unittests + $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) + $(INSTALL_DATA) $(LIBRARY_NAME)-meta.pd \ + $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) + test -z "$(strip $(SOURCES))" || (\ + $(INSTALL_PROGRAM) $(SOURCES:.c=.$(EXTENSION)) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) && \ + $(STRIP) $(addprefix $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/,$(SOURCES:.c=.$(EXTENSION)))) + test -z "$(strip $(SHARED_LIB))" || \ + $(INSTALL_DATA) $(SHARED_LIB) \ + $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) + test -z "$(strip $(wildcard $(SOURCES:.c=.tcl)))" || \ + $(INSTALL_DATA) $(wildcard $(SOURCES:.c=.tcl)) \ + $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) + test -z "$(strip $(PDOBJECTS))" || \ + $(INSTALL_DATA) $(PDOBJECTS) \ + $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) + test -z "$(strip $(SHARED_TCL_LIB))" || \ + $(INSTALL_DATA) $(SHARED_TCL_LIB) \ + $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) + +# install library linked as single binary +single_install: $(LIBRARY_NAME) install-doc install-examples install-manual install-unittests + $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) + $(INSTALL_PROGRAM) $(LIBRARY_NAME).$(EXTENSION) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) + $(STRIP) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/$(LIBRARY_NAME).$(EXTENSION) + +install-doc: + $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) + test -z "$(strip $(SOURCES) $(PDOBJECTS))" || \ + $(INSTALL_DATA) $(HELPPATCHES) \ + $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) + $(INSTALL_DATA) README.txt $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/README.txt + $(INSTALL_DATA) LICENSE.txt $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/LICENSE.txt + +install-examples: + test -z "$(strip $(EXAMPLES))" || \ + $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/examples && \ + for file in $(EXAMPLES); do \ + $(INSTALL_DATA) examples/$$file $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/examples; \ + done + +install-manual: + test -z "$(strip $(MANUAL))" || \ + $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/manual && \ + for file in $(MANUAL); do \ + $(INSTALL_DATA) manual/$$file $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/manual; \ + done + +install-unittests: + test -z "$(strip $(UNITTESTS))" || \ + $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/unittests && \ + for file in $(UNITTESTS); do \ + $(INSTALL_DATA) unittests/$$file $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/unittests; \ + done + +clean: + -rm -f -- $(SOURCES:.c=.o) $(SOURCES_LIB:.c=.o) $(SHARED_SOURCE:.c=.o) + -rm -f -- $(SOURCES:.c=.$(EXTENSION)) + -rm -f -- $(LIBRARY_NAME).o + -rm -f -- $(LIBRARY_NAME).$(EXTENSION) + -rm -f -- $(SHARED_LIB) + +distclean: clean + -rm -f -- $(DISTBINDIR).tar.gz + -rm -rf -- $(DISTBINDIR) + -rm -f -- $(DISTDIR).tar.gz + -rm -rf -- $(DISTDIR) + -rm -f -- $(ORIGDIR).tar.gz + -rm -rf -- $(ORIGDIR) + + +$(DISTBINDIR): + $(INSTALL_DIR) $(DISTBINDIR) + +libdir: all $(DISTBINDIR) + $(INSTALL_DATA) $(LIBRARY_NAME)-meta.pd $(DISTBINDIR) + $(INSTALL_DATA) $(SOURCES) $(SHARED_SOURCE) $(SHARED_HEADER) $(DISTBINDIR) + $(INSTALL_DATA) $(HELPPATCHES) $(DISTBINDIR) + test -z "$(strip $(EXTRA_DIST))" || \ + $(INSTALL_DATA) $(EXTRA_DIST) $(DISTBINDIR) +# tar --exclude-vcs -czpf $(DISTBINDIR).tar.gz $(DISTBINDIR) + +$(DISTDIR): + $(INSTALL_DIR) $(DISTDIR) + +$(ORIGDIR): + $(INSTALL_DIR) $(ORIGDIR) + +dist: $(DISTDIR) + $(INSTALL_DATA) Makefile $(DISTDIR) + $(INSTALL_DATA) README.txt $(DISTDIR) + $(INSTALL_DATA) LICENSE.txt $(DISTDIR) + $(INSTALL_DATA) $(LIBRARY_NAME)-meta.pd $(DISTDIR) + test -z "$(strip $(ALLSOURCES))" || \ + $(INSTALL_DATA) $(ALLSOURCES) $(DISTDIR) + test -z "$(strip $(wildcard $(ALLSOURCES:.c=.tcl)))" || \ + $(INSTALL_DATA) $(wildcard $(ALLSOURCES:.c=.tcl)) $(DISTDIR) + test -z "$(strip $(wildcard $(LIBRARY_NAME).c))" || \ + $(INSTALL_DATA) $(LIBRARY_NAME).c $(DISTDIR) + test -z "$(strip $(SHARED_HEADER))" || \ + $(INSTALL_DATA) $(SHARED_HEADER) $(DISTDIR) + test -z "$(strip $(SHARED_SOURCE))" || \ + $(INSTALL_DATA) $(SHARED_SOURCE) $(DISTDIR) + test -z "$(strip $(SHARED_TCL_LIB))" || \ + $(INSTALL_DATA) $(SHARED_TCL_LIB) $(DISTDIR) + test -z "$(strip $(PDOBJECTS))" || \ + $(INSTALL_DATA) $(PDOBJECTS) $(DISTDIR) + test -z "$(strip $(HELPPATCHES))" || \ + $(INSTALL_DATA) $(HELPPATCHES) $(DISTDIR) + test -z "$(strip $(EXTRA_DIST))" || \ + $(INSTALL_DATA) $(EXTRA_DIST) $(DISTDIR) + test -z "$(strip $(EXAMPLES))" || \ + $(INSTALL_DIR) $(DISTDIR)/examples && \ + for file in $(EXAMPLES); do \ + $(INSTALL_DATA) examples/$$file $(DISTDIR)/examples; \ + done + test -z "$(strip $(MANUAL))" || \ + $(INSTALL_DIR) $(DISTDIR)/manual && \ + for file in $(MANUAL); do \ + $(INSTALL_DATA) manual/$$file $(DISTDIR)/manual; \ + done + test -z "$(strip $(UNITTESTS))" || \ + $(INSTALL_DIR) $(DISTDIR)/unittests && \ + for file in $(UNITTESTS); do \ + $(INSTALL_DATA) unittests/$$file $(DISTDIR)/unittests; \ + done + tar --exclude-vcs -czpf $(DISTDIR).tar.gz $(DISTDIR) + +# make a Debian source package +dpkg-source: + debclean + make distclean dist + mv $(DISTDIR) $(ORIGDIR) + tar --exclude-vcs -czpf ../$(ORIGDIR).orig.tar.gz $(ORIGDIR) + rm -f -- $(DISTDIR).tar.gz + rm -rf -- $(DISTDIR) $(ORIGDIR) + cd .. && dpkg-source -b $(LIBRARY_NAME) + +etags: TAGS + +TAGS: $(wildcard $(PD_INCLUDE)/*.h) $(SOURCES) $(SHARED_SOURCE) $(SHARED_HEADER) + etags $(wildcard $(PD_INCLUDE)/*.h) + etags -a *.h $(SOURCES) $(SHARED_SOURCE) $(SHARED_HEADER) + etags -a --language=none --regex="/proc[ \t]+\([^ \t]+\)/\1/" *.tcl + +showsetup: + @echo "CC: $(CC)" + @echo "CFLAGS: $(CFLAGS)" + @echo "LDFLAGS: $(LDFLAGS)" + @echo "LIBS: $(LIBS)" + @echo "ALL_CFLAGS: $(ALL_CFLAGS)" + @echo "ALL_LDFLAGS: $(ALL_LDFLAGS)" + @echo "ALL_LIBS: $(ALL_LIBS)" + @echo "PD_INCLUDE: $(PD_INCLUDE)" + @echo "PD_PATH: $(PD_PATH)" + @echo "objectsdir: $(objectsdir)" + @echo "LIBRARY_NAME: $(LIBRARY_NAME)" + @echo "LIBRARY_VERSION: $(LIBRARY_VERSION)" + @echo "SOURCES: $(SOURCES)" + @echo "SHARED_HEADER: $(SHARED_HEADER)" + @echo "SHARED_SOURCE: $(SHARED_SOURCE)" + @echo "SHARED_LIB: $(SHARED_LIB)" + @echo "SHARED_TCL_LIB: $(SHARED_TCL_LIB)" + @echo "PDOBJECTS: $(PDOBJECTS)" + @echo "ALLSOURCES: $(ALLSOURCES)" + @echo "ALLSOURCES TCL: $(wildcard $(ALLSOURCES:.c=.tcl))" + @echo "UNAME: $(UNAME)" + @echo "CPU: $(CPU)" + @echo "pkglibdir: $(pkglibdir)" + @echo "DISTDIR: $(DISTDIR)" + @echo "ORIGDIR: $(ORIGDIR)" + @echo "NDK_TOOLCHAIN: $(NDK_TOOLCHAIN)" + @echo "NDK_BASE: $(NDK_BASE)" + @echo "NDK_SYSROOT: $(NDK_SYSROOT)" diff --git a/OSC-client.c b/OSC-client.c new file mode 100644 index 0000000..cea9e78 --- /dev/null +++ b/OSC-client.c @@ -0,0 +1,479 @@ +/* +Written by Matt Wright, The Center for New Music and Audio Technologies, +University of California, Berkeley. Copyright (c) 1996,97,98,99,2000,01,02,03 +The Regents of the University of California (Regents). + +Permission to use, copy, modify, distribute, and distribute modified versions +of this software and its documentation without fee and without a signed +licensing agreement, is hereby granted, provided that the above copyright +notice, this paragraph and the following two paragraphs appear in all copies, +modifications, and distributions. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING +OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED +HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +*/ + + +/* + Author: Matt Wright + Version 2.2: Calls htonl in the right places 20000620 + Version 2.3: Gets typed messages right. + */ + +/* + pd + ------------- + + raf@interaccess.com: + rev. for Win32 build (verified under Win-2ooo) 11-April-2002 + + -- changed licence part (20040820) jdl + -- Version 2.4 changes not in here (20040820) jdl + +*/ + +/* Here are the possible values of the state field: */ + +#define EMPTY 0 /* Nothing written to packet yet */ +#define ONE_MSG_ARGS 1 /* Packet has a single message; gathering arguments */ +#define NEED_COUNT 2 /* Just opened a bundle; must write message name or + open another bundle */ +#define GET_ARGS 3 /* Getting arguments to a message. If we see a message + name or a bundle open/close then the current message + will end. */ +#define DONE 4 /* All open bundles have been closed, so can't write + anything else */ + +#ifdef WIN32 + #include + #include + #include + #include + #include + #include + #include +#endif + +#ifdef __APPLE__ + #include +#endif + +#ifdef unix + #include + #include +#endif + +#include "OSC-client.h" + +char *OSC_errorMessage; + +#ifndef WIN32 + static int strlen(char *s); +#endif +static int OSC_padString(char *dest, char *str); +static int OSC_padStringWithAnExtraStupidComma(char *dest, char *str); +static int OSC_WritePadding(char *dest, int i); +static int CheckTypeTag(OSCbuf *buf, char expectedType); + +void OSC_initBuffer(OSCbuf *buf, int size, char *byteArray) { + buf->buffer = byteArray; + buf->size = size; + OSC_resetBuffer(buf); +} + +void OSC_resetBuffer(OSCbuf *buf) { + buf->bufptr = buf->buffer; + buf->state = EMPTY; + buf->bundleDepth = 0; + buf->prevCounts[0] = 0; + buf->gettingFirstUntypedArg = 0; + buf->typeStringPtr = 0; +} + +int OSC_isBufferEmpty(OSCbuf *buf) { + return buf->bufptr == buf->buffer; +} + +int OSC_freeSpaceInBuffer(OSCbuf *buf) { + return buf->size - (buf->bufptr - buf->buffer); +} + +int OSC_isBufferDone(OSCbuf *buf) { + return (buf->state == DONE || buf->state == ONE_MSG_ARGS); +} + +char *OSC_getPacket(OSCbuf *buf) { +#ifdef ERROR_CHECK_GETPACKET + if (buf->state == DONE || buf->state == ONE_MSG_ARGS) { + return buf->buffer; + } else { + OSC_errorMessage = "Packet has unterminated bundles"; + return 0; + } +#else + return buf->buffer; +#endif +} + +int OSC_packetSize(OSCbuf *buf) { +#ifdef ERROR_CHECK_PACKETSIZE + if (buf->state == DONE || buf->state == ONE_MSG_ARGS) { + return (buf->bufptr - buf->buffer); + } else { + OSC_errorMessage = "Packet has unterminated bundles"; + return 0; + } +#else + return (buf->bufptr - buf->buffer); +#endif +} + +#define CheckOverflow(buf, bytesNeeded) { \ + if ((bytesNeeded) > OSC_freeSpaceInBuffer(buf)) { \ + OSC_errorMessage = "buffer overflow"; \ + return 1; \ + } \ +} + +static void PatchMessageSize(OSCbuf *buf) { + int4byte size; + size = buf->bufptr - ((char *) buf->thisMsgSize) - 4; + *(buf->thisMsgSize) = htonl(size); +} + +int OSC_openBundle(OSCbuf *buf, OSCTimeTag tt) { + if (buf->state == ONE_MSG_ARGS) { + OSC_errorMessage = "Can't open a bundle in a one-message packet"; + return 3; + } + + if (buf->state == DONE) { + OSC_errorMessage = "This packet is finished; can't open a new bundle"; + return 4; + } + + if (++(buf->bundleDepth) >= MAX_BUNDLE_NESTING) { + OSC_errorMessage = "Bundles nested too deeply; change MAX_BUNDLE_NESTING in OpenSoundControl.h"; + return 2; + } + + if (CheckTypeTag(buf, '\0')) return 9; + + if (buf->state == GET_ARGS) { + PatchMessageSize(buf); + } + + if (buf->state == EMPTY) { + /* Need 16 bytes for "#bundle" and time tag */ + CheckOverflow(buf, 16); + } else { + /* This bundle is inside another bundle, so we need to leave + a blank size count for the size of this current bundle. */ + CheckOverflow(buf, 20); + *((int4byte *)buf->bufptr) = 0xaaaaaaaa; + buf->prevCounts[buf->bundleDepth] = (int4byte *)buf->bufptr; + + buf->bufptr += 4; + } + + buf->bufptr += OSC_padString(buf->bufptr, "#bundle"); + + + *((OSCTimeTag *) buf->bufptr) = tt; + + if (htonl(1) != 1) { + /* Byte swap the 8-byte integer time tag */ + int4byte *intp = (int4byte *)buf->bufptr; + intp[0] = htonl(intp[0]); + intp[1] = htonl(intp[1]); + +#ifdef HAS8BYTEINT + { /* tt is a 64-bit int so we have to swap the two 32-bit words. + (Otherwise tt is a struct of two 32-bit words, and even though + each word was wrong-endian, they were in the right order + in the struct.) */ + int4byte temp = intp[0]; + intp[0] = intp[1]; + intp[1] = temp; + } +#endif + } + + buf->bufptr += sizeof(OSCTimeTag); + + buf->state = NEED_COUNT; + + buf->gettingFirstUntypedArg = 0; + buf->typeStringPtr = 0; + return 0; +} + + +int OSC_closeBundle(OSCbuf *buf) { + if (buf->bundleDepth == 0) { + /* This handles EMPTY, ONE_MSG, ARGS, and DONE */ + OSC_errorMessage = "Can't close bundle; no bundle is open!"; + return 5; + } + + if (CheckTypeTag(buf, '\0')) return 9; + + if (buf->state == GET_ARGS) { + PatchMessageSize(buf); + } + + if (buf->bundleDepth == 1) { + /* Closing the last bundle: No bundle size to patch */ + buf->state = DONE; + } else { + /* Closing a sub-bundle: patch bundle size */ + int size = buf->bufptr - ((char *) buf->prevCounts[buf->bundleDepth]) - 4; + *(buf->prevCounts[buf->bundleDepth]) = htonl(size); + buf->state = NEED_COUNT; + } + + --buf->bundleDepth; + buf->gettingFirstUntypedArg = 0; + buf->typeStringPtr = 0; + return 0; +} + + +int OSC_closeAllBundles(OSCbuf *buf) { + if (buf->bundleDepth == 0) { + /* This handles EMPTY, ONE_MSG, ARGS, and DONE */ + OSC_errorMessage = "Can't close all bundles; no bundle is open!"; + return 6; + } + + if (CheckTypeTag(buf, '\0')) return 9; + + while (buf->bundleDepth > 0) { + OSC_closeBundle(buf); + } + buf->typeStringPtr = 0; + return 0; +} + +int OSC_writeAddress(OSCbuf *buf, char *name) { + int4byte paddedLength; + + if (buf->state == ONE_MSG_ARGS) { + OSC_errorMessage = "This packet is not a bundle, so you can't write another address"; + return 7; + } + + if (buf->state == DONE) { + OSC_errorMessage = "This packet is finished; can't write another address"; + return 8; + } + + if (CheckTypeTag(buf, '\0')) return 9; + + paddedLength = OSC_effectiveStringLength(name); + + if (buf->state == EMPTY) { + /* This will be a one-message packet, so no sizes to worry about */ + CheckOverflow(buf, paddedLength); + buf->state = ONE_MSG_ARGS; + } else { + /* GET_ARGS or NEED_COUNT */ + CheckOverflow(buf, 4+paddedLength); + if (buf->state == GET_ARGS) { + /* Close the old message */ + PatchMessageSize(buf); + } + buf->thisMsgSize = (int4byte *)buf->bufptr; + *(buf->thisMsgSize) = 0xbbbbbbbb; + buf->bufptr += 4; + buf->state = GET_ARGS; + } + + /* Now write the name */ + buf->bufptr += OSC_padString(buf->bufptr, name); + buf->typeStringPtr = 0; + buf->gettingFirstUntypedArg = 1; + + return 0; +} + +int OSC_writeAddressAndTypes(OSCbuf *buf, char *name, char *types) { + int result; + int4byte paddedLength; + + if (CheckTypeTag(buf, '\0')) return 9; + + result = OSC_writeAddress(buf, name); + + if (result) return result; + + paddedLength = OSC_effectiveStringLength(types); + + CheckOverflow(buf, paddedLength); + + buf->typeStringPtr = buf->bufptr + 1; /* skip comma */ + buf->bufptr += OSC_padString(buf->bufptr, types); + + buf->gettingFirstUntypedArg = 0; + return 0; +} + +static int CheckTypeTag(OSCbuf *buf, char expectedType) { + if (buf->typeStringPtr) { + if (*(buf->typeStringPtr) != expectedType) { + if (expectedType == '\0') { + OSC_errorMessage = + "According to the type tag I expected more arguments."; + } else if (*(buf->typeStringPtr) == '\0') { + OSC_errorMessage = + "According to the type tag I didn't expect any more arguments."; + } else { + OSC_errorMessage = + "According to the type tag I expected an argument of a different type."; + printf("* Expected %c, string now %s\n", expectedType, buf->typeStringPtr); + } + return 9; + } + ++(buf->typeStringPtr); + } + return 0; +} + + +int OSC_writeFloatArg(OSCbuf *buf, float arg) { + int4byte *intp; + //int result; + + CheckOverflow(buf, 4); + + if (CheckTypeTag(buf, 'f')) return 9; + + /* Pretend arg is a long int so we can use htonl() */ + intp = ((int4byte *) &arg); + *((int4byte *) buf->bufptr) = htonl(*intp); + + buf->bufptr += 4; + + buf->gettingFirstUntypedArg = 0; + return 0; +} + + + +int OSC_writeFloatArgs(OSCbuf *buf, int numFloats, float *args) { + int i; + int4byte *intp; + + CheckOverflow(buf, 4 * numFloats); + + /* Pretend args are long ints so we can use htonl() */ + intp = ((int4byte *) args); + + for (i = 0; i < numFloats; i++) { + if (CheckTypeTag(buf, 'f')) return 9; + *((int4byte *) buf->bufptr) = htonl(intp[i]); + buf->bufptr += 4; + } + + buf->gettingFirstUntypedArg = 0; + return 0; +} + +int OSC_writeIntArg(OSCbuf *buf, int4byte arg) { + CheckOverflow(buf, 4); + if (CheckTypeTag(buf, 'i')) return 9; + + *((int4byte *) buf->bufptr) = htonl(arg); + buf->bufptr += 4; + + buf->gettingFirstUntypedArg = 0; + return 0; +} + +int OSC_writeStringArg(OSCbuf *buf, char *arg) { + int len; + + if (CheckTypeTag(buf, 's')) return 9; + + len = OSC_effectiveStringLength(arg); + + if (buf->gettingFirstUntypedArg && arg[0] == ',') { + /* This un-type-tagged message starts with a string + that starts with a comma, so we have to escape it + (with a double comma) so it won't look like a type + tag string. */ + + CheckOverflow(buf, len+4); /* Too conservative */ + buf->bufptr += + OSC_padStringWithAnExtraStupidComma(buf->bufptr, arg); + + } else { + CheckOverflow(buf, len); + buf->bufptr += OSC_padString(buf->bufptr, arg); + } + + buf->gettingFirstUntypedArg = 0; + return 0; + +} + +/* String utilities */ + +#ifndef WIN32 +static int strlen(char *s) { + int i; + for (i=0; s[i] != '\0'; i++) /* Do nothing */ ; + return i; +} +#endif + +#define STRING_ALIGN_PAD 4 +int OSC_effectiveStringLength(char *string) { + int len = strlen(string) + 1; /* We need space for the null char. */ + + /* Round up len to next multiple of STRING_ALIGN_PAD to account for alignment padding */ + if ((len % STRING_ALIGN_PAD) != 0) { + len += STRING_ALIGN_PAD - (len % STRING_ALIGN_PAD); + } + return len; +} + +static int OSC_padString(char *dest, char *str) { + int i; + + for (i = 0; str[i] != '\0'; i++) { + dest[i] = str[i]; + } + + return OSC_WritePadding(dest, i); +} + +static int OSC_padStringWithAnExtraStupidComma(char *dest, char *str) { + int i; + + dest[0] = ','; + for (i = 0; str[i] != '\0'; i++) { + dest[i+1] = str[i]; + } + + return OSC_WritePadding(dest, i+1); +} + +static int OSC_WritePadding(char *dest, int i) { + dest[i] = '\0'; + i++; + + for (; (i % STRING_ALIGN_PAD) != 0; i++) { + dest[i] = '\0'; + } + + return i; +} diff --git a/OSC-client.h b/OSC-client.h new file mode 100644 index 0000000..1be5531 --- /dev/null +++ b/OSC-client.h @@ -0,0 +1,176 @@ +/* +Written by Matt Wright, The Center for New Music and Audio Technologies, +University of California, Berkeley. Copyright (c) 1996,97,98,99,2000,01,02,03 +The Regents of the University of California (Regents). + +Permission to use, copy, modify, distribute, and distribute modified versions +of this software and its documentation without fee and without a signed +licensing agreement, is hereby granted, provided that the above copyright +notice, this paragraph and the following two paragraphs appear in all copies, +modifications, and distributions. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING +OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED +HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +*/ + +/* + + OSC-client.h: library for constructing OpenSoundControl messages. + Derived from SynthControl.h + Author: Matt Wright + Version 0.1: 6/13/97 + Version 0.2: 7/21/2000: Support for type-tagged messages + + + General notes: + + This library abstracts away the data format for the OpenSoundControl + protocol. Users of this library can construct OpenSoundControl packets + with a function call interface instead of knowing how to lay out the bits. + + All issues of memory allocation are deferred to the user of this library. + There are two data structures that the user must allocate. The first + is the actual buffer that the message will be written into. This buffer + can be any size, but if it's too small there's a possibility that it + will become overfull. The other data structure is called an OSCbuf, + and it holds all the state used by the library as it's constructing + a buffer. + + All procedures that have the possibility of an error condition return int, + with 0 indicating no error and nonzero indicating an error. The variable + OSC_errorMessage will be set to point to a string containing an error + message explaining what the problem is. + +*/ + + +#include "OSC-timetag.h" + +/* The int4byte type has to be a 4-byte integer. You may have to + change this to long or something else on your system. */ +#ifdef __MWERKS__ + /* In Metrowerks you can set ints to be 2 or 4 bytes on 68K, but long is + always 4 bytes */ + typedef long int4byte; +#else + typedef int int4byte; +#endif + +/* The maximum depth of bundles within bundles within bundles within... + This is the size of a static array. If you exceed this limit you'll + get an error message. */ +#define MAX_BUNDLE_NESTING 32 + + +/* Don't ever manipulate the data in the OSCbuf struct directly. (It's + declared here in the header file only so your program will be able to + declare variables of type OSCbuf and have the right amount of memory + be allocated.) */ + +typedef struct OSCbuf_struct { + char *buffer; /* The buffer to hold the OSC packet */ + int size; /* Size of the buffer */ + char *bufptr; /* Current position as we fill the buffer */ + int state; /* State of partially-constructed message */ + int4byte *thisMsgSize; /* Pointer to count field before + currently-being-written message */ + int4byte *prevCounts[MAX_BUNDLE_NESTING]; + /* Pointers to count field before each currently + open bundle */ + int bundleDepth; /* How many sub-sub-bundles are we in now? */ + char *typeStringPtr; /* This pointer advances through the type + tag string as you add arguments. */ + int gettingFirstUntypedArg; /* nonzero if this message doesn't have + a type tag and we're waiting for the 1st arg */ +} OSCbuf; + + + +/* Initialize the given OSCbuf. The user of this module must pass in the + block of memory that this OSCbuf will use for a buffer, and the number of + bytes in that block. (It's the user's job to allocate the memory because + you do it differently in different systems.) */ +void OSC_initBuffer(OSCbuf *buf, int size, char *byteArray); + + +/* Reset the given OSCbuf. Do this after you send out the contents of + the buffer and want to start writing new data into it. */ +void OSC_resetBuffer(OSCbuf *buf); + + +/* Is the buffer empty? (I.e., would it be stupid to send the buffer + contents to the synth?) */ +int OSC_isBufferEmpty(OSCbuf *buf); + + +/* How much space is left in the buffer? */ +int OSC_freeSpaceInBuffer(OSCbuf *buf); + +/* Does the buffer contain a valid OSC packet? (Returns nonzero if yes.) */ +int OSC_isBufferDone(OSCbuf *buf); + +/* When you're ready to send out the buffer (i.e., when OSC_isBufferDone() + returns true), call these two procedures to get the OSC packet that's been + assembled and its size in bytes. (And then call OSC_resetBuffer() if you + want to re-use this OSCbuf for the next packet.) */ +char *OSC_getPacket(OSCbuf *buf); +int OSC_packetSize(OSCbuf *buf); + + + +/* Here's the basic model for building up OSC messages in an OSCbuf: + + - Make sure the OSCbuf has been initialized with OSC_initBuffer(). + + - To open a bundle, call OSC_openBundle(). You can then write + messages or open new bundles within the bundle you opened. + Call OSC_closeBundle() to close the bundle. Note that a packet + does not have to have a bundle; it can instead consist of just a + single message. + + + - For each message you want to send: + + - Call OSC_writeAddress() with the name of your message. (In + addition to writing your message name into the buffer, this + procedure will also leave space for the size count of this message.) + + - Alternately, call OSC_writeAddressAndTypes() with the name of + your message and with a type string listing the types of all the + arguments you will be putting in this message. + + - Now write each of the arguments into the buffer, by calling one of: + OSC_writeFloatArg() + OSC_writeFloatArgs() + OSC_writeIntArg() + OSC_writeStringArg() + + - Now your message is complete; you can send out the buffer or you can + add another message to it. +*/ + +int OSC_openBundle(OSCbuf *buf, OSCTimeTag tt); +int OSC_closeBundle(OSCbuf *buf); +int OSC_closeAllBundles(OSCbuf *buf); + +int OSC_writeAddress(OSCbuf *buf, char *name); +int OSC_writeAddressAndTypes(OSCbuf *buf, char *name, char *types); +int OSC_writeFloatArg(OSCbuf *buf, float arg); +int OSC_writeFloatArgs(OSCbuf *buf, int numFloats, float *args); +int OSC_writeIntArg(OSCbuf *buf, int4byte arg); +int OSC_writeStringArg(OSCbuf *buf, char *arg); + +extern char *OSC_errorMessage; + +/* How many bytes will be needed in the OSC format to hold the given + string? The length of the string, plus the null char, plus any padding + needed for 4-byte alignment. */ +int OSC_effectiveStringLength(char *string); diff --git a/OSC-common.h b/OSC-common.h new file mode 100644 index 0000000..abea838 --- /dev/null +++ b/OSC-common.h @@ -0,0 +1,84 @@ +/* +Copyright © 1998. The Regents of the University of California (Regents). +All Rights Reserved. + +Written by Matt Wright, The Center for New Music and Audio Technologies, +University of California, Berkeley. + +Permission to use, copy, modify, distribute, and distribute modified versions +of this software and its documentation without fee and without a signed +licensing agreement, is hereby granted, provided that the above copyright +notice, this paragraph and the following two paragraphs appear in all copies, +modifications, and distributions. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING +OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED +HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + +The OpenSound Control WWW page is + http://www.cnmat.berkeley.edu/OpenSoundControl +*/ + + + +/* OSC-common.h + Simple stuff to #include everywhere in the OSC package + + by Matt Wright, 3/13/98 +*/ + +#ifndef _OSC_COMMON_H +#define _OSC_COMMON_H + +/* Boolean type */ + +#ifndef TRUE +typedef int Boolean; +#define TRUE 1 +#define FALSE 0 +#endif + + +#ifdef _WIN32 + #include + #ifdef _DEBUG + #define DEBUG + #endif +#endif /* _WIN32 */ + +/* only needed on Microsoft compilers */ +#ifdef _MSC_VER + #ifdef OSC_EXPORTS + #define OSC_API __declspec(dllexport) + #else + #define OSC_API __declspec(dllimport) + #endif +#endif /* _MSC_VER */ + +//#define int32_t t_int + +/* Fixed byte width types */ +typedef int int4; /* 4 byte int */ + +/* Printing type procedures. All take printf-style format string */ + +/* Catastrophic failure: print message and halt system */ +void fatal_error(char *s, ...); + +/* Error message for user */ +void OSCProblem(char *s, ...); + +/* Warning for user */ +void OSCWarning(char *s, ...); + + + +#endif /* _OSC_COMMON_H */ + diff --git a/OSC-help.pd b/OSC-help.pd new file mode 100644 index 0000000..90c532b --- /dev/null +++ b/OSC-help.pd @@ -0,0 +1,10 @@ +#N canvas 608 335 565 311 12; +#X obj 21 149 sendOSC-help; +#X obj 21 174 dumpOSC-help; +#X obj 21 200 OSCroute-help; +#X obj 17 43 OSC; +#X msg 17 19 version; +#X text 15 79 1 click sendOSC-help 2 click connect button 3 randomly +click the 3 available messages 4 watch console; +#X text 102 19 version 0.16; +#X connect 4 0 3 0; diff --git a/OSC-pattern-match.c b/OSC-pattern-match.c new file mode 100644 index 0000000..847ebb3 --- /dev/null +++ b/OSC-pattern-match.c @@ -0,0 +1,192 @@ +/* +Copyright © 1998. The Regents of the University of California (Regents). +All Rights Reserved. + +Written by Matt Wright, The Center for New Music and Audio Technologies, +University of California, Berkeley. + +Permission to use, copy, modify, distribute, and distribute modified versions +of this software and its documentation without fee and without a signed +licensing agreement, is hereby granted, provided that the above copyright +notice, this paragraph and the following two paragraphs appear in all copies, +modifications, and distributions. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING +OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED +HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + +The OpenSound Control WWW page is + http://www.cnmat.berkeley.edu/OpenSoundControl +*/ + + + +/* + OSC-pattern-match.c + Matt Wright, 3/16/98 + Adapted from oscpattern.c, by Matt Wright and Amar Chaudhury + */ + +#include "OSC-common.h" +#include "OSC-pattern-match.h" + +static const char *theWholePattern; /* Just for warning messages */ + +static Boolean MatchBrackets (const char *pattern, const char *test); +static Boolean MatchList (const char *pattern, const char *test); + +Boolean PatternMatch (const char * pattern, const char * test) { + theWholePattern = pattern; + + if (pattern == 0 || pattern[0] == 0) { + return test[0] == 0; + } + + if (test[0] == 0) { + if (pattern[0] == '*') + return PatternMatch (pattern+1,test); + else + return FALSE; + } + + switch (pattern[0]) { + case 0 : return test[0] == 0; + case '?' : return PatternMatch (pattern + 1, test + 1); + case '*' : + if (PatternMatch (pattern+1, test)) { + return TRUE; + } else { + return PatternMatch (pattern, test+1); + } + case ']' : + case '}' : + OSCWarning("Spurious %c in pattern \".../%s/...\"",pattern[0], theWholePattern); + return FALSE; + case '[' : + return MatchBrackets (pattern,test); + case '{' : + return MatchList (pattern,test); + case '\\' : + if (pattern[1] == 0) { + return test[0] == 0; + } else if (pattern[1] == test[0]) { + return PatternMatch (pattern+2,test+1); + } else { + return FALSE; + } + default : + if (pattern[0] == test[0]) { + return PatternMatch (pattern+1,test+1); + } else { + return FALSE; + } + } +} + + +/* we know that pattern[0] == '[' and test[0] != 0 */ + +static Boolean MatchBrackets (const char *pattern, const char *test) { + Boolean result; + Boolean negated = FALSE; + const char *p = pattern; + + if (pattern[1] == 0) { + OSCWarning("Unterminated [ in pattern \".../%s/...\"", theWholePattern); + return FALSE; + } + + if (pattern[1] == '!') { + negated = TRUE; + p++; + } + + while (*p != ']') { + if (*p == 0) { + OSCWarning("Unterminated [ in pattern \".../%s/...\"", theWholePattern); + return FALSE; + } + if (p[1] == '-' && p[2] != 0) { + if (test[0] >= p[0] && test[0] <= p[2]) { + result = !negated; + goto advance; + } + } + if (p[0] == test[0]) { + result = !negated; + goto advance; + } + p++; + } + + result = negated; + +advance: + + if (!result) + return FALSE; + + while (*p != ']') { + if (*p == 0) { + OSCWarning("Unterminated [ in pattern \".../%s/...\"", theWholePattern); + return FALSE; + } + p++; + } + + return PatternMatch (p+1,test+1); +} + +static Boolean MatchList (const char *pattern, const char *test) { + + const char *restOfPattern, *tp = test; + + + for(restOfPattern = pattern; *restOfPattern != '}'; restOfPattern++) { + if (*restOfPattern == 0) { + OSCWarning("Unterminated { in pattern \".../%s/...\"", theWholePattern); + return FALSE; + } + } + + restOfPattern++; /* skip close curly brace */ + + + pattern++; /* skip open curly brace */ + + while (1) { + + if (*pattern == ',') { + if (PatternMatch (restOfPattern, tp)) { + return TRUE; + } else { + tp = test; + ++pattern; + } + } else if (*pattern == '}') { + return PatternMatch (restOfPattern, tp); + } else if (*pattern == *tp) { + ++pattern; + ++tp; + } else { + tp = test; + while (*pattern != ',' && *pattern != '}') { + pattern++; + } + if (*pattern == ',') { + pattern++; + } + } + } + +} + + + diff --git a/OSC-pattern-match.h b/OSC-pattern-match.h new file mode 100644 index 0000000..653b54d --- /dev/null +++ b/OSC-pattern-match.h @@ -0,0 +1,35 @@ +/* +Copyright © 1998. The Regents of the University of California (Regents). +All Rights Reserved. + +Written by Matt Wright, The Center for New Music and Audio Technologies, +University of California, Berkeley. + +Permission to use, copy, modify, distribute, and distribute modified versions +of this software and its documentation without fee and without a signed +licensing agreement, is hereby granted, provided that the above copyright +notice, this paragraph and the following two paragraphs appear in all copies, +modifications, and distributions. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING +OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED +HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + +The OpenSound Control WWW page is + http://www.cnmat.berkeley.edu/OpenSoundControl +*/ + + +/* + OSC-pattern-match.h +*/ + +Boolean PatternMatch (const char *pattern, const char *test); + diff --git a/OSC-system-dependent.c b/OSC-system-dependent.c new file mode 100644 index 0000000..d4f9c50 --- /dev/null +++ b/OSC-system-dependent.c @@ -0,0 +1,82 @@ +/* +Copyright © 1998. The Regents of the University of California (Regents). +All Rights Reserved. + +Written by Matt Wright, The Center for New Music and Audio Technologies, +University of California, Berkeley. + +Permission to use, copy, modify, distribute, and distribute modified versions +of this software and its documentation without fee and without a signed +licensing agreement, is hereby granted, provided that the above copyright +notice, this paragraph and the following two paragraphs appear in all copies, +modifications, and distributions. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING +OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED +HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + +The OpenSound Control WWW page is + http://www.cnmat.berkeley.edu/OpenSoundControl +*/ + + + +/* OSC-system-dependent.c + + Matt Wright, 3/13/98 + + File of procedures OSC has to call that are not part of the OSC package + and that you, the developer adding OSC addressability to an application, + must write in a way that makes sense in the context of your system. + + You should also look at OSC-timetag.c and see if there's a better way + to handle time tags on your system. + +*/ + +#include "OSC-common.h" + +/* Printing stuff: for now, use stderr. Some cleverer stuff we could do: + + - Make a silent mode where these don't do anything. + - Return error messages via OSC to some client +*/ + +#include +#include +#include + +void fatal_error(char *s, ...) { + va_list ap; + fprintf(stderr, "Fatal error: "); + va_start(ap, s); + vfprintf(stderr, s, ap); + fprintf(stderr, "\n"); + va_end(ap); + exit(-321); +} + +void OSCProblem(char *s, ...) { + va_list ap; + fprintf(stderr, "OSC Problem: "); + va_start(ap, s); + vfprintf(stderr, s, ap); + fprintf(stderr, "\n"); + va_end(ap); +} + +void OSCWarning(char *s, ...) { + va_list ap; + fprintf(stderr, "OSC Warning: "); + va_start(ap, s); + vfprintf(stderr, s, ap); + fprintf(stderr, "\n"); + va_end(ap); +} diff --git a/OSC-timetag.c b/OSC-timetag.c new file mode 100644 index 0000000..666daef --- /dev/null +++ b/OSC-timetag.c @@ -0,0 +1,170 @@ +/* +Copyright (c) 1998,99,2000,01,02,03. The Regents of the University of California (Regents). +All Rights Reserved. Written by Matt Wright, Center for New Music and Audio Technologies, +University of California, Berkeley. + +Permission to use, copy, modify, distribute, and distribute modified versions +of this software and its documentation without fee and without a signed +licensing agreement, is hereby granted, provided that the above copyright +notice, this paragraph and the following two paragraphs appear in all copies, +modifications, and distributions. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING +OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED +HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + +The OpenSound Control WWW page is + http://www.cnmat.berkeley.edu/OpenSoundControl +*/ + +/* + + OSC_timeTag.c: library for manipulating OSC time tags + Matt Wright, 5/29/97 + + Version 0.2 (9/11/98): cleaned up so no explicit type names in the .c file. + +*/ + +#include "OSC-timetag.h" + + +#ifdef HAS8BYTEINT +#define TWO_TO_THE_32_FLOAT 4294967296.0f + +OSCTimeTag OSCTT_Immediately(void) { + return (OSCTimeTag) 1; +} + +OSCTimeTag OSCTT_BiggestPossibleTimeTag(void) { + return (OSCTimeTag) 0xffffffffffffffff; +} + +OSCTimeTag OSCTT_PlusSeconds(OSCTimeTag original, float secondsOffset) { + int8 offset = (int8) (secondsOffset * TWO_TO_THE_32_FLOAT); + +/* printf("* OSCTT_PlusSeconds %llx plus %f seconds (i.e., %lld offset) is %llx\n", original, + secondsOffset, offset, original + offset); */ + + return original + offset; +} + +int OSCTT_Compare(OSCTimeTag left, OSCTimeTag right) { +#if 0 + printf("***** OSCTT_Compare(%llx, %llx): %d\n", left, right, + (left + +#define SECONDS_FROM_1900_to_1970 2208988800 /* 17 leap years */ +#define TWO_TO_THE_32_OVER_ONE_MILLION 4295 + + +OSCTimeTag OSCTT_CurrentTime(void) { + uint8 result; + uint4 usecOffset; + struct timeval tv; + struct timezone tz; + + BSDgettimeofday(&tv, &tz); + + /* First get the seconds right */ + result = (unsigned) SECONDS_FROM_1900_to_1970 + + (unsigned) tv.tv_sec - + (unsigned) 60 * tz.tz_minuteswest + + (unsigned) (tz.tz_dsttime ? 3600 : 0); + +#if 0 + /* No timezone, no DST version ... */ + result = (unsigned) SECONDS_FROM_1900_to_1970 + + (unsigned) tv.tv_sec; +#endif + + + /* make seconds the high-order 32 bits */ + result = result << 32; + + /* Now get the fractional part. */ + usecOffset = (unsigned) tv.tv_usec * (unsigned) TWO_TO_THE_32_OVER_ONE_MILLION; + /* printf("** %ld microsec is offset %x\n", tv.tv_usec, usecOffset); */ + + result += usecOffset; + +/* printf("* OSCTT_CurrentTime is %llx\n", result); */ + return result; +} + +#else /* __sgi */ + +/* Instead of asking your operating system what time it is, it might be + clever to find out the current time at the instant your application + starts audio processing, and then keep track of the number of samples + output to know how much time has passed. */ + +/* Loser version for systems that have no ability to tell the current time: */ +OSCTimeTag OSCTT_CurrentTime(void) { + return (OSCTimeTag) 1; +} + +#endif /* __sgi */ + + +#else /* Not HAS8BYTEINT */ + +OSCTimeTag OSCTT_CurrentTime(void) { + OSCTimeTag result; + result.seconds = 0; + result.fraction = 1; + return result; +} + +OSCTimeTag OSCTT_BiggestPossibleTimeTag(void) { + OSCTimeTag result; + result.seconds = 0xffffffff; + result.fraction = 0xffffffff; + return result; +} + +OSCTimeTag OSCTT_Immediately(void) { + OSCTimeTag result; + result.seconds = 0; + result.fraction = 1; + return result; +} + +OSCTimeTag OSCTT_PlusSeconds(OSCTimeTag original, float secondsOffset) { + OSCTimeTag result; + result.seconds = 0; + result.fraction = 1; + return result; +} + +int OSCTT_Compare(OSCTimeTag left, OSCTimeTag right) { + /* Untested! */ + int highResult = left.seconds - right.seconds; + + if (highResult != 0) return highResult; + + return left.fraction - right.fraction; +} + + +#endif /* HAS8BYTEINT */ + diff --git a/OSC-timetag.h b/OSC-timetag.h new file mode 100644 index 0000000..1de1c45 --- /dev/null +++ b/OSC-timetag.h @@ -0,0 +1,88 @@ +/* +Written by Matt Wright, The Center for New Music and Audio Technologies, +University of California, Berkeley. Copyright (c) 1998,99,2000,01,02,03,04 +The Regents of the University of California (Regents). + +Permission to use, copy, modify, distribute, and distribute modified versions +of this software and its documentation without fee and without a signed +licensing agreement, is hereby granted, provided that the above copyright +notice, this paragraph and the following two paragraphs appear in all copies, +modifications, and distributions. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING +OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED +HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + +The OpenSound Control WWW page is + http://www.cnmat.berkeley.edu/OpenSoundControl +*/ + +/* + OSC_timeTag.h: library for manipulating OSC time tags + Matt Wright, 5/29/97 + + Time tags in OSC have the same format as in NTP: 64 bit fixed point, with the + top 32 bits giving number of seconds sinve midnight 1/1/1900 and the bottom + 32 bits giving fractional parts of a second. We represent this by an 8-byte + unsigned long if possible, or else a struct. + + NB: On many architectures with 8-byte ints, it's illegal (like maybe a bus error) + to dereference a pointer to an 8 byte int that's not 8-byte aligned. +*/ + +#ifndef OSC_TIMETAG +#define OSC_TIMETAG + +#ifdef __sgi + #define HAS8BYTEINT + /* You may have to change this typedef if there's some other + way to specify 8 byte ints on your system */ + typedef long long int8; + typedef unsigned long long uint8; + typedef unsigned long uint4; +#else + /* You may have to redefine this typedef if ints on your system + aren't 4 bytes. */ + typedef unsigned int uint4; +#endif + + +#ifdef HAS8BYTEINT + typedef uint8 OSCTimeTag; +#else + typedef struct { + uint4 seconds; + uint4 fraction; + } OSCTimeTag; +#endif + + + +/* Return a time tag representing the current time (as of when this + procedure is called). */ +OSCTimeTag OSCTT_CurrentTime(void); + +/* Return the time tag 0x0000000000000001, indicating to the receiving device + that it should process the message immediately. */ +OSCTimeTag OSCTT_Immediately(void); + +/* Return the time tag 0xffffffffffffffff, a time so far in the future that + it's effectively infinity. */ +OSCTimeTag OSCTT_BiggestPossibleTimeTag(void); + +/* Given a time tag and a number of seconds to add to the time tag, return + the new time tag */ +OSCTimeTag OSCTT_PlusSeconds(OSCTimeTag original, float secondsOffset); + +/* Compare two time tags. Return negative if first is < second, 0 if + they're equal, and positive if first > second. */ +int OSCTT_Compare(OSCTimeTag left, OSCTimeTag right); + +#endif /* OSC_TIMETAG */ diff --git a/OSC.c b/OSC.c new file mode 100644 index 0000000..2070427 --- /dev/null +++ b/OSC.c @@ -0,0 +1,72 @@ +/* + OpenSoundControl for PD + ------------- + -- init jdl at xdv dot org + -- tweaks for Win32 www.zeggz.com/raf 13-April-2002 + -- smoothed out build, clean up for Darwin 2004.04.04 + -- shoutz: miller and the others + -- Windows-ification by Piotr Majdak 30.08.2005 +*/ + +#if HAVE_CONFIG_H +#include +#endif + +#include +#include "OSC-common.h" + +#define VERSION "0.3.1" + +/* this is for when building with non-Microsoft compilers */ +#ifndef OSC_API +#define OSC_API +#endif + +typedef struct _OSC +{ + t_object x_obj; +} t_OSC; + + +OSC_API void OSC_setup(void); +OSC_API void OSC_version(t_OSC*); + +OSC_API void sendOSC_setup(void); +OSC_API void dumpOSC_setup(void); +OSC_API void OSCroute_setup(void); + + +static t_class* OSC_class; + + +static void* OSC_new(t_symbol* s) { + t_OSC *x = (t_OSC *)pd_new(OSC_class); + error("OSCx is deprecated! consider switching to mrpeach's osc & net objects"); + return (x); +} + + +OSC_API void OSC_version (t_OSC *x) { + + post("OSC4PD Version " VERSION "\n" + " Original code by matt wright. pd-fication jdl@xdv.org\n" + " Win32-port raf@interaccess.com unified versions hans@at.or.at\n" + " Adaptations for Windows: piotr@majdak.com\n" + " Compiled: "__DATE__); +} + +OSC_API void OSC_setup(void) { + OSC_class = class_new(gensym("OSC"), (t_newmethod)OSC_new, 0, + sizeof(t_OSC), 0,0); + class_addmethod(OSC_class, (t_method)OSC_version, gensym("version"), A_NULL, 0, 0); + + sendOSC_setup(); + dumpOSC_setup(); + OSCroute_setup(); + + post("O : Open Sound Control 4 PD, http://www.cnmat.berkeley.edu/OSC"); + post(" S : original code by matt wright, pd hakcs cxc, Win32-port raf@interaccess.com"); + post(" C: ver: "VERSION ", compiled: "__DATE__ " -- adapted by piotr@majdak.com"); + + error("OSCx is deprecated - ask IOhannes m zmoelnig why..."); +} diff --git a/OSCroute-help.pd b/OSCroute-help.pd new file mode 100644 index 0000000..d00336f --- /dev/null +++ b/OSCroute-help.pd @@ -0,0 +1,98 @@ +#N canvas 112 247 505 361 10; +#X msg 20 72 version; +#X obj 86 72 r rcvOSC; +#X obj 86 109 OSCroute /test /ix /yps; +#X obj 161 143 print ix; +#X obj 242 142 print yps; +#X obj 85 183 OSCroute /bla /bli /blo; +#X obj 85 212 unpack f f f; +#X floatatom 85 239 4 0 0 0 - - -; +#X floatatom 124 239 4 0 0 0 - - -; +#X floatatom 164 239 4 0 0 0 - - -; +#X text 20 11 OSCroute works pretty much like route but outputs remainder +of routing tag after match.; +#X obj 68 143 print test; +#X obj 241 212 print rejected; +#N canvas 663 325 676 351 patternmatching 0; +#X obj 26 242 OSCroute /freq; +#X obj 150 242 OSCroute /freq; +#X obj 272 241 OSCroute /freq; +#X msg 81 115 /*/freq 23 45 67; +#X obj 72 201 OSCroute /inst1 /inst2 /inst3; +#X obj 26 266 unpack f f f; +#X floatatom 26 287 3 0 0 0 - - -; +#X floatatom 65 287 3 0 0 0 - - -; +#X floatatom 105 287 3 0 0 0 - - -; +#X obj 150 265 unpack f f f; +#X floatatom 150 286 3 0 0 0 - - -; +#X floatatom 189 286 3 0 0 0 - - -; +#X floatatom 229 286 3 0 0 0 - - -; +#X obj 272 265 unpack f f f; +#X floatatom 272 286 3 0 0 0 - - -; +#X floatatom 311 286 3 0 0 0 - - -; +#X floatatom 351 286 3 0 0 0 - - -; +#X msg 55 44 /inst1/freq 100 200 300; +#X msg 64 66 /inst2/freq 111 222 333; +#X msg 70 88 /inst3/freq 321 432 543; +#X text 45 116 4->; +#X text 37 89 3->; +#X text 30 67 2->; +#X text 22 45 1->; +#X text 11 7 took me a while to figure this out \, somehow i always +thought it should work the other way round:; +#X msg 96 145 /inst[12]/freq 0 99 88; +#X msg 119 174 /inst?/freq 22.33 44.55 66.77; +#X text 367 48 well \, now it does \, crudely:; +#X obj 375 130 OSCroute /*; +#X msg 375 80 /test1/data 1 2 3; +#X msg 401 103 /test2/data 3.4 5 1; +#X obj 447 157 print rejected; +#X obj 375 184 print routed; +#X connect 0 0 5 0; +#X connect 1 0 9 0; +#X connect 2 0 13 0; +#X connect 3 0 4 0; +#X connect 4 0 0 0; +#X connect 4 1 1 0; +#X connect 4 2 2 0; +#X connect 5 0 6 0; +#X connect 5 1 7 0; +#X connect 5 2 8 0; +#X connect 9 0 10 0; +#X connect 9 1 11 0; +#X connect 9 2 12 0; +#X connect 13 0 14 0; +#X connect 13 1 15 0; +#X connect 13 2 16 0; +#X connect 17 0 4 0; +#X connect 18 0 4 0; +#X connect 19 0 4 0; +#X connect 25 0 4 0; +#X connect 26 0 4 0; +#X connect 28 0 32 0; +#X connect 28 1 31 0; +#X connect 29 0 28 0; +#X connect 30 0 28 0; +#X restore 288 57 pd patternmatching; +#X text 184 57 check here =>; +#X text 239 235 last outlet emits all non-matches; +#X text 252 269 -OSC patterns that didnt match; +#X text 239 252 (like classic route):; +#X text 252 280 -patterns not starting with /; +#X text 252 294 -patterns starting with a number; +#X text 325 324 2002-09-08 \, jdl xdv.org; +#X text 28 318 for more info \, get help on:; +#X obj 226 317 OSC; +#X connect 0 0 2 0; +#X connect 1 0 2 0; +#X connect 2 0 5 0; +#X connect 2 0 11 0; +#X connect 2 1 3 0; +#X connect 2 1 5 0; +#X connect 2 2 4 0; +#X connect 2 2 5 0; +#X connect 5 0 6 0; +#X connect 5 3 12 0; +#X connect 6 0 7 0; +#X connect 6 1 8 0; +#X connect 6 2 9 0; diff --git a/OSCroute.c b/OSCroute.c new file mode 100644 index 0000000..c3afc89 --- /dev/null +++ b/OSCroute.c @@ -0,0 +1,452 @@ +/* +Written by Adrian Freed, The Center for New Music and Audio Technologies, +University of California, Berkeley. Copyright (c) 1992,93,94,95,96,97,98,99,2000,01,02,03,04 +The Regents of the University of California (Regents). + +Permission to use, copy, modify, distribute, and distribute modified versions +of this software and its documentation without fee and without a signed +licensing agreement, is hereby granted, provided that the above copyright +notice, this paragraph and the following two paragraphs appear in all copies, +modifications, and distributions. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING +OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED +HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + + +The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl +*/ + + /* OSC-route.c + Max object for OSC-style dispatching + + To-do: + + Match a pattern against a pattern? + [Done: Only Slash-Star is allowed, see MyPatternMatch.] + Declare outlet types / distinguish leaf nodes from other children + More sophisticated (2-pass?) allmessages scheme + set message? + + + pd + ------------- + -- tweaks for Win32 www.zeggz.com/raf 13-April-2002 + + + */ + +#if HAVE_CONFIG_H +#include +#endif + + +/* the required include files */ +#include "m_pd.h" +#include "OSC-common.h" +#include "OSC-pattern-match.h" + +#include +#ifdef _WIN32 + #include + #include +#endif + +/* structure definition of your object */ +#define MAX_NUM 128 +#define OSC_ROUTE_VERSION "1.05" +/* Version 1.04: Allows #1 thru #9 as typed-in arguments + Version 1.05: Allows "list" messages as well as "message" messages. +*/ + +static Boolean MyPatternMatch (const char *pattern, const char *test) +{ + // This allows the special case of "OSCroute /* " to be an outlet that + // matches anything; i.e., it always outputs the input with the first level + // of the address stripped off. + + if (test[0] == '*' && test[1] == '\0') { + return 1; + } else { + return PatternMatch(pattern, test); + } +} + + +static t_class *OSCroute_class; + +typedef struct _OSCroute +{ + t_object x_obj; // required header + t_int x_num; // Number of address prefixes we store + t_int x_complainmode; // Do we print a message if no match? + t_int x_sendmode; // use pd internal sends instead of outlets + char *x_prefixes[MAX_NUM]; + void *x_outlets[MAX_NUM+1]; +} t_OSCroute; + +t_symbol *ps_list, *ps_complain, *ps_emptySymbol; + +/* prototypes */ + +void OSCroute_doanything(t_OSCroute *x, t_symbol *s, int argc, t_atom *argv); +void OSCroute_anything(t_OSCroute *x, t_symbol *s, int argc, t_atom *argv); +void OSCroute_list(t_OSCroute *x, t_symbol *s, int argc, t_atom *argv); +/* //void *OSCroute_new(t_symbol *s, int argc, atom *argv); */ +void *OSCroute_new(t_symbol *s, int argc, t_atom *argv); +void OSCroute_version (t_OSCroute *x); +/* void OSCroute_assist (OSCroute *x, void *box, long msg, long arg, */ +/* char *dstString); */ +void OSCroute_allmessages(t_OSCroute *x, t_symbol *s, int argc, t_atom *argv); +#ifdef _MSC_VER +OSC_API void OSCroute_setup(void); +#else +void OSCroute_setup(void); +#endif /* _MSC_VER */ + +static char *NextSlashOrNull(char *p); +static void StrCopyUntilSlash(char *target, const char *source); + + +// free +static void OSCroute_free(t_OSCroute *x) +{ + // freebytes(x->x_vec, x->x_nelement * sizeof(*x->x_vec)); +} + +/* initialization routine */ + +// setup +#ifdef _MSC_VER + OSC_API void OSCroute_setup(void) { +#else +void OSCroute_setup(void) { +#endif + OSCroute_class = class_new(gensym("OSCroute"), (t_newmethod)OSCroute_new, + (t_method)OSCroute_free,sizeof(t_OSCroute), 0, A_GIMME, 0); + class_addlist(OSCroute_class, OSCroute_list); + class_addanything(OSCroute_class, OSCroute_anything); + class_addmethod(OSCroute_class, (t_method)OSCroute_version, gensym("version"), A_NULL, 0, 0); + class_sethelpsymbol(OSCroute_class, gensym("OSCroute-help.pd")); + + /* + class_addmethod(OSCroute_class, (t_method)OSCroute_connect, + gensym("connect"), A_SYMBOL, A_FLOAT, 0); + class_addmethod(OSCroute_class, (t_method)OSCroute_disconnect, + gensym("disconnect"), 0); + class_addmethod(OSCroute_class, (t_method)OSCroute_send, gensym("send"), + A_GIMME, 0); + */ +/* ps_list = gensym("list"); */ +/* ps_complain = gensym("complain"); */ + ps_emptySymbol = gensym(""); + + post("OSCroute object version " OSC_ROUTE_VERSION " by Matt Wright. pd: jdl Win32 raf."); + post("OSCroute Copyright © 1999 Regents of the Univ. of California. All Rights Reserved."); + error("[OSCroute]: OSCx is deprecated! \n\tConsider switching to mrpeach's [routeOSC]"); +} + + + +/* instance creation routine */ + +void *OSCroute_new(t_symbol *s, int argc, t_atom *argv) +{ + + t_OSCroute *x = (t_OSCroute *)pd_new(OSCroute_class); // get memory for a new object & initialize + + int i; //{{raf}} n not used + + // EnterCallback(); + + if (argc > MAX_NUM) { + post("* OSC-route: too many arguments: %ld (max %ld)", argc, MAX_NUM); + // ExitCallback(); + return 0; + } + + x->x_complainmode = 0; + x->x_num = 0; + for (i = 0; i < argc; ++i) { + if (argv[i].a_type == A_SYMBOL) { + if (argv[i].a_w.w_symbol->s_name[0] == '/') { + /* Now that's a nice prefix */ + x->x_prefixes[i] = argv[i].a_w.w_symbol->s_name; + ++(x->x_num); + } else if (argv[i].a_w.w_symbol->s_name[0] == '#' && + argv[i].a_w.w_symbol->s_name[1] >= '1' && + argv[i].a_w.w_symbol->s_name[1] <= '9') { + /* The Max programmer is trying to make a patch that will be + a subpatch with arguments. We have to make an outlet for this + argument. */ + x->x_prefixes[i] = "dummy"; + ++(x->x_num); + } else { + /* Maybe this is an option we support */ + +/* if (argv[i].a_w.w_sym == ps_complain) { */ +/* x->x_complainmode = 1; */ +/* } else { */ +/* post("* OSC-route: Unrecognized argument %s", argv[i].a_w.w_sym->s_name); */ +/* } */ + + } + + // no LONG + +/* } else if (argv[i].a_type == A_FLOAD) { */ +/* // Convert to a numeral. Max ints are -2147483648 to 2147483647 */ +/* char *string = getbytes(12); */ +/* // I can't be bothered to plug this 12 byte memory leak */ +/* if (string == 0) { */ +/* post("* OSC-route: out of memory!"); */ +/* // ExitCallback(); */ +/* return 0; */ +/* } */ +/* sprintf(string, "%d", argv[i].a_w.w_long); */ +/* x->x_prefixes[i] = string; */ +/* ++(x->x_num); */ + + } else if (argv[i].a_type == A_FLOAT) { + post("* OSC-route: float arguments are not OK."); + // ExitCallback(); + return 0; + } else { + post("* OSC-route: unrecognized argument type!"); + // ExitCallback(); + return 0; + } + } + + + /* Have to create the outlets in reverse order */ + /* well, not in pd ? */ + // for (i = x->x_num-1; i >= 0; --i) { + // for (i = 0; i <= x->x_num-1; i++) { + for (i = 0; i <= x->x_num; i++) { + // x->x_outlets[i] = listout(x); + x->x_outlets[i] = outlet_new(&x->x_obj, &s_list); + } + + // ExitCallback(); + return (x); +} + + +void OSCroute_version (t_OSCroute *x) { + // EnterCallback(); + post("OSCroute Version " OSC_ROUTE_VERSION + ", by Matt Wright. pd jdl, win32: raf.\nOSCroute Compiled " __TIME__ " " __DATE__); + // ExitCallback(); +} + +/* I don't know why these aren't defined in some Max #include file. */ +#define ASSIST_INLET 1 +#define ASSIST_OUTLET 2 + +void OSCroute_assist (t_OSCroute *x, void *box, long msg, long arg, + char *dstString) { + // EnterCallback(); + + if (msg==ASSIST_INLET) { + sprintf(dstString, "Incoming OSC messages"); + } else if (msg==ASSIST_OUTLET) { + if (arg < 0 || arg >= x->x_num) { + post("* OSCroute_assist: No outlet corresponds to arg %ld!", arg); + } else { + sprintf(dstString, "subaddress + args for prefix %s", x->x_prefixes[arg]); + } + } else { + post("* OSCroute_assist: unrecognized message %ld", msg); + } + + // ExitCallback(); +} + +void OSCroute_list(t_OSCroute *x, t_symbol *s, int argc, t_atom *argv) { + // EnterCallback(); + if (argc > 0 && argv[0].a_type == A_SYMBOL) { + /* Ignore the fact that this is a "list" */ + OSCroute_doanything(x, argv[0].a_w.w_symbol, argc-1, argv+1); + } else if (argc > 0) { + // post("* OSC-route: invalid list beginning with a number"); + // output on unmatched outlet jdl 20020908 + if (argv[0].a_type == A_FLOAT) { + outlet_float(x->x_outlets[x->x_num], argv[0].a_w.w_float); + } else { + post("* OSC-route: unrecognized atom type!"); + } + } + else { + // output a bang on the rejected outlet if no arguments + outlet_bang(x->x_outlets[x->x_num]); + } + // ExitCallback(); +} + + +void OSCroute_anything(t_OSCroute *x, t_symbol *s, int argc, t_atom *argv) { + // EnterCallback(); + OSCroute_doanything(x, s, argc, argv); + // ExitCallback(); +} + + + + +void OSCroute_doanything(t_OSCroute *x, t_symbol *s, int argc, t_atom *argv) { + char *pattern, *nextSlash; + int i; + int matchedAnything; + // post("*** OSCroute_anything(s %s, argc %ld)", s->s_name, (long) argc); + + pattern = s->s_name; + if (pattern[0] != '/') { + post("* OSC-route: invalid message pattern %s does not begin with /", s->s_name); + outlet_anything(x->x_outlets[x->x_num], s, argc, argv); + return; + } + + matchedAnything = 0; + + nextSlash = NextSlashOrNull(pattern+1); + if (*nextSlash == '\0') { + /* last level of the address, so we'll output the argument list */ + + +#ifdef NULL_IS_DIFFERENT_FROM_BANG + if (argc==0) { + post("* OSC-route: why are you matching one level pattern %s with no args?", + pattern); + return; + } +#endif + + for (i = 0; i < x->x_num; ++i) { + if (MyPatternMatch(pattern+1, x->x_prefixes[i]+1)) { + ++matchedAnything; + + // I hate stupid Max lists with a special first element + if (argc == 0) { + outlet_bang(x->x_outlets[i]); + } else if (argv[0].a_type == A_SYMBOL) { + // Promote the symbol that was argv[0] to the special symbol + outlet_anything(x->x_outlets[i], argv[0].a_w.w_symbol, argc-1, argv+1); + } else if (argc > 1) { + // Multiple arguments starting with a number, so naturally we have + // to use a special function to output this "list", since it's what + // Max originally meant by "list". + outlet_list(x->x_outlets[i], 0L, argc, argv); + } else { + // There was only one argument, and it was a number, so we output it + // not as a list +/* if (argv[0].a_type == A_LONG) { */ + +/* outlet_int(x->x_outlets[i], argv[0].a_w.w_long); */ + // } else + if (argv[0].a_type == A_FLOAT) { + + outlet_float(x->x_outlets[i], argv[0].a_w.w_float); + } else { + post("* OSC-route: unrecognized atom type!"); + } + } + } + } + } else { + /* There's more address after this part, so our output list will begin with + the next slash. */ + t_symbol *restOfPattern = 0; /* avoid the gensym unless we have to output */ + char patternBegin[1000]; + + + /* Get the first level of the incoming pattern to match against all our prefixes */ + StrCopyUntilSlash(patternBegin, pattern+1); + + for (i = 0; i < x->x_num; ++i) { + if (MyPatternMatch(patternBegin, x->x_prefixes[i]+1)) { + ++matchedAnything; + if (restOfPattern == 0) { + restOfPattern = gensym(nextSlash); + } + outlet_anything(x->x_outlets[i], restOfPattern, argc, argv); + } + } + } + + if (x->x_complainmode) { + if (!matchedAnything) { + post("* OSC-route: pattern %s did not match any prefixes", pattern); + } + } + + // output unmatched data on rightmost outlet a la normal 'route' object, jdl 20020908 + if (!matchedAnything) { + outlet_anything(x->x_outlets[x->x_num], s, argc, argv); + } + + +} + +static char *NextSlashOrNull(char *p) { + while (*p != '/' && *p != '\0') { + p++; + } + return p; +} + +static void StrCopyUntilSlash(char *target, const char *source) { + while (*source != '/' && *source != '\0') { + *target = *source; + ++target; + ++source; + } + *target = 0; +} + +static int MyStrCopy(char *target, const char *source) { + int i = 0; + while (*source != '\0') { + *target = *source; + ++target; + ++source; + ++i; + } + *target = 0; + return i; +} + + + +void OSCroute_allmessages(t_OSCroute *x, t_symbol *s, int argc, t_atom *argv) { + int i; + t_symbol *prefixSymbol = 0; + char prefixBuf[1000]; + char *endOfPrefix; + t_atom a[1]; + + if (argc >= 1 && argv[0].a_type == A_SYMBOL) { + prefixSymbol = argv[0].a_w.w_symbol; + endOfPrefix = prefixBuf + MyStrCopy(prefixBuf, + prefixSymbol->s_name); + } else { + prefixSymbol = ps_emptySymbol; + prefixBuf[0] = '\0'; + endOfPrefix = prefixBuf; + } + + + for (i = 0; i < x->x_num; ++i) { + post("OSC: %s%s", prefixSymbol->s_name, x->x_prefixes[i]); + MyStrCopy(endOfPrefix, x->x_prefixes[i]); + SETSYMBOL(a, gensym(prefixBuf)); + outlet_anything(x->x_outlets[i], s, 1, a); + } +} diff --git a/README.txt b/README.txt index 2859403..55fc0ae 100644 --- a/README.txt +++ b/README.txt @@ -4,33 +4,6 @@ for more information on OSC see: http://cnmat.cnmat.berkeley.edu/OSC for more information on pure-data: http://lena.ucsd.edu/~msp/ and http://www.google.com/search?q=pure-data -Build: -linux, macosx: - -to build run -./configure -make -make install - -which installs the files in /usr/lib/pd/extra and /usr/lib/pd/doc - - -windows: -use extra/OSC.dll -.dsw and .dsp files are also included. You'll want to adapt include and link paths for pd and LIBOSC. - - -files: - -src/ contains the code for OSC pd objects (send,dump,route) -README.txt this file -doc/ pd help files -extra/ OSC.dll, the windows binary -libOSC/ CNMAT's OSC library -send+dump/ CNMAT's OSC commandline utils (with some changes) - http://cnmat.cnmat.berkeley.edu/OpenSoundControl/ - - log: 20050830: v0.3: (piotr@majdak.com) @@ -109,7 +82,28 @@ TODO -TCP mode -address space integration with pd patch/subpatch/receive hierarchy ? -see also TODO.txt in OSC/ +-pd object hierarchy extract and automatic address construction + a la [/hostname]/pd/patchname/subpatch/test ? + +-dynamic space allocation for message buffers. + + +changelog: + +20020903: refixed MAXPDARG vs. MAX_ARGS bug causind sendOSC to crash + with msgs longer than 5 argmuents. ? + +20020305: -typetags in send and receive + sendOSC by default now send typetagged msgs + and dumOSC properly reads and outputs them. + +prior: + + -added OSCroute with source adapt from max object. + -fixed shared htmsock bug + -added sendtyped separately earlier and lost it again + + -- jdl at xdv.org @@ -117,3 +111,23 @@ http://barely.a.live.fm/pd/OSC http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/pure-data/externals/OSCx/ windows version: raf at interaccess.com, http://207.208.254.239/pd/win32_osc_02.zip +OSC protocol inventory for OSC4PD + +sendOSC, dumpOSC, OSCroute +========================== + INCLUDES + * typed and untyped packing of OSC messages + * #bundle packing + * transmission of OSC messages via UDP socket + + * receive OSC messages on UDP socket + * unpacking of typed and untyped OSC messages + * #bundle unpacking + + * static address resolution + * pattern matching + + OMITS + * working with timetags + * all advanced protocol features of documentation, typesigs, etc + * connection oriented communication diff --git a/SConscript b/SConscript deleted file mode 100644 index 7b853be..0000000 --- a/SConscript +++ /dev/null @@ -1,17 +0,0 @@ -import glob -import os -import re -Import('env prefix') - -libOSC = glob.glob('libOSC/OSC*.c') -miscOSC = Split('src/htmsocket.c src/OSC-pattern-match.c src/OSC-system-dependent.c') - -for OSCexternal in Split('dumpOSC sendOSC OSC OSCroute'): - src = ["src/" + OSCexternal + ".c", libOSC, miscOSC] - if (OSCexternal == 'OSC'): - src.extend(Split('src/dumpOSC.c src/sendOSC.c src/OSCroute.c')) - OSCx = env.SharedLibrary(target = re.sub("\.c$","",os.path.basename(OSCexternal)), source = src, CCFLAGS = ['$CCFLAGS' , '-Wall', '-Wno-unused'],CPPPATH = ['$CPPPATH', 'libOSC']) - env.Alias('install', env.Install(os.path.join(prefix, 'extra'), OSCx)) - Default(OSCx) - -env.Alias('install', env.Install(os.path.join(prefix, 'doc/OSCx'), glob.glob('doc/*.pd'))) diff --git a/config.guess b/config.guess deleted file mode 100755 index dff9e48..0000000 --- a/config.guess +++ /dev/null @@ -1,1317 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. - -timestamp='2001-09-04' - -# 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 . -# Please send patches to . -# -# 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 build system type. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -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 0 ;; - --version | -v ) - echo "$version" ; exit 0 ;; - --help | --h* | -h ) - echo "$usage"; exit 0 ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - - -dummy=dummy-$$ -trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int dummy(){}" > $dummy.c ; - for c in cc gcc c89 ; do - ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; - if test $? = 0 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - rm -f $dummy.c $dummy.o $dummy.rel ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # Netbsd (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # Determine the machine/vendor (is the vendor relevant). - case "${UNAME_MACHINE}" in - amiga) machine=m68k-unknown ;; - arm32) machine=arm-unknown ;; - atari*) machine=m68k-atari ;; - sun3*) machine=m68k-sun ;; - mac68k) machine=m68k-apple ;; - macppc) machine=powerpc-apple ;; - hp3[0-9][05]) machine=m68k-hp ;; - ibmrt|romp-ibm) machine=romp-ibm ;; - *) machine=${UNAME_MACHINE}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE}" in - i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit 0 ;; - 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 - .data -\$Lformat: - .byte 37,100,45,37,120,10,0 # "%d-%x\n" - - .text - .globl main - .align 4 - .ent main -main: - .frame \$30,16,\$26,0 - ldgp \$29,0(\$27) - .prologue 1 - .long 0x47e03d80 # implver \$0 - lda \$2,-1 - .long 0x47e20c21 # amask \$2,\$1 - lda \$16,\$Lformat - mov \$0,\$17 - not \$1,\$18 - jsr \$26,printf - ldgp \$29,0(\$26) - mov 0,\$16 - jsr \$26,exit - .end main -EOF - eval $set_cc_for_build - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - case `./$dummy` in - 0-0) - UNAME_MACHINE="alpha" - ;; - 1-0) - UNAME_MACHINE="alphaev5" - ;; - 1-1) - UNAME_MACHINE="alphaev56" - ;; - 1-101) - UNAME_MACHINE="alphapca56" - ;; - 2-303) - UNAME_MACHINE="alphaev6" - ;; - 2-307) - UNAME_MACHINE="alphaev67" - ;; - 2-1307) - UNAME_MACHINE="alphaev68" - ;; - esac - fi - rm -f $dummy.s $dummy - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit 0 ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit 0 ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - 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 ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit 0 ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; - SR2?01:HI-UX/MPP:*:* | SR8000: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 ;; - sparc*:NetBSD:*) - echo `uname -p`-unknown-netbsd${UNAME_RELEASE} - exit 0 ;; - atari*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; - sun3*:OpenBSD:*:*) - echo m68k-unknown-openbsd${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 ;; - 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:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD $dummy.c -o $dummy \ - && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - 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 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit 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 ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit 0 ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $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:*:[45]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${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 BSD 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:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - case "${HPUX_REV}" in - 11.[0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - esac ;; - esac - fi ;; - esac - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #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 - (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` - if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi - rm -f $dummy.c $dummy - fi ;; - esac - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit 0 ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - 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_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $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 ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - 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 ;; - hppa*:OpenBSD:*:*) - echo hppa-unknown-openbsd - 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} | sed -e 's/\.[^.]*$/.X/' - 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/ \ - -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*T3D:*:*:*) - echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY-2:*:*:*) - echo cray2-cray-unicos - exit 0 ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-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 ;; - *: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 ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit 0 ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i386-pc-interix - exit 0 ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - 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 ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; - arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux - exit 0 ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - mips:Linux:*:*) - case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in - big) echo mips-unknown-linux-gnu && exit 0 ;; - little) echo mipsel-unknown-linux-gnu && exit 0 ;; - esac - ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit 0 ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit 0 ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit 0 ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac - exit 0 ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit 0 ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit 0 ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit 0 ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - ld_supported_targets=`cd /; ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit 0 ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - cat >$dummy.c < -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif -#ifdef __ELF__ -# ifdef __GLIBC__ -# if __GLIBC__ >= 2 - printf ("%s-pc-linux-gnu\n", argv[1]); -# else - printf ("%s-pc-linux-gnulibc1\n", argv[1]); -# endif -# else - printf ("%s-pc-linux-gnulibc1\n", argv[1]); -# endif -#else - printf ("%s-pc-linux-gnuaout\n", argv[1]); -#endif - return 0; -} -EOF - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 - ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit 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.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit 0 ;; - i*86:*:5:[78]*) - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit 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 - (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit 0 ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming 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]??A:*: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.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit 0 ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - 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:*: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 ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit 0 ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit 0 ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit 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 ;; - *:Darwin:*:*) - echo `uname -p`-apple-darwin${UNAME_RELEASE} - exit 0 ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - if test "${UNAME_MACHINE}" = "x86pc"; then - UNAME_MACHINE=pc - fi - echo `uname -p`-${UNAME_MACHINE}-nto-qnx - exit 0 ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit 0 ;; - NSR-[KW]:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit 0 ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit 0 ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit 0 ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit 0 ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit 0 ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit 0 ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit 0 ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit 0 ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit 0 ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit 0 ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit 0 ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - 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 - -eval $set_cc_for_build -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) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# 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_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $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 - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/config.h.in b/config.h.in deleted file mode 100644 index e69de29..0000000 diff --git a/config.sub b/config.sub deleted file mode 100755 index 393f13d..0000000 --- a/config.sub +++ /dev/null @@ -1,1411 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. - -timestamp='2001-09-07' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# 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. - -# Please send patches to . -# -# 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 -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 0 ;; - --version | -v ) - echo "$version" ; exit 0 ;; - --help | --h* | -h ) - echo "$usage"; exit 0 ;; - -- ) # 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 0;; - - * ) - 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* | storm-chaos* | os2-emx* | windows32-*) - 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) - 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] \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ - | c4x | clipper \ - | d10v | d30v | dsp16xx \ - | fr30 \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | m32r | m68000 | m68k | m88k | mcore \ - | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ - | mips64vr4100 | mips64vr4100el | mips64vr4300 \ - | mips64vr4300el | mips64vr5000 | mips64vr5000el \ - | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \ - | mipsisa32 \ - | mn10200 | mn10300 \ - | ns16k | ns32k \ - | openrisc \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ - | pyramid \ - | s390 | s390x \ - | sh | sh[34] | sh[34]eb | shbe | shle \ - | sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \ - | stormy16 | strongarm \ - | tahoe | thumb | tic80 | tron \ - | v850 \ - | we32k \ - | x86 | xscale \ - | z8k) - 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]-* \ - | alphapca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armv*-* \ - | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c54x-* \ - | clipper-* | cray2-* | cydra-* \ - | d10v-* | d30v-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | m32r-* \ - | m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | mcore-* \ - | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ - | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \ - | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ - | pyramid-* \ - | romp-* | rs6000-* \ - | s390-* | s390x-* \ - | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \ - | sparc-* | sparc64-* | sparc86x-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | stormy16-* | strongarm-* | sv1-* \ - | t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ - | v850-* | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \ - | ymp-* \ - | z8k-*) - ;; - # 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 - ;; - 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 - ;; - 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 - ;; - 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 | ymp) - basic_machine=ymp-cray - os=-unicos - ;; - cray2) - basic_machine=cray2-cray - os=-unicos - ;; - [cjt]90) - basic_machine=${basic_machine}-cray - os=-unicos - ;; - crds | unos) - basic_machine=m68k-crds - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - 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 - ;; - mipsel*-linux*) - basic_machine=mipsel-unknown - os=-linux-gnu - ;; - mips*-linux*) - basic_machine=mips-unknown - os=-linux-gnu - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - mmix*) - basic_machine=mmix-knuth - os=-mmixware - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - 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 - ;; - 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) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon) - basic_machine=i686-pc - ;; - pentiumii | pentium2) - basic_machine=i686-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-*) - basic_machine=i686-`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 - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sparclite-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=t3e-cray - os=-unicos - ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - 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 - ;; - windows32) - basic_machine=i386-pc - os=-windows32-msvcrt - ;; - xmp) - basic_machine=xmp-cray - os=-unicos - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - 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 - ;; - mips) - if [ x$os = x-linux-gnu ]; then - basic_machine=mips-unknown - else - basic_machine=mips-mips - fi - ;; - romp) - basic_machine=romp-ibm - ;; - 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 - ;; - sh3 | sh4 | sh3eb | sh4eb) - basic_machine=sh-unknown - ;; - sparc | 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 - ;; - c4x*) - basic_machine=c4x-none - os=-coff - ;; - *-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* | -netbsd* | -openbsd* | -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* | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto*) - os=-nto-qnx - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -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 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -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 - ;; - -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 - ;; - 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 - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-ibm) - os=-aix - ;; - *-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 - ;; - -ptx*) - vendor=sequent - ;; - -vxsim* | -vxworks*) - 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 0 - -# 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/configure b/configure deleted file mode 100755 index 3cb1e54..0000000 --- a/configure +++ /dev/null @@ -1,6647 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.63 for OSCxpd 0.2. -# -# Report bugs to . -# -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008 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 - - - - -# PATH needs CR -# 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_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 -if (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 - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -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. -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); exit 1; } -fi - -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# Required to use basename. -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 - - -# Name of the executable. -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'` - -# CDPATH. -$as_unset CDPATH - - -if test "x$CONFIG_SHELL" = x; then - if (eval ":") 2>/dev/null; then - as_have_required=yes -else - as_have_required=no -fi - - if test $as_have_required = yes && (eval ": -(as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test \$exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=\$LINENO - as_lineno_2=\$LINENO - test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && - test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } -") 2> /dev/null; then - : -else - as_candidate_shells= - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - case $as_dir in - /*) - for as_base in sh bash ksh sh5; do - as_candidate_shells="$as_candidate_shells $as_dir/$as_base" - done;; - esac -done -IFS=$as_save_IFS - - - for as_shell in $as_candidate_shells $SHELL; do - # Try only shells that exist, to save several forks. - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { ("$as_shell") 2> /dev/null <<\_ASEOF -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 - - -: -_ASEOF -}; then - CONFIG_SHELL=$as_shell - as_have_required=yes - if { "$as_shell" 2> /dev/null <<\_ASEOF -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_func_return () { - (exit $1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = "$1" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test $exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } - -_ASEOF -}; then - break -fi - -fi - - done - - if test "x$CONFIG_SHELL" != x; then - for as_var in BASH_ENV ENV - do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - done - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} -fi - - - if test $as_have_required = no; then - echo This script requires a shell more modern than all the - echo shells that I found on your system. Please install a - echo modern shell, or manually run the script under such a - echo shell if you do have one. - { (exit 1); exit 1; } -fi - - -fi - -fi - - - -(eval "as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test \$exitcode = 0") || { - echo No shell found that supports shell functions. - echo Please tell bug-autoconf@gnu.org about your system, - echo including any error possibly output before this message. - echo This can help us improve future autoconf versions. - echo Configuration will now proceed without shell functions. -} - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. 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 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in --n*) - case `echo 'x\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; - esac;; -*) - ECHO_N='-n';; -esac -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -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=: -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 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Identity of this package. -PACKAGE_NAME='OSCxpd' -PACKAGE_TARNAME='oscxpd' -PACKAGE_VERSION='0.2' -PACKAGE_STRING='OSCxpd 0.2' -PACKAGE_BUGREPORT='jdl@xdv.org' - -ac_unique_file="libOSC/OSC-client.h" -# 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" - -ac_subst_vars='LTLIBOBJS -INCLUDES -pd_suffix -LIBOSC -LIBOBJS -EGREP -GREP -CPP -LN_S -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -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_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -with_pd_dir -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP' - - -# 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_TARNAME}' -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=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_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } - 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_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } - 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_echo "$as_me: error: invalid package name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } - 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_echo "$as_me: error: invalid package name: $ac_useropt" >&2 - { (exit 1); exit 1; }; } - 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_echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - 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_echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 - { (exit 1); exit 1; }; } ;; - *) $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_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; } -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_echo "$as_me: error: working directory cannot be determined" >&2 - { (exit 1); exit 1; }; } -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 - { (exit 1); exit 1; }; } - - -# 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_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 - { (exit 1); exit 1; }; } - 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 OSCxpd 0.2 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/oscxpd] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of OSCxpd 0.2:";; - esac - cat <<\_ACEOF - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-pd-dir=path pd header path (default=/usr/local/include) - -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 C/C++/Objective C preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to . -_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 -OSCxpd configure 0.2 -generated by GNU Autoconf 2.63 - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 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 -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 OSCxpd $as_me 0.2, which was -generated by GNU Autoconf 2.63. 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) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; - 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - ac_configure_args="$ac_configure_args '$ac_arg'" - ;; - esac - done -done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: 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 - - cat <<\_ASBOX -## ---------------- ## -## Cache variables. ## -## ---------------- ## -_ASBOX - 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:$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= ;; #( - *) $as_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 - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - 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 - cat <<\_ASBOX -## ------------------- ## -## File substitutions. ## -## ------------------- ## -_ASBOX - 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 - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - 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'; { (exit 1); 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 - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - ac_site_file1=$CONFIG_SITE -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 -r "$ac_site_file"; then - { $as_echo "$as_me:$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" - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { $as_echo "$as_me:$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:$LINENO: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $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:$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:$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:$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:$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:$LINENO: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:$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. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:$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_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } -fi - - - - - - - - - - - - - - - - - - - - - - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -ac_config_headers="$ac_config_headers config.h" - - -# get system type -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_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 -$as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} - { (exit 1); exit 1; }; } -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_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 -$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} - { (exit 1); exit 1; }; } - -{ $as_echo "$as_me:$LINENO: checking build system type" >&5 -$as_echo_n "checking build system type... " >&6; } -if test "${ac_cv_build+set}" = set; 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_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 -$as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;} - { (exit 1); exit 1; }; } -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 -$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5 -$as_echo "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 -$as_echo "$as_me: error: invalid value of canonical build" >&2;} - { (exit 1); exit 1; }; };; -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:$LINENO: checking host system type" >&5 -$as_echo_n "checking host system type... " >&6; } -if test "${ac_cv_host+set}" = set; 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_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 -$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} - { (exit 1); exit 1; }; } -fi - -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5 -$as_echo "$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 -$as_echo "$as_me: error: invalid value of canonical host" >&2;} - { (exit 1); exit 1; }; };; -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 - - - -# Checks for programs. -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:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; 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:$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:$LINENO: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; 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:$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:$LINENO: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:$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:$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:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; 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:$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:$LINENO: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; 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:$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:$LINENO: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; 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:$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:$LINENO: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:$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:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; 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:$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:$LINENO: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:$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:$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:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } - -# Provide some information about the compiler. -$as_echo "$as_me:$LINENO: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -{ (ac_try="$ac_compiler --version >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compiler --version >&5") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -v >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compiler -v >&5") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -V >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compiler -V >&5") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.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:$LINENO: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; 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 - -{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -if test -z "$ac_file"; then - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } -fi - -ac_exeext=$ac_cv_exeext - -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } - fi - fi -fi -{ $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -{ $as_echo "$as_me:$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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } -fi - -rm -f conftest$ac_cv_exeext -{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { (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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; 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:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } -fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:$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 test "${ac_cv_c_compiler_gnu+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_compiler_gnu=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - 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:$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:$LINENO: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; 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 >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_g=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - CFLAGS="" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_g=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -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:$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:$LINENO: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#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" - 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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_c89=$ac_arg -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -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:$LINENO: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:$LINENO: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -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:$LINENO: checking whether ln -s works" >&5 -$as_echo_n "checking whether ln -s works... " >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:$LINENO: result: no, using $LN_S" >&5 -$as_echo "no, using $LN_S" >&6; } -fi - -# AC_PROG_CXX -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:$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 test "${ac_cv_prog_CPP+set}" = set; 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 >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:$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 >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi - -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - # Broken: success on invalid input. -continue -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi - -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -# AC_PROG_INSTALL - -echo "default flags" -# echo "$CPPFLAGS" -# echo "$CXXFLAGS" -echo cflags "$CFLAGS" -echo ldflags "$LDFLAGS" - -# Checks for libraries. -# FIXME: Replace `main' with a function in `-lc': - - -{ $as_echo "$as_me:$LINENO: checking for main in -lc" >&5 -$as_echo_n "checking for main in -lc... " >&6; } -if test "${ac_cv_lib_c_main+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lc $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - - -int -main () -{ -return main (); - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - 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_cv_lib_c_main=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_c_main=no -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_c_main" >&5 -$as_echo "$ac_cv_lib_c_main" >&6; } -if test "x$ac_cv_lib_c_main" = x""yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBC 1 -_ACEOF - - LIBS="-lc $LIBS" - -fi - -# FIXME: Replace `main' with a function in `-lm': - -{ $as_echo "$as_me:$LINENO: checking for main in -lm" >&5 -$as_echo_n "checking for main in -lm... " >&6; } -if test "${ac_cv_lib_m_main+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lm $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - - -int -main () -{ -return main (); - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - 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_cv_lib_m_main=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_m_main=no -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_m_main" >&5 -$as_echo "$ac_cv_lib_m_main" >&6; } -if test "x$ac_cv_lib_m_main" = x""yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBM 1 -_ACEOF - - LIBS="-lm $LIBS" - -fi - - -# Checks for header files. - -{ $as_echo "$as_me:$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 test "${ac_cv_path_GREP+set}" = set; 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 - ac_count=`expr $ac_count + 1` - 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_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:$LINENO: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; 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 - ac_count=`expr $ac_count + 1` - 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_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_header_stdc=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - 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 >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* 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 >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* 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 >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* 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 -rm -f 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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -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 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -fi -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do -as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - eval "$as_ac_Header=yes" -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_Header=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - - - - - - - - - - - - - -for ac_header in arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h unistd.h sys/prctl.h -do -as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 -$as_echo_n "checking $ac_header usability... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 -$as_echo_n "checking $ac_header presence... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## -------------------------- ## -## Report this to jdl@xdv.org ## -## -------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - -fi -as_val=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -# Checks for typedefs, structures, and compiler characteristics. -{ $as_echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5 -$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } -if test "${ac_cv_header_stdbool_h+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include -#ifndef bool - "error: bool is not defined" -#endif -#ifndef false - "error: false is not defined" -#endif -#if false - "error: false is not 0" -#endif -#ifndef true - "error: true is not defined" -#endif -#if true != 1 - "error: true is not 1" -#endif -#ifndef __bool_true_false_are_defined - "error: __bool_true_false_are_defined is not defined" -#endif - - struct s { _Bool s: 1; _Bool t; } s; - - char a[true == 1 ? 1 : -1]; - char b[false == 0 ? 1 : -1]; - char c[__bool_true_false_are_defined == 1 ? 1 : -1]; - char d[(bool) 0.5 == true ? 1 : -1]; - bool e = &s; - char f[(_Bool) 0.0 == false ? 1 : -1]; - char g[true]; - char h[sizeof (_Bool)]; - char i[sizeof s.t]; - enum { j = false, k = true, l = false * true, m = true * 256 }; - /* The following fails for - HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ - _Bool n[m]; - char o[sizeof n == m * sizeof n[0] ? 1 : -1]; - char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; -# if defined __xlc__ || defined __GNUC__ - /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 - reported by James Lemley on 2005-10-05; see - http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html - This test is not quite right, since xlc is allowed to - reject this program, as the initializer for xlcbug is - not one of the forms that C requires support for. - However, doing the test right would require a runtime - test, and that would make cross-compilation harder. - Let us hope that IBM fixes the xlc bug, and also adds - support for this kind of constant expression. In the - meantime, this test will reject xlc, which is OK, since - our stdbool.h substitute should suffice. We also test - this with GCC, where it should work, to detect more - quickly whether someone messes up the test in the - future. */ - char digs[] = "0123456789"; - int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); -# endif - /* Catch a bug in an HP-UX C compiler. See - http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html - http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html - */ - _Bool q = true; - _Bool *pq = &q; - -int -main () -{ - - *pq |= q; - *pq |= ! q; - /* Refer to every declared value, to avoid compiler optimizations. */ - return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l - + !m + !n + !o + !p + !q + !pq); - - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_header_stdbool_h=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_stdbool_h=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5 -$as_echo "$ac_cv_header_stdbool_h" >&6; } -{ $as_echo "$as_me:$LINENO: checking for _Bool" >&5 -$as_echo_n "checking for _Bool... " >&6; } -if test "${ac_cv_type__Bool+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_cv_type__Bool=no -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if (sizeof (_Bool)) - return 0; - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if (sizeof ((_Bool))) - return 0; - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type__Bool=yes -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5 -$as_echo "$ac_cv_type__Bool" >&6; } -if test "x$ac_cv_type__Bool" = x""yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE__BOOL 1 -_ACEOF - - -fi - -if test $ac_cv_header_stdbool_h = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_STDBOOL_H 1 -_ACEOF - -fi - -{ $as_echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 -$as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if test "${ac_cv_c_const+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -/* FIXME: Include the comments suggested by Paul. */ -#ifndef __cplusplus - /* Ultrix mips cc rejects this. */ - typedef int charset[2]; - const charset 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 -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_c_const=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_c_const=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 -$as_echo "$ac_cv_c_const" >&6; } -if test $ac_cv_c_const = no; then - -cat >>confdefs.h <<\_ACEOF -#define const /**/ -_ACEOF - -fi - -{ $as_echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 -$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } -if test "${ac_cv_header_time+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include - -int -main () -{ -if ((struct tm *) 0) -return 0; - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_header_time=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_time=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 -$as_echo "$ac_cv_header_time" >&6; } -if test $ac_cv_header_time = yes; then - -cat >>confdefs.h <<\_ACEOF -#define TIME_WITH_SYS_TIME 1 -_ACEOF - -fi - -{ $as_echo "$as_me:$LINENO: checking for size_t" >&5 -$as_echo_n "checking for size_t... " >&6; } -if test "${ac_cv_type_size_t+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_cv_type_size_t=no -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if (sizeof (size_t)) - return 0; - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if (sizeof ((size_t))) - return 0; - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_size_t=yes -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 -$as_echo "$ac_cv_type_size_t" >&6; } -if test "x$ac_cv_type_size_t" = x""yes; then - : -else - -cat >>confdefs.h <<_ACEOF -#define size_t unsigned int -_ACEOF - -fi - - -# Checks for library functions. - -for ac_header in stdlib.h -do -as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 -$as_echo_n "checking $ac_header usability... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 -$as_echo_n "checking $ac_header presence... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## -------------------------- ## -## Report this to jdl@xdv.org ## -## -------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - -fi -as_val=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - -{ $as_echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5 -$as_echo_n "checking for GNU libc compatible malloc... " >&6; } -if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_malloc_0_nonnull=no -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#if defined STDC_HEADERS || defined HAVE_STDLIB_H -# include -#else -char *malloc (); -#endif - -int -main () -{ -return ! malloc (0); - ; - return 0; -} -_ACEOF -rm -f 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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { 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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_malloc_0_nonnull=yes -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 - -( exit $ac_status ) -ac_cv_func_malloc_0_nonnull=no -fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5 -$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } -if test $ac_cv_func_malloc_0_nonnull = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_MALLOC 1 -_ACEOF - -else - cat >>confdefs.h <<\_ACEOF -#define HAVE_MALLOC 0 -_ACEOF - - case " $LIBOBJS " in - *" malloc.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS malloc.$ac_objext" - ;; -esac - - -cat >>confdefs.h <<\_ACEOF -#define malloc rpl_malloc -_ACEOF - -fi - - - - - -for ac_header in sys/select.h sys/socket.h -do -as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 -$as_echo_n "checking $ac_header usability... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 -$as_echo_n "checking $ac_header presence... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## -------------------------- ## -## Report this to jdl@xdv.org ## -## -------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - -fi -as_val=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - -{ $as_echo "$as_me:$LINENO: checking types of arguments for select" >&5 -$as_echo_n "checking types of arguments for select... " >&6; } -if test "${ac_cv_func_select_args+set}" = set; then - $as_echo_n "(cached) " >&6 -else - for ac_arg234 in 'fd_set *' 'int *' 'void *'; do - for ac_arg1 in 'int' 'size_t' 'unsigned long int' 'unsigned int'; do - for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#ifdef HAVE_SYS_SELECT_H -# include -#endif -#ifdef HAVE_SYS_SOCKET_H -# include -#endif - -int -main () -{ -extern int select ($ac_arg1, - $ac_arg234, $ac_arg234, $ac_arg234, - $ac_arg5); - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done - done -done -# Provide a safe default value. -: ${ac_cv_func_select_args='int,int *,struct timeval *'} - -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_select_args" >&5 -$as_echo "$ac_cv_func_select_args" >&6; } -ac_save_IFS=$IFS; IFS=',' -set dummy `echo "$ac_cv_func_select_args" | sed 's/\*/\*/g'` -IFS=$ac_save_IFS -shift - -cat >>confdefs.h <<_ACEOF -#define SELECT_TYPE_ARG1 $1 -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define SELECT_TYPE_ARG234 ($2) -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define SELECT_TYPE_ARG5 ($3) -_ACEOF - -rm -f conftest* - - -for ac_func in vprintf -do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* 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 $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif - -int -main () -{ -return $ac_func (); - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - 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 - eval "$as_ac_var=yes" -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_var=no" -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -{ $as_echo "$as_me:$LINENO: checking for _doprnt" >&5 -$as_echo_n "checking for _doprnt... " >&6; } -if test "${ac_cv_func__doprnt+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define _doprnt to an innocuous variant, in case declares _doprnt. - For example, HP-UX 11i declares gettimeofday. */ -#define _doprnt innocuous__doprnt - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char _doprnt (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef _doprnt - -/* 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 _doprnt (); -/* 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__doprnt || defined __stub____doprnt -choke me -#endif - -int -main () -{ -return _doprnt (); - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - 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_cv_func__doprnt=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_func__doprnt=no -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5 -$as_echo "$ac_cv_func__doprnt" >&6; } -if test "x$ac_cv_func__doprnt" = x""yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_DOPRNT 1 -_ACEOF - -fi - -fi -done - - - - - - - - -for ac_func in bzero gethostbyname inet_ntoa select socket strchr -do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* 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 $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif - -int -main () -{ -return $ac_func (); - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - 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 - eval "$as_ac_var=yes" -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_var=no" -fi - -rm -rf conftest.dSYM -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext -fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - -{ $as_echo "$as_me:$LINENO: checking return type of signal handlers" >&5 -$as_echo_n "checking return type of signal handlers... " >&6; } -if test "${ac_cv_type_signal+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include - -int -main () -{ -return *(signal (0, 0)) (0) == 1; - ; - return 0; -} -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_type_signal=int -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_signal=void -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:$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 - - - -# from augusts template - - -INCLUDES="-I../libOSC -I../../pd/src -I../../../pd/src -I../src" -LIBOSC=libOSC.a -if test -z "$GCC"; then - case $host in - *-*-irix*) - if test -z "$CC"; then - CC=cc - fi - ;; - sparc-sun-solaris*) - CFLAGS="-xO4 -fast -w -fsimple -native -xcg92" - ;; - *) - CFLAGS="-O" - ;; - esac -else - case $host in - *86*-linux*) - CFLAGS="$CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes -O2 -fPIC" - LDFLAGS="-rdynamic -shared" - pd_suffix=pd_linux - LIBS="-lc -lm" - ;; - powerpc-*-linux*) - CFLAGS="$CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes -O1" - LDFLAGS="-rdynamic -shared" - pd_suffix=pd_linux - LIBS="-lc -lm" - ;; - *-*-linux*) - CFLAGS="$CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes -O1" - LDFLAGS="-rdynamic -shared" - INCLUDES="$INCLUDES" - pd_suffix=pd_linux - LIBS="-L../../../pd/bin -lpd -lc -lm" - ;; - sparc-sun-*) - echo "YOU HAVE A SPARC STATION, not setting any flags, not supported yet" - ;; - *-*-cygwin*) - CFLAGS="$CFLAGS -mno-cygwin -Wall -Wimplicit -Wunused -Wmissing-prototypes -O3 " - LDFLAGS="-rdynamic -shared" - INCLUDES="$INCLUDES -I../../../pd/src -I/cygdrive/MinGW/include" - pd_suffix=dll - LIBS="-L../../../pd/src -L../../../pd/bin -L../../../pd/obj -lpd -lm -lwsock32" - ;; - *-*-mingw*) - CFLAGS="$CFLAGS -mms-bitfields -Wall -Wimplicit -Wunused -Wmissing-prototypes -O3 " - LDFLAGS="-shared" - INCLUDES="$INCLUDES -I../../../pd/src" - pd_suffix=dll - LIBS="-L../../../pd/src -L../../../pd/bin -L../../../pd/obj -lpd -lm -lwsock32" - ;; - *-*-darwin*) - CFLAGS="$CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes -O3 " - LDFLAGS=" -bundle -bundle_loader ../../../pd/src/pd -undefined dynamic_lookup " - pd_suffix=pd_darwin - LIBS="-lc -lm" - ;; - *) - CFLAGS="$CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes -O1" - LDFLAGS="-rdynamic -shared" - pd_suffix=pd_linux - LIBS="-lc -lm" - ;; - esac -fi - -CFLAGS="$CFLAGS $INCLUDES" - -echo "Using cflags= $CFLAGS" -echo "Using ldflags= $LDFLAGS" -echo "Using includes= $INCLUDES" - - - - -# Check whether --with-pd_dir was given. -if test "${with_pd_dir+set}" = set; then - withval=$with_pd_dir; - CPPFLAGS="$CPPFLAGS -I$withval" - echo - echo "pd dir is $withval" - echo - -fi - - -if test $prefix == NONE; -then - prefix=/usr/local -fi - -if test "${ac_cv_header_m_pd_h+set}" = set; then - { $as_echo "$as_me:$LINENO: checking for m_pd.h" >&5 -$as_echo_n "checking for m_pd.h... " >&6; } -if test "${ac_cv_header_m_pd_h+set}" = set; then - $as_echo_n "(cached) " >&6 -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_m_pd_h" >&5 -$as_echo "$ac_cv_header_m_pd_h" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking m_pd.h usability" >&5 -$as_echo_n "checking m_pd.h usability... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:$LINENO: checking m_pd.h presence" >&5 -$as_echo_n "checking m_pd.h presence... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -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:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$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:$LINENO: WARNING: m_pd.h: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: m_pd.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: m_pd.h: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: m_pd.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: m_pd.h: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: m_pd.h: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: m_pd.h: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: m_pd.h: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: m_pd.h: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: m_pd.h: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: m_pd.h: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: m_pd.h: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: m_pd.h: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: m_pd.h: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: m_pd.h: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: m_pd.h: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## -------------------------- ## -## Report this to jdl@xdv.org ## -## -------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ $as_echo "$as_me:$LINENO: checking for m_pd.h" >&5 -$as_echo_n "checking for m_pd.h... " >&6; } -if test "${ac_cv_header_m_pd_h+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_cv_header_m_pd_h=$ac_header_preproc -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_m_pd_h" >&5 -$as_echo "$ac_cv_header_m_pd_h" >&6; } - -fi -if test "x$ac_cv_header_m_pd_h" = x""yes; then - have_pd_hdr=yes -else - - have_pd_hdr=no - echo - echo "no m_pd.h header found. try with option --with-pd-dir=/path/to/pd/src" - echo - exit - -fi - - - - - - - - - -ac_config_files="$ac_config_files src/Makefile libOSC/Makefile send+dump/Makefile 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:$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= ;; #( - *) $as_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 - test "x$cache_file" != "x/dev/null" && - { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file - else - { $as_echo "$as_me:$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= -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. - ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - -: ${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:$LINENO: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF || ac_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} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_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 - - - - -# PATH needs CR -# 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_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 -if (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 - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -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. -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); exit 1; } -fi - -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# Required to use basename. -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 - - -# Name of the executable. -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'` - -# CDPATH. -$as_unset CDPATH - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. 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 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in --n*) - case `echo 'x\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; - esac;; -*) - ECHO_N='-n';; -esac -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -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=: -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 - -# 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 OSCxpd $as_me 0.2, which was -generated by GNU Autoconf 2.63. 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" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTION]... [FILE]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, 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 - -Report bugs to ." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_version="\\ -OSCxpd config.status 0.2 -configured by $0, generated by GNU Autoconf 2.63, - with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" - -Copyright (C) 2008 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' -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=$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 ;; - --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"` ;; - esac - CONFIG_FILES="$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 - CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'" - ac_need_defaults=false;; - --he | --h) - # Conflict between --help and --header - { $as_echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; };; - --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_echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" - 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 -_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" ;; - "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; - "libOSC/Makefile") CONFIG_FILES="$CONFIG_FILES libOSC/Makefile" ;; - "send+dump/Makefile") CONFIG_FILES="$CONFIG_FILES send+dump/Makefile" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - - *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason 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= - trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status -' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || -{ - $as_echo "$as_me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -# 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=' ' -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 {' >"$tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } -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_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } - - 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_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } - 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 >>"\$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 >>"\$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 < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 -$as_echo "$as_me: error: could not setup config files machinery" >&2;} - { (exit 1); exit 1; }; } -_ACEOF - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ -s/:*$// -s/^[^=]*=[ ]*$// -}' -fi - -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 >"$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_t=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_t"; then - break - elif $ac_last_try; then - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;} - { (exit 1); exit 1; }; } - 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_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5 -$as_echo "$as_me: error: could not setup config headers machinery" >&2;} - { (exit 1); exit 1; }; } -fi # test -n "$CONFIG_HEADERS" - - -eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " -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_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 -$as_echo "$as_me: error: invalid tag $ac_tag" >&2;} - { (exit 1); exit 1; }; };; - :[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="$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_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 -$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} - { (exit 1); exit 1; }; };; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - ac_file_inputs="$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:$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 >"$tmp/stdin" \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } ;; - 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" - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { - 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_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} - { (exit 1); exit 1; }; }; } - 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 - # - -_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:$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 -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:$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 "$tmp/stdin" - case $ac_file in - -) cat "$tmp/out" && rm -f "$tmp/out";; - *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; - esac \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } - ;; - :H) - # - # CONFIG_HEADER - # - if test x"$ac_file" != x-; then - { - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" - } >"$tmp/config.h" \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } - if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} - else - rm -f "$ac_file" - mv "$tmp/config.h" "$ac_file" \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } - fi - else - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ - || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5 -$as_echo "$as_me: error: could not create -" >&2;} - { (exit 1); exit 1; }; } - fi - ;; - - - esac - -done # for ac_tag - - -{ (exit 0); exit 0; } -_ACEOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 9e375c7..0000000 --- a/configure.ac +++ /dev/null @@ -1,181 +0,0 @@ -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.57) -AC_INIT(OSCxpd, 0.2, jdl@xdv.org) -AC_CONFIG_SRCDIR([libOSC/OSC-client.h]) -AC_CONFIG_HEADER([config.h]) - -# get system type -AC_CANONICAL_HOST - -# Checks for programs. -AC_PROG_CC -AC_PROG_LN_S -# AC_PROG_CXX -AC_PROG_CPP -# AC_PROG_INSTALL - -dnl ---------------------------------- -dnl here you can see that autoconf adds "-g -02" as a default -dnl these are flags for debugging, and will add extra weight -dnl to you external. CFLAGS, CPPFLAGS, etc are default variables -dnl ---------------------------------- -echo "default flags" -# echo "$CPPFLAGS" -# echo "$CXXFLAGS" -echo cflags "$CFLAGS" -echo ldflags "$LDFLAGS" - -# Checks for libraries. -# FIXME: Replace `main' with a function in `-lc': -AC_CHECK_LIB([c], [main]) -# FIXME: Replace `main' with a function in `-lm': -AC_CHECK_LIB([m], [main]) - -# Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h unistd.h sys/prctl.h]) - -# Checks for typedefs, structures, and compiler characteristics. -AC_HEADER_STDBOOL -AC_C_CONST -AC_HEADER_TIME -AC_TYPE_SIZE_T - -# Checks for library functions. -AC_FUNC_MALLOC -AC_FUNC_SELECT_ARGTYPES -AC_FUNC_VPRINTF -AC_CHECK_FUNCS([bzero gethostbyname inet_ntoa select socket strchr]) -AC_TYPE_SIGNAL - -# from augusts template - -dnl ------------------------------------------ -dnl for each of the *-*-host's in the following, do the checking and then set your CFLAGS, CPPFLAGS and LDFLAGS -dnl CFLAGS get set for C code, CPPFLAGS for c++ code. LDFLAGS is the linking flags for both c and c++ -dnl ------------------------------------------ - -INCLUDES="-I../libOSC -I../../pd/src -I../../../pd/src -I../src" -LIBOSC=libOSC.a -if test -z "$GCC"; then - case $host in - *-*-irix*) - dnl If we're on IRIX, we wanna use cc even if gcc - dnl is there (unless the user has overriden us)... - if test -z "$CC"; then - CC=cc - fi - ;; - sparc-sun-solaris*) - CFLAGS="-xO4 -fast -w -fsimple -native -xcg92" - ;; - *) - CFLAGS="-O" - ;; - esac -else - case $host in - *86*-linux*) - CFLAGS="$CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes -O2 -fPIC" - LDFLAGS="-rdynamic -shared" - dnl we could test for bad glibc here, but don't - pd_suffix=pd_linux - LIBS="-lc -lm" - ;; - powerpc-*-linux*) - CFLAGS="$CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes -O1" - LDFLAGS="-rdynamic -shared" - pd_suffix=pd_linux - LIBS="-lc -lm" - ;; - *-*-linux*) - CFLAGS="$CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes -O1" - LDFLAGS="-rdynamic -shared" - INCLUDES="$INCLUDES" - pd_suffix=pd_linux - LIBS="-L../../../pd/bin -lpd -lc -lm" - ;; - sparc-sun-*) - echo "YOU HAVE A SPARC STATION, not setting any flags, not supported yet" - ;; - *-*-cygwin*) - CFLAGS="$CFLAGS -mno-cygwin -Wall -Wimplicit -Wunused -Wmissing-prototypes -O3 " - LDFLAGS="-rdynamic -shared" - INCLUDES="$INCLUDES -I../../../pd/src -I/cygdrive/MinGW/include" - pd_suffix=dll - LIBS="-L../../../pd/src -L../../../pd/bin -L../../../pd/obj -lpd -lm -lwsock32" - ;; - *-*-mingw*) - CFLAGS="$CFLAGS -mms-bitfields -Wall -Wimplicit -Wunused -Wmissing-prototypes -O3 " - LDFLAGS="-shared" - INCLUDES="$INCLUDES -I../../../pd/src" - pd_suffix=dll - LIBS="-L../../../pd/src -L../../../pd/bin -L../../../pd/obj -lpd -lm -lwsock32" - ;; - *-*-darwin*) - CFLAGS="$CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes -O3 " - LDFLAGS=" -bundle -bundle_loader ../../../pd/src/pd -undefined dynamic_lookup " - pd_suffix=pd_darwin - LIBS="-lc -lm" - ;; - *) - dnl assume unix - CFLAGS="$CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes -O1" - LDFLAGS="-rdynamic -shared" - pd_suffix=pd_linux - LIBS="-lc -lm" - ;; - esac -fi - -CFLAGS="$CFLAGS $INCLUDES" - -echo "Using cflags= $CFLAGS" -echo "Using ldflags= $LDFLAGS" -echo "Using includes= $INCLUDES" - - - -dnl ------------------------------------------ -dnl ---- add PureData includes dir -dnl ---- usually /usr/local/include -dnl ------------------------------------------ -AC_ARG_WITH(pd_dir, - [ --with-pd-dir=path pd header path (default=/usr/local/include) ], - [ - CPPFLAGS="$CPPFLAGS -I$withval" - echo - echo "pd dir is $withval" - echo - ]) - -if test $prefix == NONE; -then - prefix=/usr/local -fi - -dnl ------------------------------------------ -dnl ---- check for PureData Header -dnl ------------------------------------------ -AC_CHECK_HEADER(m_pd.h, [have_pd_hdr=yes ], [ - have_pd_hdr=no - echo - echo "no m_pd.h header found. try with option --with-pd-dir=/path/to/pd/src" - echo - exit - ]) - - -AC_SUBST(LIBOSC) -AC_SUBST(pd_suffix) -AC_SUBST(INCLUDES) -AC_SUBST(CFLAGS) - -AC_CONFIG_FILES([src/Makefile - libOSC/Makefile - send+dump/Makefile - Makefile]) - -AC_OUTPUT diff --git a/doc/OSC-help.pd b/doc/OSC-help.pd deleted file mode 100644 index 90c532b..0000000 --- a/doc/OSC-help.pd +++ /dev/null @@ -1,10 +0,0 @@ -#N canvas 608 335 565 311 12; -#X obj 21 149 sendOSC-help; -#X obj 21 174 dumpOSC-help; -#X obj 21 200 OSCroute-help; -#X obj 17 43 OSC; -#X msg 17 19 version; -#X text 15 79 1 click sendOSC-help 2 click connect button 3 randomly -click the 3 available messages 4 watch console; -#X text 102 19 version 0.16; -#X connect 4 0 3 0; diff --git a/doc/OSCroute-help.pd b/doc/OSCroute-help.pd deleted file mode 100644 index d00336f..0000000 --- a/doc/OSCroute-help.pd +++ /dev/null @@ -1,98 +0,0 @@ -#N canvas 112 247 505 361 10; -#X msg 20 72 version; -#X obj 86 72 r rcvOSC; -#X obj 86 109 OSCroute /test /ix /yps; -#X obj 161 143 print ix; -#X obj 242 142 print yps; -#X obj 85 183 OSCroute /bla /bli /blo; -#X obj 85 212 unpack f f f; -#X floatatom 85 239 4 0 0 0 - - -; -#X floatatom 124 239 4 0 0 0 - - -; -#X floatatom 164 239 4 0 0 0 - - -; -#X text 20 11 OSCroute works pretty much like route but outputs remainder -of routing tag after match.; -#X obj 68 143 print test; -#X obj 241 212 print rejected; -#N canvas 663 325 676 351 patternmatching 0; -#X obj 26 242 OSCroute /freq; -#X obj 150 242 OSCroute /freq; -#X obj 272 241 OSCroute /freq; -#X msg 81 115 /*/freq 23 45 67; -#X obj 72 201 OSCroute /inst1 /inst2 /inst3; -#X obj 26 266 unpack f f f; -#X floatatom 26 287 3 0 0 0 - - -; -#X floatatom 65 287 3 0 0 0 - - -; -#X floatatom 105 287 3 0 0 0 - - -; -#X obj 150 265 unpack f f f; -#X floatatom 150 286 3 0 0 0 - - -; -#X floatatom 189 286 3 0 0 0 - - -; -#X floatatom 229 286 3 0 0 0 - - -; -#X obj 272 265 unpack f f f; -#X floatatom 272 286 3 0 0 0 - - -; -#X floatatom 311 286 3 0 0 0 - - -; -#X floatatom 351 286 3 0 0 0 - - -; -#X msg 55 44 /inst1/freq 100 200 300; -#X msg 64 66 /inst2/freq 111 222 333; -#X msg 70 88 /inst3/freq 321 432 543; -#X text 45 116 4->; -#X text 37 89 3->; -#X text 30 67 2->; -#X text 22 45 1->; -#X text 11 7 took me a while to figure this out \, somehow i always -thought it should work the other way round:; -#X msg 96 145 /inst[12]/freq 0 99 88; -#X msg 119 174 /inst?/freq 22.33 44.55 66.77; -#X text 367 48 well \, now it does \, crudely:; -#X obj 375 130 OSCroute /*; -#X msg 375 80 /test1/data 1 2 3; -#X msg 401 103 /test2/data 3.4 5 1; -#X obj 447 157 print rejected; -#X obj 375 184 print routed; -#X connect 0 0 5 0; -#X connect 1 0 9 0; -#X connect 2 0 13 0; -#X connect 3 0 4 0; -#X connect 4 0 0 0; -#X connect 4 1 1 0; -#X connect 4 2 2 0; -#X connect 5 0 6 0; -#X connect 5 1 7 0; -#X connect 5 2 8 0; -#X connect 9 0 10 0; -#X connect 9 1 11 0; -#X connect 9 2 12 0; -#X connect 13 0 14 0; -#X connect 13 1 15 0; -#X connect 13 2 16 0; -#X connect 17 0 4 0; -#X connect 18 0 4 0; -#X connect 19 0 4 0; -#X connect 25 0 4 0; -#X connect 26 0 4 0; -#X connect 28 0 32 0; -#X connect 28 1 31 0; -#X connect 29 0 28 0; -#X connect 30 0 28 0; -#X restore 288 57 pd patternmatching; -#X text 184 57 check here =>; -#X text 239 235 last outlet emits all non-matches; -#X text 252 269 -OSC patterns that didnt match; -#X text 239 252 (like classic route):; -#X text 252 280 -patterns not starting with /; -#X text 252 294 -patterns starting with a number; -#X text 325 324 2002-09-08 \, jdl xdv.org; -#X text 28 318 for more info \, get help on:; -#X obj 226 317 OSC; -#X connect 0 0 2 0; -#X connect 1 0 2 0; -#X connect 2 0 5 0; -#X connect 2 0 11 0; -#X connect 2 1 3 0; -#X connect 2 1 5 0; -#X connect 2 2 4 0; -#X connect 2 2 5 0; -#X connect 5 0 6 0; -#X connect 5 3 12 0; -#X connect 6 0 7 0; -#X connect 6 1 8 0; -#X connect 6 2 9 0; diff --git a/doc/dumpOSC-help.pd b/doc/dumpOSC-help.pd deleted file mode 100644 index ac1ec7a..0000000 --- a/doc/dumpOSC-help.pd +++ /dev/null @@ -1,11 +0,0 @@ -#N canvas 53 212 477 223 12; -#X obj 17 105 print rcvOSC; -#X obj 17 53 dumpOSC 9999; -#X obj 45 78 s rcvOSC; -#X text 15 7 dumpOSC listens on specified port / UDP \, outputs everything -received on its only outlet. seems to be pretty stable.; -#X text 130 52 one argument: portnumber; -#X text 130 72 two arguments: castgroup portnumber; -#X text 76 164 [dumpOSC] needs at least one argument to function; -#X connect 1 0 0 0; -#X connect 1 0 2 0; diff --git a/doc/sendOSC-help.pd b/doc/sendOSC-help.pd deleted file mode 100644 index f0c92a1..0000000 --- a/doc/sendOSC-help.pd +++ /dev/null @@ -1,62 +0,0 @@ -#N canvas 496 472 856 475 10; -#X obj 59 396 sendOSC; -#X floatatom 59 423 5 0 0 0 - - -; -#X msg 44 119 disconnect; -#X msg 79 163 send /test/bla 1 2 3; -#X msg 26 93 connect localhost 9999; -#X msg 91 187 send /ix/bli 4 fuenf 6; -#X msg 103 211 send /yps/blo 7.8 9.1 zehnkommaelf; -#X text 8 142 ========================================; -#X msg 274 92 connect localhost 10001; -#X msg 149 301 typetags 1; -#X msg 144 333 typetags 0; -#X text 475 112 typetags; -#X text 475 129 sendOSC now by default uses; -#X text 477 145 typetags.; -#X text 477 166 dumOSC on the other hand; -#X text 477 186 should be able to interpret; -#X text 478 208 this.; -#X text 474 93 new (or again):; -#X msg 423 294 [; -#X msg 423 321 ]; -#X msg 256 249 send /bla 1 2 3 \, send /bli 3 4 5 \, send /blo 4 5 -6; -#X text 462 312 when last bundle is closed the buffer is sent.; -#X text 463 333 so: first "[" \, then add messages with send /bla; -#X text 466 351 open nested nudle etc \, close with "]"; -#X floatatom 113 425 5 0 0 0 - - -; -#X text 162 428 bundleDepth; -#X text 24 11 sendOSC: send OSC formatted packet to network. at the -moment over UDP only is supported.; -#X text 28 38 supported int \, flot + string.; -#X text 462 291 open / close bundles here.; -#X text 465 372 watch the bundleDepth index change while you do this. -; -#X text 231 299 switch usage of typetags; -#X text 232 316 on/off.; -#X text 231 332 default: on; -#X text 465 392 MAX_BUNDLE_NESTING: 32; -#X msg 315 154 send; -#X msg 315 179 send /; -#X msg 368 156 send /bang; -#X msg 265 57 connect 192.168.0.255 5555; -#X text 462 58 use something like this to broadcast on UDP; -#X text 607 435 for more info \, get help on:; -#X obj 798 435 OSC; -#X connect 0 0 1 0; -#X connect 0 1 24 0; -#X connect 2 0 0 0; -#X connect 3 0 0 0; -#X connect 4 0 0 0; -#X connect 5 0 0 0; -#X connect 6 0 0 0; -#X connect 8 0 0 0; -#X connect 9 0 0 0; -#X connect 10 0 0 0; -#X connect 18 0 0 0; -#X connect 19 0 0 0; -#X connect 20 0 0 0; -#X connect 34 0 0 0; -#X connect 35 0 0 0; -#X connect 36 0 0 0; -#X connect 37 0 0 0; diff --git a/dumpOSC-help.pd b/dumpOSC-help.pd new file mode 100644 index 0000000..ac1ec7a --- /dev/null +++ b/dumpOSC-help.pd @@ -0,0 +1,11 @@ +#N canvas 53 212 477 223 12; +#X obj 17 105 print rcvOSC; +#X obj 17 53 dumpOSC 9999; +#X obj 45 78 s rcvOSC; +#X text 15 7 dumpOSC listens on specified port / UDP \, outputs everything +received on its only outlet. seems to be pretty stable.; +#X text 130 52 one argument: portnumber; +#X text 130 72 two arguments: castgroup portnumber; +#X text 76 164 [dumpOSC] needs at least one argument to function; +#X connect 1 0 0 0; +#X connect 1 0 2 0; diff --git a/dumpOSC.c b/dumpOSC.c new file mode 100644 index 0000000..8d7de18 --- /dev/null +++ b/dumpOSC.c @@ -0,0 +1,1056 @@ +/* +Written by Matt Wright and Adrian Freed, The Center for New Music and +Audio Technologies, University of California, Berkeley. Copyright (c) +1992,93,94,95,96,97,98,99,2000,01,02,03,04 The Regents of the University of +California (Regents). + +Permission to use, copy, modify, distribute, and distribute modified versions +of this software and its documentation without fee and without a signed +licensing agreement, is hereby granted, provided that the above copyright +notice, this paragraph and the following two paragraphs appear in all copies, +modifications, and distributions. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING +OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED +HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + + +The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl +*/ + + + /* + + dumpOSC.c + server that displays OpenSoundControl messages sent to it + for debugging client udp and UNIX protocol + + by Matt Wright, 6/3/97 + modified from dumpSC.c, by Matt Wright and Adrian Freed + + version 0.2: Added "-silent" option a.k.a. "-quiet" + + version 0.3: Incorporated patches from Nicola Bernardini to make + things Linux-friendly. Also added ntohl() in the right places + to support little-endian architectures. + + + + compile: + cc -o dumpOSC dumpOSC.c + + to-do: + + More robustness in saying exactly what's wrong with ill-formed + messages. (If they don't make sense, show exactly what was + received.) + + Time-based features: print time-received for each packet + + Clean up to separate OSC parsing code from socket/select stuff + + pd: branched from http://www.cnmat.berkeley.edu/OpenSoundControl/src/dumpOSC/dumpOSC.c + ------------- + -- added pd functions + -- socket is made differently than original via pd mechanisms + -- tweaks for Win32 www.zeggz.com/raf 13-April-2002 + -- the OSX changes from cnmat didnt make it here yet but this compiles + on OSX anyway. + +*/ + +#if HAVE_CONFIG_H +#include +#endif + +#include "m_pd.h" +//#include "m_imp.h" +#include "s_stuff.h" + +/* declarations */ + +// typedef void (*t_fdpollfn)(void *ptr, int fd); +//void sys_addpollfn(int fd, t_fdpollfn fn, void *ptr); + + +#if defined(__sgi) || defined(__linux) || defined(_WIN32) || defined(__APPLE__) + +#ifdef _WIN32 + #ifdef _MSC_VER + #include "OSC-common.h" + #endif /* _MSC_VER */ + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#else + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + //#include + + #ifdef NEED_SCHEDCTL_AND_LOCK + #include + #include + #endif +#endif /* _WIN32 */ + + +char *htm_error_string; +typedef int Boolean; +typedef void *OBJ; + +typedef struct ClientAddressStruct { + struct sockaddr_in cl_addr; + int clilen; + int sockfd; +} *ClientAddr; + + + +Boolean ShowBytes = FALSE; +Boolean Silent = FALSE; + +/* Declarations */ +#ifndef _WIN32 +static int unixinitudp(int chan); +#endif + +#ifdef _WIN32 + typedef unsigned __int64 osc_time_t; +#else + typedef unsigned long long osc_time_t; +#endif + + + +static int initudp(int chan); +static void closeudp(int sockfd); +Boolean ClientReply(int packetsize, void *packet, int socketfd, + void *clientaddresspointer, int clientaddressbufferlength); +void sgi_CleanExit(void); +Boolean sgi_HaveToQuit(void); +int RegisterPollingDevice(int fd, void (*callbackfunction)(int , void *), void *dummy); +static void catch_sigint(); +static int Synthmessage(char *m, int n, void *clientdesc, int clientdesclength, int fd) ; +char *DataAfterAlignedString(char *string, char *boundary) ; +Boolean IsNiceString(char *string, char *boundary) ; +void complain(char *s, ...); +osc_time_t ReadTime(const char* src); + +#define MAXMESG 32768 +static char mbuf[MAXMESG]; + +/* ----------------------------- dumpOSC ------------------------- */ + +#define MAXOUTAT 50 + +static t_class *dumpOSC_class; + +typedef struct _dumpOSC +{ + t_object x_obj; + t_outlet *x_msgout; + t_outlet *x_connectout; + t_atom x_outat[MAXOUTAT]; + int x_outatc; + t_binbuf *x_b; + int x_connectsocket; + int x_nconnections; + int x_udp; + struct sockaddr_in x_server; + int x_clilen; +} t_dumpOSC; + +void dumpOSC_ParsePacket(t_dumpOSC *x, char *buf, int n, ClientAddr returnAddr); +Boolean dumpOSC_SendReply(char *buf, int n, void *clientDesc, int clientDescLenght, int fd); +static void dumpOSC_Smessage(t_dumpOSC *x, char *address, void *v, int n, ClientAddr returnAddr); +static void dumpOSC_PrintTypeTaggedArgs(t_dumpOSC *x, void *v, int n); +static void dumpOSC_PrintHeuristicallyTypeGuessedArgs(t_dumpOSC *x, void *v, int n, int skipComma); + +static void dumpOSC_read(t_dumpOSC *x, int sockfd) { + int clilen = x->x_clilen; + int n; + struct ClientAddressStruct ras; + ClientAddr ra = &ras; + + //catchupflag= FALSE; + +/* if (ShowBytes) { */ +/* int i; */ +/* printf("%d byte message:\n", n); */ +/* for (i = 0; i < n; ++i) { */ +/* printf(" %x (%c)\t", m[i], m[i]); */ +/* if (i%4 == 3) printf("\n"); */ +/* } */ +/* printf("\n"); */ +/* } */ + + // return catchupflag; + //struct sockaddr_in x->x_server; + //while( (n = recvfrom(sockfd, mbuf, MAXMESG, 0, &cl_addr, &clilen)) >0) + // while(( + + #ifdef _WIN32 + if ((n = recvfrom(sockfd, mbuf, MAXMESG, 0, (SOCKADDR*)&x->x_server, &clilen)) >0) + #else + if ((n = recvfrom(sockfd, mbuf, MAXMESG, 0, (struct sockaddr *)&x->x_server, &clilen)) >0) + #endif + { + //int r; + ras.cl_addr = *((struct sockaddr_in *) &x->x_server); + ras.clilen = x->x_clilen; + ras.sockfd = x->x_connectsocket; + + #ifdef DEBUG + printf("dumpOSC_read: received UDP packet of length %d\n", n); + #endif + + //if(!dumpOSC_SendReply(mbuf, n, &x->x_server, clilen, sockfd)) + { + dumpOSC_ParsePacket(x, mbuf, n, ra); + } + //r = Synthmessage(mbuf, n, &x->x_server, clilen, sockfd); + //post ("%d", r); + //outlet_anything(x->x_msgout, at[msg].a_w.w_symbol, + // emsg-msg-1, at + msg + 1); + // outlet_list(x->x_msgout, 0, n, mbuf); + //if( sgi_HaveToQuit()) goto out; + //if(r>0) goto back; + //clilen = maxclilen; + } +} + +static void *dumpOSC_new(t_symbol *compatflag, + int argc, t_atom* argv) { + t_dumpOSC *x; + struct sockaddr_in server; + int clilen=sizeof(server); + int sockfd; + int portno=0; + int udp = 1; + t_symbol *castgroup=NULL; + + + if (argc == 1) { + if (argv[0].a_type==A_FLOAT) + portno = (int)argv[0].a_w.w_float; + else + return NULL; + } + + else if (argc == 2) { + if (argv[0].a_type==A_SYMBOL) + castgroup = argv[0].a_w.w_symbol; + else + return NULL; + + if (argv[1].a_type==A_FLOAT) + portno = (int)argv[1].a_w.w_float; + else + return NULL; + } + + else { + error("[dumpOSC] needs at least one argument (port number) to function"); + return NULL; + } + + + //x->x_b = binbuf_new(); + //x->x_outat = binbuf_getvec(x->x_b); + + //{{raf}} pointer not valid yet...moving this down + //x->x_outatc = 0; {{raf}} + + /* create a socket */ + if ((sockfd = socket(AF_INET, (udp ? SOCK_DGRAM : SOCK_STREAM), 0)) == -1) + { + sys_sockerror("socket"); + return (0); + } + + server.sin_family = AF_INET; + server.sin_addr.s_addr = INADDR_ANY; + /* assign server port number */ + server.sin_port = htons((u_short)portno); + + // ss 2006 + if (castgroup) { + struct ip_mreq mreq; + int t = 1; + mreq.imr_multiaddr.s_addr = inet_addr(castgroup->s_name); + mreq.imr_interface.s_addr = htonl(INADDR_ANY); + if (setsockopt(sockfd,SOL_SOCKET,SO_REUSEADDR,&t,sizeof(t)) < 0) { + sys_sockerror("setsockopt"); + } + if (setsockopt(sockfd,IPPROTO_IP,IP_ADD_MEMBERSHIP,(char*)&mreq,sizeof(mreq)) < 0) { + sys_sockerror("setsockopt"); + } + } + + /* name the socket */ + if (bind(sockfd, (struct sockaddr *)&server, sizeof(server)) < 0) + { + sys_sockerror("bind"); + sys_closesocket(sockfd); + return (0); + } + + x = (t_dumpOSC *)pd_new(dumpOSC_class); + x->x_outatc = 0; // {{raf}} now pointer is valid (less invalid) + + x->x_msgout = outlet_new(&x->x_obj, &s_anything); + + // if (udp) /* datagram protocol */ + { + + sys_addpollfn(sockfd, (t_fdpollfn)dumpOSC_read, x); + x->x_connectout = 0; + } + // else /* streaming protocol */ + /* { */ + /* if (listen(sockfd, 5) < 0) */ + /* { */ + /* sys_sockerror("listen"); */ + /* sys_closesocket(sockfd); */ + /* sockfd = -1; */ + /* } */ + /* else */ + /* { */ + /* sys_addpollfn(sockfd, (t_fdpollfn)dumpOSC_connectpoll, x); */ + /* x->x_connectout = outlet_new(&x->x_obj, &s_float); */ + /* } */ + /* } */ + + x->x_connectsocket = sockfd; + x->x_server = server; + x->x_clilen = clilen; + x->x_nconnections = 0; + x->x_udp = udp; + + return (x); +} + +static void dumpOSC_free(t_dumpOSC *x) +{ + /* LATER make me clean up open connections */ + if (x->x_connectsocket >= 0) + { + sys_rmpollfn(x->x_connectsocket); + sys_closesocket(x->x_connectsocket); + } +} + +#ifdef _MSC_VER +OSC_API void dumpOSC_setup(void) +#else +void dumpOSC_setup(void) +#endif +{ + dumpOSC_class = class_new(gensym("dumpOSC"), + (t_newmethod)dumpOSC_new, (t_method)dumpOSC_free, + sizeof(t_dumpOSC), CLASS_NOINLET, A_GIMME, 0); + class_sethelpsymbol(dumpOSC_class, gensym("dumpOSC-help.pd")); + + error("[dumpOSC]: OSCx is deprecated! \n\tConsider switching to mrpeach's [unpackOSC] and [udpreceive]"); +} + + +#ifndef _WIN32 + #define UNIXDG_PATH "/tmp/htm" + #define UNIXDG_TMP "/tmp/htm.XXXXXX" + static int unixinitudp(int chan) + { + struct sockaddr_un serv_addr; + int sockfd; + + if((sockfd = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0) + return sockfd; + + bzero((char *)&serv_addr, sizeof(serv_addr)); + serv_addr.sun_family = AF_UNIX; + strcpy(serv_addr.sun_path, UNIXDG_PATH); + sprintf(serv_addr.sun_path+strlen(serv_addr.sun_path), "%d", chan); + unlink(serv_addr.sun_path); + if(bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr.sun_family)+strlen(serv_addr.sun_path)) < 0) + { + perror("unable to bind\n"); + return -1; + } + + fcntl(sockfd, F_SETFL, FNDELAY); + return sockfd; + } +#endif // #ifndef _WIN32 + + + +static int initudp(int chan) +{ + +#ifdef _WIN32 + struct sockaddr_in serv_addr; + unsigned int sockfd; + ULONG nonBlocking = (ULONG) TRUE; + + if( (sockfd = socket(AF_INET, SOCK_DGRAM, 0)) != INVALID_SOCKET ) { + ZeroMemory((char *)&serv_addr, sizeof(serv_addr)); + serv_addr.sin_family = AF_INET; + serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); + serv_addr.sin_port = htons(chan); + if(bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) >= 0) { + // set for non-blocking mode + if(ioctlsocket(sockfd, FIONBIO, &nonBlocking) == SOCKET_ERROR) { + perror("unable to set non-blocking\n"); + return -1; + } + } + else { perror("unable to bind\n"); return -1; } + } + return (sockfd == INVALID_SOCKET ? -1 : (int)sockfd); +#else + struct sockaddr_in serv_addr; + int sockfd; + + if((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) + return sockfd; + + bzero((char *)&serv_addr, sizeof(serv_addr)); + serv_addr.sin_family = AF_INET; + serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); + serv_addr.sin_port = htons(chan); + + if(bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) + { + perror("unable to bind\n"); + return -1; + } + + fcntl(sockfd, F_SETFL, FNDELAY); + return sockfd; +#endif +} + +static void closeudp(int sockfd) { + #ifdef _WIN32 + closesocket(sockfd); + #else + close(sockfd); + #endif +} + +static Boolean catchupflag=FALSE; +Boolean ClientReply(int packetsize, void *packet, int socketfd, + void *clientaddresspointer, int clientaddressbufferlength) +{ + if(!clientaddresspointer) return FALSE; + catchupflag= TRUE; + return packetsize==sendto(socketfd, packet, packetsize, 0, clientaddresspointer, clientaddressbufferlength); +} + +static Boolean exitflag= FALSE; +void sgi_CleanExit(void) { + exitflag = TRUE; +} + +Boolean sgi_HaveToQuit(void) { + return exitflag; +} + + +/* file descriptor poll table */ +static int npolldevs =0; +typedef struct polldev +{ + int fd; + void (*callbackfunction)(int , void *); + void *dummy; +} polldev; +#define TABMAX 8 +static polldev polldevs[TABMAX]; + + +/* Register a device (referred to by a file descriptor that the caller + should have already successfully obtained from a system call) to be + polled as real-time constraints allowed. + + When a select(2) call indicates activity on the file descriptor, the + callback function is called with the file descripter as first + argument and the given dummy argument (presumably a pointer to the + instance variables associated with the device). +*/ +int RegisterPollingDevice(int fd, void (*callbackfunction)(int , void *), void *dummy) +{ + if(npolldevscl_addr.sin_addr.s_addr; + printf("Client address %p:\n", CA); + printf(" clilen %d, sockfd %d\n", CA->clilen, CA->sockfd); + printf(" sin_family %d, sin_port %d\n", CA->cl_addr.sin_family, + CA->cl_addr.sin_port); + printf(" address: (%lx) %s\n", addr, inet_ntoa(CA->cl_addr.sin_addr)); + + printf(" sin_zero = \"%c%c%c%c%c%c%c%c\"\n", + CA->cl_addr.sin_zero[0], + CA->cl_addr.sin_zero[1], + CA->cl_addr.sin_zero[2], + CA->cl_addr.sin_zero[3], + CA->cl_addr.sin_zero[4], + CA->cl_addr.sin_zero[5], + CA->cl_addr.sin_zero[6], + CA->cl_addr.sin_zero[7]); + + printf("\n"); +} + +//******************* + +/*void WriteTime(char* dst, osc_time_t osctime) +{ + *(int32_t*)dst = htonl((int32_t)(osctime >> 32)); + *(int32_t*)(dst+4) = htonl((int32_t)osctime); +} + +void WriteMode(char* dst) +{ + *(int32_t*)dst = htonl(0); +} + +osc_time_t ReadTime(const char* src) +{ + osc_time_t osctime = ntohl(*(int32_t*)src); + return (osctime << 32) + ntohl(*(int32_t*)(src+4)); +} + +double TimeToSeconds(osc_time_t osctime) +{ + return (double)osctime * 2.3283064365386962890625e-10 // 1/2^32 ; +// ^^^^^^^^^^^^^^^ isn't working on WIN32 (and on other machines: doesn't make sense!) +} + +int timeRound(double x) +{ + return x >= 0.0 ? x+0.5 : x-0.5; +} +*/ +/* +void WriteLogicalTime(char* dst) +{ + static double startTime = -1.0; + double sTime; + + // Initialisierung der Startzeit. + // Knnte effizienter (ohne 'if') auch irgendwo vorher passieren. + // Knnte wahrscheinlich auch 0.0 sein. + if (startTime < 0.0) { + startTime = clock_getlogicaltime(); + } + + sTime = clock_gettimesince(startTime) * 0.001; + *(int32_t*)dst = hton'K l((int32_t)sTime); + *(int32_t*)(dst+4) = htonl((int32_t)(4294967296.0 * sTime)); +} +*/ + +/*void WriteLogicalTime(char* dst) +{ + double sTime = clock_gettimesince(19230720) / 1000.0; + double tau = sTime - (double)timeRound(sTime); + + //fprintf(stderr, "sSec = %f tau = %f\n", sTime, tau); + + *(int32_t*)dst = htonl((int32_t)(sTime)); + *(int32_t*)(dst+4) = htonl((int32_t)(4294967296 * tau)); +} + +int dumpOSC_SendReply(char *buf, int n, void *clientDesc, int clientDescLenght, int fd) +{ + if((n == 24) && (strcmp(buf, "#time") == 0)) + { + osc_time_t t0, t1, t2; + double dt0, dt1, dt2; + + WriteMode(buf+6); + + t0 = ReadTime(buf+8); + + WriteLogicalTime(buf+16); + t1 = ReadTime(buf+16); // reverse + dt0 = TimeToSeconds(t0); // client time + dt1 = TimeToSeconds(t1); // server time + + // fprintf(stderr, "%f\t%f\t%f\n", dt0, dt1, dt0 - dt1); + + sendto(fd, buf, n, 0, (struct sockaddr *)clientDesc, clientDescLenght); + return TRUE; + } + else + { + return FALSE; + } +}*/ + +//********************** + +void dumpOSC_ParsePacket(t_dumpOSC *x, char *buf, int n, ClientAddr returnAddr) { + // t_dumpOSC *x; + int size, messageLen, i; + char *messageName; + char *args; + + //#ifdef PRINTADDRS + #ifdef DEBUG + //PrintClientAddr(returnAddr); + #endif + + + if ((n%4) != 0) { + complain("SynthControl packet size (%d) not a multiple of 4 bytes: dropping", n); + return; + } + + if ((n >= 8) && (strncmp(buf, "#bundle", 8) == 0)) { + /* This is a bundle message. */ + #ifdef DEBUG + printf("dumpOSC_ParsePacket: bundle msg: bundles not yet supported\n"); + #endif + + if (n < 16) { + complain("Bundle message too small (%d bytes) for time tag", n); + return; + } + + /* Print the time tag */ + #ifdef DEBUG + printf("[ %lx%08lx\n", ntohl(*((unsigned long *)(buf+8))), ntohl(*((unsigned long *)(buf+12)))); + #endif + + /* Note: if we wanted to actually use the time tag as a little-endian + 64-bit int, we'd have to word-swap the two 32-bit halves of it */ + + i = 16; /* Skip "#group\0" and time tag */ + + while(i n) { + complain("Bad size count %d in bundle (only %d bytes left in entire bundle)", + size, n-i-4); + return; + } + + /* Recursively handle element of bundle */ + dumpOSC_ParsePacket(x, buf+i+4, size, returnAddr); + i += 4 + size; + } + + if (i != n) { + complain("This can't happen"); + } + #ifdef DEBUG + printf("]\n"); + #endif + + } + else if ((n == 24) && (strcmp(buf, "#time") == 0)) + { + complain("Time message: %s\n :).\n", htm_error_string); + return; + + } + else + { + /* This is not a bundle message */ + + messageName = buf; + args = DataAfterAlignedString(messageName, buf+n); + if (args == 0) { + complain("Bad message name string: %s\nDropping entire message.\n", + htm_error_string); + return; + } + messageLen = args-messageName; + dumpOSC_Smessage(x, messageName, (void *)args, n-messageLen, returnAddr); + } +} + +#define SMALLEST_POSITIVE_FLOAT 0.000001f + +static void dumpOSC_Smessage(t_dumpOSC *x, char *address, void *v, int n, ClientAddr returnAddr) { + char *chars = v; + //t_atom at; + //t_atom myargv[50]; + + //int myargc = x->x_outatc; + //t_atom* mya = x->x_outat; + //int myi; + +#ifdef DEBUG + printf("%s ", address); +#endif + + // ztoln+cvt from envgen.c, ggee-0.18 .. + // outlet_anything's 'symbol' gets set to address + // so we dont need to append address to the atomlist + /* + SETSYMBOL(mya,gensym(address));myargc++; + x->x_outatc = myargc; + */ + + if (n != 0) { + if (chars[0] == ',') { + if (chars[1] != ',') { + /* This message begins with a type-tag string */ + dumpOSC_PrintTypeTaggedArgs(x, v, n); + } else { + /* Double comma means an escaped real comma, not a type string */ + dumpOSC_PrintHeuristicallyTypeGuessedArgs(x, v, n, 1); + } + } else { + dumpOSC_PrintHeuristicallyTypeGuessedArgs(x, v, n, 0); + } + } + + outlet_anything(x->x_msgout,gensym(address),x->x_outatc,(t_atom*)&x->x_outat); + x->x_outatc = 0; +#ifdef DEBUG + printf("\n"); +#endif + fflush(stdout); /* Added for Sami 5/21/98 */ +} + +static void dumpOSC_PrintTypeTaggedArgs(t_dumpOSC *x, void *v, int n) { + char *typeTags, *thisType; + char *p; + + int myargc = x->x_outatc; + t_atom* mya = x->x_outat; + //int myi; + + typeTags = v; + + if (!IsNiceString(typeTags, typeTags+n)) { + /* No null-termination, so maybe it wasn't a type tag + string after all */ + dumpOSC_PrintHeuristicallyTypeGuessedArgs(x, v, n, 0); + return; + } + + p = DataAfterAlignedString(typeTags, typeTags+n); + + + for (thisType = typeTags + 1; *thisType != 0; ++thisType) { + switch (*thisType) { + case 'i': case 'r': case 'm': case 'c': +#ifdef DEBUG + //post("integer: %d", ntohl(*((int *) p))); +#endif + /* Martin Peach fix for negative floats: + * was: SETFLOAT(mya+myargc,ntohl(*((int *) p))); + * now is: + */ + SETFLOAT(mya+myargc,(signed)ntohl(*((int *) p))); + myargc++; + + p += 4; + break; + + case 'f': { + int i = ntohl(*((int *) p)); + t_float *floatp = ((t_float *) (&i)); +#ifdef DEBUG + post("float: %f", *floatp); +#endif + SETFLOAT(mya+myargc,*floatp); + myargc++; + + p += 4; + } + break; + + case 'h': case 't': +#ifdef DEBUG + printf("[A 64-bit int] "); +#endif + post("[A 64-bit int] not implemented"); + + p += 8; + break; + + case 'd': +#ifdef DEBUG + printf("[A 64-bit float] "); +#endif + post("[A 64-bit float] not implemented"); + + p += 8; + break; + + case 's': case 'S': + if (!IsNiceString(p, typeTags+n)) { + post("Type tag said this arg is a string but it's not!\n"); + return; + } else { +#ifdef DEBUG + post("string: \"%s\"", p); +#endif + SETSYMBOL(mya+myargc,gensym(p)); + myargc++; + //outlet_list(x->x_msgout, 0,sizeof(p), p); + //outlet_anything(x->x_msgout, 0, sizeof(p), p); + p = DataAfterAlignedString(p, typeTags+n); + // append to output vector .. + } + break; + + case 'T': +#ifdef DEBUG + printf("[True] "); +#endif + SETFLOAT(mya+myargc,1.); + myargc++; + break; + case 'F': +#ifdef DEBUG + printf("[False] "); +#endif + SETFLOAT(mya+myargc,0.); + myargc++; + break; + case 'N': +#ifdef DEBUG + printf("[Nil]"); +#endif + post("sendOSC: [Nil] not implemented"); + break; + case 'I': +#ifdef DEBUG + printf("[Infinitum]"); +#endif + post("sendOSC: [Infinitum] not implemented"); + break; + + default: + post("sendOSC: [Unrecognized type tag %c]", *thisType); + // return; + } + } + x->x_outatc = myargc; +} + +static void dumpOSC_PrintHeuristicallyTypeGuessedArgs(t_dumpOSC *x, void *v, int n, int skipComma) { + int i, thisi; + t_float thisf; + int *ints; + char *chars; + char *string, *nextString; + + int myargc= x->x_outatc; + t_atom* mya = x->x_outat; + //int myi; + + union + { + float f; + int32_t i; + }u; + + /* Go through the arguments 32 bits at a time */ + ints = v; + chars = v; + + for (i = 0; i= -1000 && thisi <= 1000000) { +#ifdef DEBUG + printf("%d ", thisi); +#endif + // append to output vector .. + SETFLOAT(mya+myargc,(t_float) (thisi)); + myargc++; + // outlet_float(x->x_msgout, thisi); + i++; + } else if (thisf >= -1000.f && thisf <= 1000000.f && + (thisf <=0.0f || thisf >= SMALLEST_POSITIVE_FLOAT)) { +#ifdef DEBUG + printf("%f ", thisf); +#endif + // append to output vector .. + SETFLOAT(mya+myargc,thisf); + myargc++; + //outlet_float(x->x_msgout, thisf); + i++; + } else if (IsNiceString(string, chars+n)) { + nextString = DataAfterAlignedString(string, chars+n); +#ifdef DEBUG + printf("\"%s\" ", (i == 0 && skipComma) ? string +1 : string); +#endif + // append to output vector .. + SETSYMBOL(mya+myargc,gensym(string)); + myargc++; + //outlet_symbol(x->x_msgout, gensym((i == 0 && skipComma) ? string +1 : string)); + i += (nextString-string) / 4; + } else { + // unhandled .. ;) +#ifdef DEBUG + printf("0x%x xx", ints[i]); +#endif + i++; + } + x->x_outatc = myargc; + } +} + + +#define STRING_ALIGN_PAD 4 + +char *DataAfterAlignedString(char *string, char *boundary) +{ + /* The argument is a block of data beginning with a string. The + string has (presumably) been padded with extra null characters + so that the overall length is a multiple of STRING_ALIGN_PAD + bytes. Return a pointer to the next byte after the null + byte(s). The boundary argument points to the character after + the last valid character in the buffer---if the string hasn't + ended by there, something's wrong. + + If the data looks wrong, return 0, and set htm_error_string */ + + int i; + + if ((boundary - string) %4 != 0) { + fprintf(stderr, "Internal error: DataAfterAlignedString: bad boundary\n"); + return 0; + } + + for (i = 0; string[i] != '\0'; i++) { + if (string + i >= boundary) { + htm_error_string = "DataAfterAlignedString: Unreasonably long string"; + return 0; + } + } + + /* Now string[i] is the first null character */ + i++; + + for (; (i % STRING_ALIGN_PAD) != 0; i++) { + if (string + i >= boundary) { + htm_error_string = "DataAfterAlignedString: Unreasonably long string"; + return 0; + } + if (string[i] != '\0') { + htm_error_string = "DataAfterAlignedString: Incorrectly padded string."; + return 0; + } + } + + return string+i; +} + +Boolean IsNiceString(char *string, char *boundary) +{ + /* Arguments same as DataAfterAlignedString(). Is the given "string" + really a string? I.e., is it a sequence of isprint() characters + terminated with 1-4 null characters to align on a 4-byte boundary? */ + + int i; + + if ((boundary - string) %4 != 0) { + fprintf(stderr, "Internal error: IsNiceString: bad boundary\n"); + return 0; + } + + for (i = 0; string[i] != '\0'; i++) { + if (!isprint(string[i])) return FALSE; + if (string + i >= boundary) return FALSE; + } + + /* If we made it this far, it's a null-terminated sequence of printing characters + in the given boundary. Now we just make sure it's null padded... */ + + /* Now string[i] is the first null character */ + i++; + for (; (i % STRING_ALIGN_PAD) != 0; i++) { + if (string[i] != '\0') return FALSE; + } + + return TRUE; +} + + + + + + + + + +#include +void complain(char *s, ...) { + va_list ap; + va_start(ap, s); + fprintf(stderr, "*** ERROR: "); + vfprintf(stderr, s, ap); + fprintf(stderr, "\n"); + va_end(ap); +} + +#endif /* __sgi or LINUX or _WIN32 */ diff --git a/htmsocket.c b/htmsocket.c new file mode 100644 index 0000000..16a1050 --- /dev/null +++ b/htmsocket.c @@ -0,0 +1,387 @@ +/* +Written by Adrian Freed, The Center for New Music and Audio Technologies, +University of California, Berkeley. Copyright (c) 1992,93,94,95,96,97,98,99,2000,01,02,03,04 +The Regents of the University of California (Regents). + +Permission to use, copy, modify, distribute, and distribute modified versions +of this software and its documentation without fee and without a signed +licensing agreement, is hereby granted, provided that the above copyright +notice, this paragraph and the following two paragraphs appear in all copies, +modifications, and distributions. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING +OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED +HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + + +The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl +*/ + + /* htmsocket.c + + Adrian Freed + send parameters to htm servers by udp or UNIX protocol + + Modified 6/6/96 by Matt Wright to understand symbolic host names + in addition to X.X.X.X addresses. + + pd: branched jdl + -- win additions raf 2002 + -- enabled broadcast jdl 2003 + */ + +#if HAVE_CONFIG_H +#include +#endif + +#ifdef __APPLE__ + #include +#endif + +#ifdef WIN32 + #include + #include + #include + #include + #include + #include + #include + #include "OSC-common.h" + #include + #include + #include +#else + #include + #include + #include + #include + #include + +// #include + #include + #include + #include + #include + #include + #include + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +// #include + + #include +#endif + +#define UNIXDG_PATH "/tmp/htm" +#define UNIXDG_TMP "/tmp/htm.XXXXXX" +#include "htmsocket.h" +typedef struct +{ + float srate; + + struct sockaddr_in serv_addr; /* udp socket */ + #ifndef WIN32 + struct sockaddr_un userv_addr; /* UNIX socket */ + #endif + int sockfd; /* socket file descriptor */ + int index, len,uservlen; + void *addr; + int id; +} desc; + +int IsAddressMulticast(unsigned long address) +{ + unsigned long adr = ntohl(address); + unsigned char A = (unsigned char)((adr & 0xFF000000) >> 24); + unsigned char B = (unsigned char)((adr & 0xFF0000) >> 16); + unsigned char C = (unsigned char)((adr & 0xFF00) >> 8); + + if (A==224 && B==0 && C==0) { + // This multicast group range is reserved for routing + // information and not meant to be used by applications. + return -1; + } + + // This is the multicast group IP range + if (A>=224 && A<=239) + return 1; + + return 0; +} + +/* open a socket for HTM communication to given host on given portnumber */ +/* if host is 0 then UNIX protocol is used (i.e. local communication */ +void *OpenHTMSocket(char *host, int portnumber, short *multicast_TTL) +{ + struct sockaddr_in cl_addr; + #ifndef WIN32 + int sockfd; + struct sockaddr_un ucl_addr; + #else + unsigned int sockfd; + #endif + + char oval = 1; + + desc *o; + o = malloc(sizeof(*o)); + if(!o) + return 0; + + #ifndef WIN32 + + if(!host) + { + char *mktemp(char *); + int clilen; + o->len = sizeof(ucl_addr); + /* + * Fill in the structure "userv_addr" with the address of the + * server that we want to send to. + */ + + bzero((char *) &o->userv_addr, sizeof(o->userv_addr)); + o->userv_addr.sun_family = AF_UNIX; + strcpy(o->userv_addr.sun_path, UNIXDG_PATH); + sprintf(o->userv_addr.sun_path+strlen(o->userv_addr.sun_path), "%d", portnumber); + o->uservlen = sizeof(o->userv_addr.sun_family) + strlen(o->userv_addr.sun_path); + o->addr = &(o->userv_addr); + /* + * Open a socket (a UNIX domain datagram socket). + */ + + if ( (sockfd = socket(AF_UNIX, SOCK_DGRAM, 0)) >= 0) + { + /* + * Bind a local address for us. + * In the UNIX domain we have to choose our own name (that + * should be unique). We'll use mktemp() to create a unique + * pathname, based on our process id. + */ + + bzero((char *) &ucl_addr, sizeof(ucl_addr)); /* zero out */ + ucl_addr.sun_family = AF_UNIX; + strcpy(ucl_addr.sun_path, UNIXDG_TMP); + + mktemp(ucl_addr.sun_path); + clilen = sizeof(ucl_addr.sun_family) + strlen(ucl_addr.sun_path); + + if (bind(sockfd, (struct sockaddr *) &ucl_addr, clilen) < 0) + { + perror("client: can't bind local address"); + close(sockfd); + sockfd = -1; + } + } + else + perror("unable to make socket\n"); + + }else + + #endif + + { + /* + * Fill in the structure "serv_addr" with the address of the + * server that we want to send to. + */ + o->len = sizeof(cl_addr); + + #ifdef WIN32 + ZeroMemory((char *)&o->serv_addr, sizeof(o->serv_addr)); + #else + bzero((char *)&o->serv_addr, sizeof(o->serv_addr)); + #endif + + o->serv_addr.sin_family = AF_INET; + + /* MW 6/6/96: Call gethostbyname() instead of inet_addr(), + so that host can be either an Internet host name (e.g., + "les") or an Internet address in standard dot notation + (e.g., "128.32.122.13") */ + { + struct hostent *hostsEntry; + unsigned long address; + + hostsEntry = gethostbyname(host); + if (hostsEntry == NULL) { + fprintf(stderr, "Couldn't decipher host name \"%s\"\n", host); + #ifndef WIN32 + herror(NULL); + #endif + return 0; + } + + address = *((unsigned long *) hostsEntry->h_addr_list[0]); + o->serv_addr.sin_addr.s_addr = address; + } + + /* was: o->serv_addr.sin_addr.s_addr = inet_addr(host); */ + + /* End MW changes */ + + /* + * Open a socket (a UDP domain datagram socket). + */ + + + #ifdef WIN32 + o->serv_addr.sin_port = htons((USHORT)portnumber); + o->addr = &(o->serv_addr); + if((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) != INVALID_SOCKET) { + ZeroMemory((char *)&cl_addr, sizeof(cl_addr)); + cl_addr.sin_family = AF_INET; + cl_addr.sin_addr.s_addr = htonl(INADDR_ANY); + cl_addr.sin_port = htons(0); + + // enable broadcast: jdl ~2003 + if(setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &oval, sizeof(int)) == -1) { + perror("setsockopt broadcast"); + } + + // check if specified address is a multicast group: ss 2007 + int multicast = IsAddressMulticast(o->serv_addr.sin_addr.s_addr); + + if (multicast == -1) { + perror("Multicast group range 224.0.0.[0-255] is reserved.\n"); + *multicast_TTL = -2; + close(sockfd); + sockfd = -1; + } + else { + // set TTL according to whether we have a multicast group or not + if (multicast) { + if (*multicast_TTL<0) + *multicast_TTL = 1; + } else + *multicast_TTL = -1; + + // set multicast Time-To-Live only if it is a multicast group: ss 2007 + if(*multicast_TTL>=0) { + unsigned char ttl = (unsigned char)*multicast_TTL; + if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, + &ttl, sizeof(ttl)) == -1) + perror("setsockopt TTL"); + } + + if(bind(sockfd, (struct sockaddr *) &cl_addr, sizeof(cl_addr)) < 0) { + perror("could not bind\n"); + closesocket(sockfd); + sockfd = -1; + } + } + } + else { perror("unable to make socket\n");} + #else + o->serv_addr.sin_port = htons(portnumber); + o->addr = &(o->serv_addr); + if((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) >= 0) { + bzero((char *)&cl_addr, sizeof(cl_addr)); + cl_addr.sin_family = AF_INET; + cl_addr.sin_addr.s_addr = htonl(INADDR_ANY); + cl_addr.sin_port = htons(0); + + // enable broadcast: jdl ~2003 + if(setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &oval, sizeof(int)) == -1) { + perror("setsockopt"); + } + + // check if specified address is a multicast group: ss 2007 + int multicast = IsAddressMulticast(o->serv_addr.sin_addr.s_addr); + + if (multicast == -1) { + perror("Multicast group range 224.0.0.[0-255] is reserved.\n"); + *multicast_TTL = -2; + close(sockfd); + sockfd = -1; + } + else { + // check if specified address is a multicast group: ss 2007 + if (multicast) { + if (*multicast_TTL<0) + *multicast_TTL = 1; + } else + *multicast_TTL = -1; + + // set multicast Time-To-Live only if it is a multicast group: ss 2007 + if(*multicast_TTL>=0) { + unsigned char ttl = (unsigned char)*multicast_TTL; + if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, + &ttl, sizeof(ttl)) == -1) + perror("setsockopt TTL"); + } + + if(bind(sockfd, (struct sockaddr *) &cl_addr, sizeof(cl_addr)) < 0) { + perror("could not bind\n"); + close(sockfd); + sockfd = -1; + } + } + } + else { perror("unable to make socket\n");} + #endif + } + #ifdef WIN32 + if(sockfd == INVALID_SOCKET) { + #else + if(sockfd < 0) { + #endif + free(o); + o = 0; + } + else + o->sockfd = sockfd; + return o; +} + + +#include + +static bool sendudp(const struct sockaddr *sp, int sockfd,int length, int count, void *b) +{ + int rcount; + if((rcount=sendto(sockfd, b, count, 0, sp, length)) != count) + { + printf("sockfd %d count %d rcount %dlength %d errno %d\n", sockfd,count,rcount,length, errno); + return FALSE; + } + return TRUE; +} +bool SendHTMSocket(void *htmsendhandle, int length_in_bytes, void *buffer) +{ + desc *o = (desc *)htmsendhandle; + return sendudp(o->addr, o->sockfd, o->len, length_in_bytes, buffer); +} +void CloseHTMSocket(void *htmsendhandle) +{ + desc *o = (desc *)htmsendhandle; + #ifdef WIN32 + if(SOCKET_ERROR == closesocket(o->sockfd)) { + perror("CloseHTMSocket::closesocket failed\n"); + return; + } + #else + if(close(o->sockfd) == -1) + { + perror("CloseHTMSocket::closesocket failed"); + return; + } + #endif + + free(o); +} diff --git a/htmsocket.h b/htmsocket.h new file mode 100644 index 0000000..685c1f7 --- /dev/null +++ b/htmsocket.h @@ -0,0 +1,48 @@ +/* +Written by Adrian Freed, The Center for New Music and Audio Technologies, +University of California, Berkeley. Copyright (c) 1992,93,94,95,96,97,98,99,2000,01,02,03,04 +The Regents of the University of California (Regents). + +Permission to use, copy, modify, distribute, and distribute modified versions +of this software and its documentation without fee and without a signed +licensing agreement, is hereby granted, provided that the above copyright +notice, this paragraph and the following two paragraphs appear in all copies, +modifications, and distributions. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING +OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED +HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + + +The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl +*/ + + + /* htmparam.h + + Adrian Freed + send parameters to htm servers by udp or UNIX protocol + */ +#ifndef TRUE +#define TRUE 1 +#define FALSE 0 +#endif +typedef int bool; + +/* open a socket for HTM communication to given host on given portnumber */ +/* if host is 0 then UNIX protocol is used (i.e. local communication) */ +void *OpenHTMSocket(char *host, int portnumber, short *multicast_TTL); + +/* send a buffer of data over htm socket, returns TRUE on success. + Note that udp sends rarely fail. UNIX sends fail if a kernal buffer overflows */ +bool SendHTMSocket(void *htmsendhandle, int length_in_bytes, void *buffer); + +/* close the socket(2) and release memory associated with it */ +void CloseHTMSocket(void *htmsendhandle); diff --git a/install.sh b/install.sh deleted file mode 100644 index e69de29..0000000 diff --git a/libOSC/LIBOSC.001 b/libOSC/LIBOSC.001 deleted file mode 100644 index d1b40cc..0000000 --- a/libOSC/LIBOSC.001 +++ /dev/null @@ -1,94 +0,0 @@ -# Microsoft Developer Studio Project File - Name="LIBOSC" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=LIBOSC - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "LIBOSC.MAK". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "LIBOSC.MAK" CFG="LIBOSC - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "LIBOSC - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "LIBOSC - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe - -!IF "$(CFG)" == "LIBOSC - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "LIBOSC - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "LIBOSC - Win32 Release" -# Name "LIBOSC - Win32 Debug" -# Begin Source File - -SOURCE=".\OSC-client.c" -# End Source File -# Begin Source File - -SOURCE=".\OSC-client.h" -# End Source File -# Begin Source File - -SOURCE=".\OSC-timetag.c" -# End Source File -# Begin Source File - -SOURCE=".\OSC-timetag.h" -# End Source File -# End Target -# End Project diff --git a/libOSC/LIBOSC.002 b/libOSC/LIBOSC.002 deleted file mode 100644 index d2c0fe8..0000000 --- a/libOSC/LIBOSC.002 +++ /dev/null @@ -1,100 +0,0 @@ -# Microsoft Developer Studio Project File - Name="LIBOSC" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=LIBOSC - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "LIBOSC.MAK". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "LIBOSC.MAK" CFG="LIBOSC - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "LIBOSC - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "LIBOSC - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe - -!IF "$(CFG)" == "LIBOSC - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -RSC=rc.exe -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../pd/src" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\..\pd\lib\LIBOSC.lib" - -!ELSEIF "$(CFG)" == "LIBOSC - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -RSC=rc.exe -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /Z7 /Od /I "../../pd/src" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "LIBOSC - Win32 Release" -# Name "LIBOSC - Win32 Debug" -# Begin Source File - -SOURCE=".\OSC-client.c" -# End Source File -# Begin Source File - -SOURCE=".\OSC-client.h" -# End Source File -# Begin Source File - -SOURCE=".\OSC-timetag.c" -# End Source File -# Begin Source File - -SOURCE=".\OSC-timetag.h" -# End Source File -# End Target -# End Project diff --git a/libOSC/LIBOSC.DSP b/libOSC/LIBOSC.DSP deleted file mode 100644 index 6f19738..0000000 --- a/libOSC/LIBOSC.DSP +++ /dev/null @@ -1,100 +0,0 @@ -# Microsoft Developer Studio Project File - Name="LIBOSC" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=LIBOSC - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "LIBOSC.MAK". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "LIBOSC.MAK" CFG="LIBOSC - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "LIBOSC - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "LIBOSC - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "LIBOSC - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../../pd/src" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "LIBOSC - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /Z7 /Od /I "../../pd/src" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "LIBOSC - Win32 Release" -# Name "LIBOSC - Win32 Debug" -# Begin Source File - -SOURCE=".\OSC-client.c" -# End Source File -# Begin Source File - -SOURCE=".\OSC-client.h" -# End Source File -# Begin Source File - -SOURCE=".\OSC-timetag.c" -# End Source File -# Begin Source File - -SOURCE=".\OSC-timetag.h" -# End Source File -# End Target -# End Project diff --git a/libOSC/LIBOSC.DSW b/libOSC/LIBOSC.DSW deleted file mode 100644 index ef47907..0000000 --- a/libOSC/LIBOSC.DSW +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "LIBOSC"=.\LIBOSC.DSP - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/libOSC/LIBOSC.PLG b/libOSC/LIBOSC.PLG deleted file mode 100644 index 37f24da..0000000 --- a/libOSC/LIBOSC.PLG +++ /dev/null @@ -1,19 +0,0 @@ - - -
-

Build Log

-

---------------------Configuration: LIBOSC - Win32 Release-------------------- -

-

Command Lines

-Creating command line "link.exe -lib /nologo /out:"Release\LIBOSC.lib" ".\Release\OSC-client.obj" ".\Release\OSC-timetag.obj" " -

Output Window

-Creating library... - - - -

Results

-LIBOSC.lib - 0 error(s), 0 warning(s) -
- - diff --git a/libOSC/Makefile.in b/libOSC/Makefile.in deleted file mode 100644 index 7d09fcb..0000000 --- a/libOSC/Makefile.in +++ /dev/null @@ -1,27 +0,0 @@ -#CFLAGS= -O2 -Wall -fPIC -ARFLAGS=srv -# uncomment the following for linux/win -# DEFS= -Dunix -LIB=libOSC.a - -CFLAGS=@CFLAGS@ -INCLUDES=@INCLUDES@ - -LIBOBJS= ${LIB}(OSC-client.o) ${LIB}(OSC-timetag.o) - -all: ${LIBOBJS} - -.c.a: - ${CC} -c ${CFLAGS} ${INCLUDES} ${DEFS} $< - ${AR} ${ARFLAGS} $@ $*.o - rm -f $*.o - -test_OSC: test_OSC.o ${LIB} - $(CC) -o test_OSC test_OSC.o ${LIB} - -test_OSC_timeTag: test_OSC_timeTag.o OSC-timetag.o - $(CC) -o test_OSC_timeTag test_OSC_timeTag.o OSC-timetag.o - - -clean: - rm -f ${LIB} *.o diff --git a/libOSC/OSC-client.c b/libOSC/OSC-client.c deleted file mode 100644 index cea9e78..0000000 --- a/libOSC/OSC-client.c +++ /dev/null @@ -1,479 +0,0 @@ -/* -Written by Matt Wright, The Center for New Music and Audio Technologies, -University of California, Berkeley. Copyright (c) 1996,97,98,99,2000,01,02,03 -The Regents of the University of California (Regents). - -Permission to use, copy, modify, distribute, and distribute modified versions -of this software and its documentation without fee and without a signed -licensing agreement, is hereby granted, provided that the above copyright -notice, this paragraph and the following two paragraphs appear in all copies, -modifications, and distributions. - -IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING -OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED -HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE -MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -*/ - - -/* - Author: Matt Wright - Version 2.2: Calls htonl in the right places 20000620 - Version 2.3: Gets typed messages right. - */ - -/* - pd - ------------- - - raf@interaccess.com: - rev. for Win32 build (verified under Win-2ooo) 11-April-2002 - - -- changed licence part (20040820) jdl - -- Version 2.4 changes not in here (20040820) jdl - -*/ - -/* Here are the possible values of the state field: */ - -#define EMPTY 0 /* Nothing written to packet yet */ -#define ONE_MSG_ARGS 1 /* Packet has a single message; gathering arguments */ -#define NEED_COUNT 2 /* Just opened a bundle; must write message name or - open another bundle */ -#define GET_ARGS 3 /* Getting arguments to a message. If we see a message - name or a bundle open/close then the current message - will end. */ -#define DONE 4 /* All open bundles have been closed, so can't write - anything else */ - -#ifdef WIN32 - #include - #include - #include - #include - #include - #include - #include -#endif - -#ifdef __APPLE__ - #include -#endif - -#ifdef unix - #include - #include -#endif - -#include "OSC-client.h" - -char *OSC_errorMessage; - -#ifndef WIN32 - static int strlen(char *s); -#endif -static int OSC_padString(char *dest, char *str); -static int OSC_padStringWithAnExtraStupidComma(char *dest, char *str); -static int OSC_WritePadding(char *dest, int i); -static int CheckTypeTag(OSCbuf *buf, char expectedType); - -void OSC_initBuffer(OSCbuf *buf, int size, char *byteArray) { - buf->buffer = byteArray; - buf->size = size; - OSC_resetBuffer(buf); -} - -void OSC_resetBuffer(OSCbuf *buf) { - buf->bufptr = buf->buffer; - buf->state = EMPTY; - buf->bundleDepth = 0; - buf->prevCounts[0] = 0; - buf->gettingFirstUntypedArg = 0; - buf->typeStringPtr = 0; -} - -int OSC_isBufferEmpty(OSCbuf *buf) { - return buf->bufptr == buf->buffer; -} - -int OSC_freeSpaceInBuffer(OSCbuf *buf) { - return buf->size - (buf->bufptr - buf->buffer); -} - -int OSC_isBufferDone(OSCbuf *buf) { - return (buf->state == DONE || buf->state == ONE_MSG_ARGS); -} - -char *OSC_getPacket(OSCbuf *buf) { -#ifdef ERROR_CHECK_GETPACKET - if (buf->state == DONE || buf->state == ONE_MSG_ARGS) { - return buf->buffer; - } else { - OSC_errorMessage = "Packet has unterminated bundles"; - return 0; - } -#else - return buf->buffer; -#endif -} - -int OSC_packetSize(OSCbuf *buf) { -#ifdef ERROR_CHECK_PACKETSIZE - if (buf->state == DONE || buf->state == ONE_MSG_ARGS) { - return (buf->bufptr - buf->buffer); - } else { - OSC_errorMessage = "Packet has unterminated bundles"; - return 0; - } -#else - return (buf->bufptr - buf->buffer); -#endif -} - -#define CheckOverflow(buf, bytesNeeded) { \ - if ((bytesNeeded) > OSC_freeSpaceInBuffer(buf)) { \ - OSC_errorMessage = "buffer overflow"; \ - return 1; \ - } \ -} - -static void PatchMessageSize(OSCbuf *buf) { - int4byte size; - size = buf->bufptr - ((char *) buf->thisMsgSize) - 4; - *(buf->thisMsgSize) = htonl(size); -} - -int OSC_openBundle(OSCbuf *buf, OSCTimeTag tt) { - if (buf->state == ONE_MSG_ARGS) { - OSC_errorMessage = "Can't open a bundle in a one-message packet"; - return 3; - } - - if (buf->state == DONE) { - OSC_errorMessage = "This packet is finished; can't open a new bundle"; - return 4; - } - - if (++(buf->bundleDepth) >= MAX_BUNDLE_NESTING) { - OSC_errorMessage = "Bundles nested too deeply; change MAX_BUNDLE_NESTING in OpenSoundControl.h"; - return 2; - } - - if (CheckTypeTag(buf, '\0')) return 9; - - if (buf->state == GET_ARGS) { - PatchMessageSize(buf); - } - - if (buf->state == EMPTY) { - /* Need 16 bytes for "#bundle" and time tag */ - CheckOverflow(buf, 16); - } else { - /* This bundle is inside another bundle, so we need to leave - a blank size count for the size of this current bundle. */ - CheckOverflow(buf, 20); - *((int4byte *)buf->bufptr) = 0xaaaaaaaa; - buf->prevCounts[buf->bundleDepth] = (int4byte *)buf->bufptr; - - buf->bufptr += 4; - } - - buf->bufptr += OSC_padString(buf->bufptr, "#bundle"); - - - *((OSCTimeTag *) buf->bufptr) = tt; - - if (htonl(1) != 1) { - /* Byte swap the 8-byte integer time tag */ - int4byte *intp = (int4byte *)buf->bufptr; - intp[0] = htonl(intp[0]); - intp[1] = htonl(intp[1]); - -#ifdef HAS8BYTEINT - { /* tt is a 64-bit int so we have to swap the two 32-bit words. - (Otherwise tt is a struct of two 32-bit words, and even though - each word was wrong-endian, they were in the right order - in the struct.) */ - int4byte temp = intp[0]; - intp[0] = intp[1]; - intp[1] = temp; - } -#endif - } - - buf->bufptr += sizeof(OSCTimeTag); - - buf->state = NEED_COUNT; - - buf->gettingFirstUntypedArg = 0; - buf->typeStringPtr = 0; - return 0; -} - - -int OSC_closeBundle(OSCbuf *buf) { - if (buf->bundleDepth == 0) { - /* This handles EMPTY, ONE_MSG, ARGS, and DONE */ - OSC_errorMessage = "Can't close bundle; no bundle is open!"; - return 5; - } - - if (CheckTypeTag(buf, '\0')) return 9; - - if (buf->state == GET_ARGS) { - PatchMessageSize(buf); - } - - if (buf->bundleDepth == 1) { - /* Closing the last bundle: No bundle size to patch */ - buf->state = DONE; - } else { - /* Closing a sub-bundle: patch bundle size */ - int size = buf->bufptr - ((char *) buf->prevCounts[buf->bundleDepth]) - 4; - *(buf->prevCounts[buf->bundleDepth]) = htonl(size); - buf->state = NEED_COUNT; - } - - --buf->bundleDepth; - buf->gettingFirstUntypedArg = 0; - buf->typeStringPtr = 0; - return 0; -} - - -int OSC_closeAllBundles(OSCbuf *buf) { - if (buf->bundleDepth == 0) { - /* This handles EMPTY, ONE_MSG, ARGS, and DONE */ - OSC_errorMessage = "Can't close all bundles; no bundle is open!"; - return 6; - } - - if (CheckTypeTag(buf, '\0')) return 9; - - while (buf->bundleDepth > 0) { - OSC_closeBundle(buf); - } - buf->typeStringPtr = 0; - return 0; -} - -int OSC_writeAddress(OSCbuf *buf, char *name) { - int4byte paddedLength; - - if (buf->state == ONE_MSG_ARGS) { - OSC_errorMessage = "This packet is not a bundle, so you can't write another address"; - return 7; - } - - if (buf->state == DONE) { - OSC_errorMessage = "This packet is finished; can't write another address"; - return 8; - } - - if (CheckTypeTag(buf, '\0')) return 9; - - paddedLength = OSC_effectiveStringLength(name); - - if (buf->state == EMPTY) { - /* This will be a one-message packet, so no sizes to worry about */ - CheckOverflow(buf, paddedLength); - buf->state = ONE_MSG_ARGS; - } else { - /* GET_ARGS or NEED_COUNT */ - CheckOverflow(buf, 4+paddedLength); - if (buf->state == GET_ARGS) { - /* Close the old message */ - PatchMessageSize(buf); - } - buf->thisMsgSize = (int4byte *)buf->bufptr; - *(buf->thisMsgSize) = 0xbbbbbbbb; - buf->bufptr += 4; - buf->state = GET_ARGS; - } - - /* Now write the name */ - buf->bufptr += OSC_padString(buf->bufptr, name); - buf->typeStringPtr = 0; - buf->gettingFirstUntypedArg = 1; - - return 0; -} - -int OSC_writeAddressAndTypes(OSCbuf *buf, char *name, char *types) { - int result; - int4byte paddedLength; - - if (CheckTypeTag(buf, '\0')) return 9; - - result = OSC_writeAddress(buf, name); - - if (result) return result; - - paddedLength = OSC_effectiveStringLength(types); - - CheckOverflow(buf, paddedLength); - - buf->typeStringPtr = buf->bufptr + 1; /* skip comma */ - buf->bufptr += OSC_padString(buf->bufptr, types); - - buf->gettingFirstUntypedArg = 0; - return 0; -} - -static int CheckTypeTag(OSCbuf *buf, char expectedType) { - if (buf->typeStringPtr) { - if (*(buf->typeStringPtr) != expectedType) { - if (expectedType == '\0') { - OSC_errorMessage = - "According to the type tag I expected more arguments."; - } else if (*(buf->typeStringPtr) == '\0') { - OSC_errorMessage = - "According to the type tag I didn't expect any more arguments."; - } else { - OSC_errorMessage = - "According to the type tag I expected an argument of a different type."; - printf("* Expected %c, string now %s\n", expectedType, buf->typeStringPtr); - } - return 9; - } - ++(buf->typeStringPtr); - } - return 0; -} - - -int OSC_writeFloatArg(OSCbuf *buf, float arg) { - int4byte *intp; - //int result; - - CheckOverflow(buf, 4); - - if (CheckTypeTag(buf, 'f')) return 9; - - /* Pretend arg is a long int so we can use htonl() */ - intp = ((int4byte *) &arg); - *((int4byte *) buf->bufptr) = htonl(*intp); - - buf->bufptr += 4; - - buf->gettingFirstUntypedArg = 0; - return 0; -} - - - -int OSC_writeFloatArgs(OSCbuf *buf, int numFloats, float *args) { - int i; - int4byte *intp; - - CheckOverflow(buf, 4 * numFloats); - - /* Pretend args are long ints so we can use htonl() */ - intp = ((int4byte *) args); - - for (i = 0; i < numFloats; i++) { - if (CheckTypeTag(buf, 'f')) return 9; - *((int4byte *) buf->bufptr) = htonl(intp[i]); - buf->bufptr += 4; - } - - buf->gettingFirstUntypedArg = 0; - return 0; -} - -int OSC_writeIntArg(OSCbuf *buf, int4byte arg) { - CheckOverflow(buf, 4); - if (CheckTypeTag(buf, 'i')) return 9; - - *((int4byte *) buf->bufptr) = htonl(arg); - buf->bufptr += 4; - - buf->gettingFirstUntypedArg = 0; - return 0; -} - -int OSC_writeStringArg(OSCbuf *buf, char *arg) { - int len; - - if (CheckTypeTag(buf, 's')) return 9; - - len = OSC_effectiveStringLength(arg); - - if (buf->gettingFirstUntypedArg && arg[0] == ',') { - /* This un-type-tagged message starts with a string - that starts with a comma, so we have to escape it - (with a double comma) so it won't look like a type - tag string. */ - - CheckOverflow(buf, len+4); /* Too conservative */ - buf->bufptr += - OSC_padStringWithAnExtraStupidComma(buf->bufptr, arg); - - } else { - CheckOverflow(buf, len); - buf->bufptr += OSC_padString(buf->bufptr, arg); - } - - buf->gettingFirstUntypedArg = 0; - return 0; - -} - -/* String utilities */ - -#ifndef WIN32 -static int strlen(char *s) { - int i; - for (i=0; s[i] != '\0'; i++) /* Do nothing */ ; - return i; -} -#endif - -#define STRING_ALIGN_PAD 4 -int OSC_effectiveStringLength(char *string) { - int len = strlen(string) + 1; /* We need space for the null char. */ - - /* Round up len to next multiple of STRING_ALIGN_PAD to account for alignment padding */ - if ((len % STRING_ALIGN_PAD) != 0) { - len += STRING_ALIGN_PAD - (len % STRING_ALIGN_PAD); - } - return len; -} - -static int OSC_padString(char *dest, char *str) { - int i; - - for (i = 0; str[i] != '\0'; i++) { - dest[i] = str[i]; - } - - return OSC_WritePadding(dest, i); -} - -static int OSC_padStringWithAnExtraStupidComma(char *dest, char *str) { - int i; - - dest[0] = ','; - for (i = 0; str[i] != '\0'; i++) { - dest[i+1] = str[i]; - } - - return OSC_WritePadding(dest, i+1); -} - -static int OSC_WritePadding(char *dest, int i) { - dest[i] = '\0'; - i++; - - for (; (i % STRING_ALIGN_PAD) != 0; i++) { - dest[i] = '\0'; - } - - return i; -} diff --git a/libOSC/OSC-client.h b/libOSC/OSC-client.h deleted file mode 100644 index 1be5531..0000000 --- a/libOSC/OSC-client.h +++ /dev/null @@ -1,176 +0,0 @@ -/* -Written by Matt Wright, The Center for New Music and Audio Technologies, -University of California, Berkeley. Copyright (c) 1996,97,98,99,2000,01,02,03 -The Regents of the University of California (Regents). - -Permission to use, copy, modify, distribute, and distribute modified versions -of this software and its documentation without fee and without a signed -licensing agreement, is hereby granted, provided that the above copyright -notice, this paragraph and the following two paragraphs appear in all copies, -modifications, and distributions. - -IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING -OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED -HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE -MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -*/ - -/* - - OSC-client.h: library for constructing OpenSoundControl messages. - Derived from SynthControl.h - Author: Matt Wright - Version 0.1: 6/13/97 - Version 0.2: 7/21/2000: Support for type-tagged messages - - - General notes: - - This library abstracts away the data format for the OpenSoundControl - protocol. Users of this library can construct OpenSoundControl packets - with a function call interface instead of knowing how to lay out the bits. - - All issues of memory allocation are deferred to the user of this library. - There are two data structures that the user must allocate. The first - is the actual buffer that the message will be written into. This buffer - can be any size, but if it's too small there's a possibility that it - will become overfull. The other data structure is called an OSCbuf, - and it holds all the state used by the library as it's constructing - a buffer. - - All procedures that have the possibility of an error condition return int, - with 0 indicating no error and nonzero indicating an error. The variable - OSC_errorMessage will be set to point to a string containing an error - message explaining what the problem is. - -*/ - - -#include "OSC-timetag.h" - -/* The int4byte type has to be a 4-byte integer. You may have to - change this to long or something else on your system. */ -#ifdef __MWERKS__ - /* In Metrowerks you can set ints to be 2 or 4 bytes on 68K, but long is - always 4 bytes */ - typedef long int4byte; -#else - typedef int int4byte; -#endif - -/* The maximum depth of bundles within bundles within bundles within... - This is the size of a static array. If you exceed this limit you'll - get an error message. */ -#define MAX_BUNDLE_NESTING 32 - - -/* Don't ever manipulate the data in the OSCbuf struct directly. (It's - declared here in the header file only so your program will be able to - declare variables of type OSCbuf and have the right amount of memory - be allocated.) */ - -typedef struct OSCbuf_struct { - char *buffer; /* The buffer to hold the OSC packet */ - int size; /* Size of the buffer */ - char *bufptr; /* Current position as we fill the buffer */ - int state; /* State of partially-constructed message */ - int4byte *thisMsgSize; /* Pointer to count field before - currently-being-written message */ - int4byte *prevCounts[MAX_BUNDLE_NESTING]; - /* Pointers to count field before each currently - open bundle */ - int bundleDepth; /* How many sub-sub-bundles are we in now? */ - char *typeStringPtr; /* This pointer advances through the type - tag string as you add arguments. */ - int gettingFirstUntypedArg; /* nonzero if this message doesn't have - a type tag and we're waiting for the 1st arg */ -} OSCbuf; - - - -/* Initialize the given OSCbuf. The user of this module must pass in the - block of memory that this OSCbuf will use for a buffer, and the number of - bytes in that block. (It's the user's job to allocate the memory because - you do it differently in different systems.) */ -void OSC_initBuffer(OSCbuf *buf, int size, char *byteArray); - - -/* Reset the given OSCbuf. Do this after you send out the contents of - the buffer and want to start writing new data into it. */ -void OSC_resetBuffer(OSCbuf *buf); - - -/* Is the buffer empty? (I.e., would it be stupid to send the buffer - contents to the synth?) */ -int OSC_isBufferEmpty(OSCbuf *buf); - - -/* How much space is left in the buffer? */ -int OSC_freeSpaceInBuffer(OSCbuf *buf); - -/* Does the buffer contain a valid OSC packet? (Returns nonzero if yes.) */ -int OSC_isBufferDone(OSCbuf *buf); - -/* When you're ready to send out the buffer (i.e., when OSC_isBufferDone() - returns true), call these two procedures to get the OSC packet that's been - assembled and its size in bytes. (And then call OSC_resetBuffer() if you - want to re-use this OSCbuf for the next packet.) */ -char *OSC_getPacket(OSCbuf *buf); -int OSC_packetSize(OSCbuf *buf); - - - -/* Here's the basic model for building up OSC messages in an OSCbuf: - - - Make sure the OSCbuf has been initialized with OSC_initBuffer(). - - - To open a bundle, call OSC_openBundle(). You can then write - messages or open new bundles within the bundle you opened. - Call OSC_closeBundle() to close the bundle. Note that a packet - does not have to have a bundle; it can instead consist of just a - single message. - - - - For each message you want to send: - - - Call OSC_writeAddress() with the name of your message. (In - addition to writing your message name into the buffer, this - procedure will also leave space for the size count of this message.) - - - Alternately, call OSC_writeAddressAndTypes() with the name of - your message and with a type string listing the types of all the - arguments you will be putting in this message. - - - Now write each of the arguments into the buffer, by calling one of: - OSC_writeFloatArg() - OSC_writeFloatArgs() - OSC_writeIntArg() - OSC_writeStringArg() - - - Now your message is complete; you can send out the buffer or you can - add another message to it. -*/ - -int OSC_openBundle(OSCbuf *buf, OSCTimeTag tt); -int OSC_closeBundle(OSCbuf *buf); -int OSC_closeAllBundles(OSCbuf *buf); - -int OSC_writeAddress(OSCbuf *buf, char *name); -int OSC_writeAddressAndTypes(OSCbuf *buf, char *name, char *types); -int OSC_writeFloatArg(OSCbuf *buf, float arg); -int OSC_writeFloatArgs(OSCbuf *buf, int numFloats, float *args); -int OSC_writeIntArg(OSCbuf *buf, int4byte arg); -int OSC_writeStringArg(OSCbuf *buf, char *arg); - -extern char *OSC_errorMessage; - -/* How many bytes will be needed in the OSC format to hold the given - string? The length of the string, plus the null char, plus any padding - needed for 4-byte alignment. */ -int OSC_effectiveStringLength(char *string); diff --git a/libOSC/OSC-timetag.c b/libOSC/OSC-timetag.c deleted file mode 100644 index 666daef..0000000 --- a/libOSC/OSC-timetag.c +++ /dev/null @@ -1,170 +0,0 @@ -/* -Copyright (c) 1998,99,2000,01,02,03. The Regents of the University of California (Regents). -All Rights Reserved. Written by Matt Wright, Center for New Music and Audio Technologies, -University of California, Berkeley. - -Permission to use, copy, modify, distribute, and distribute modified versions -of this software and its documentation without fee and without a signed -licensing agreement, is hereby granted, provided that the above copyright -notice, this paragraph and the following two paragraphs appear in all copies, -modifications, and distributions. - -IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING -OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED -HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE -MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - -The OpenSound Control WWW page is - http://www.cnmat.berkeley.edu/OpenSoundControl -*/ - -/* - - OSC_timeTag.c: library for manipulating OSC time tags - Matt Wright, 5/29/97 - - Version 0.2 (9/11/98): cleaned up so no explicit type names in the .c file. - -*/ - -#include "OSC-timetag.h" - - -#ifdef HAS8BYTEINT -#define TWO_TO_THE_32_FLOAT 4294967296.0f - -OSCTimeTag OSCTT_Immediately(void) { - return (OSCTimeTag) 1; -} - -OSCTimeTag OSCTT_BiggestPossibleTimeTag(void) { - return (OSCTimeTag) 0xffffffffffffffff; -} - -OSCTimeTag OSCTT_PlusSeconds(OSCTimeTag original, float secondsOffset) { - int8 offset = (int8) (secondsOffset * TWO_TO_THE_32_FLOAT); - -/* printf("* OSCTT_PlusSeconds %llx plus %f seconds (i.e., %lld offset) is %llx\n", original, - secondsOffset, offset, original + offset); */ - - return original + offset; -} - -int OSCTT_Compare(OSCTimeTag left, OSCTimeTag right) { -#if 0 - printf("***** OSCTT_Compare(%llx, %llx): %d\n", left, right, - (left - -#define SECONDS_FROM_1900_to_1970 2208988800 /* 17 leap years */ -#define TWO_TO_THE_32_OVER_ONE_MILLION 4295 - - -OSCTimeTag OSCTT_CurrentTime(void) { - uint8 result; - uint4 usecOffset; - struct timeval tv; - struct timezone tz; - - BSDgettimeofday(&tv, &tz); - - /* First get the seconds right */ - result = (unsigned) SECONDS_FROM_1900_to_1970 + - (unsigned) tv.tv_sec - - (unsigned) 60 * tz.tz_minuteswest + - (unsigned) (tz.tz_dsttime ? 3600 : 0); - -#if 0 - /* No timezone, no DST version ... */ - result = (unsigned) SECONDS_FROM_1900_to_1970 + - (unsigned) tv.tv_sec; -#endif - - - /* make seconds the high-order 32 bits */ - result = result << 32; - - /* Now get the fractional part. */ - usecOffset = (unsigned) tv.tv_usec * (unsigned) TWO_TO_THE_32_OVER_ONE_MILLION; - /* printf("** %ld microsec is offset %x\n", tv.tv_usec, usecOffset); */ - - result += usecOffset; - -/* printf("* OSCTT_CurrentTime is %llx\n", result); */ - return result; -} - -#else /* __sgi */ - -/* Instead of asking your operating system what time it is, it might be - clever to find out the current time at the instant your application - starts audio processing, and then keep track of the number of samples - output to know how much time has passed. */ - -/* Loser version for systems that have no ability to tell the current time: */ -OSCTimeTag OSCTT_CurrentTime(void) { - return (OSCTimeTag) 1; -} - -#endif /* __sgi */ - - -#else /* Not HAS8BYTEINT */ - -OSCTimeTag OSCTT_CurrentTime(void) { - OSCTimeTag result; - result.seconds = 0; - result.fraction = 1; - return result; -} - -OSCTimeTag OSCTT_BiggestPossibleTimeTag(void) { - OSCTimeTag result; - result.seconds = 0xffffffff; - result.fraction = 0xffffffff; - return result; -} - -OSCTimeTag OSCTT_Immediately(void) { - OSCTimeTag result; - result.seconds = 0; - result.fraction = 1; - return result; -} - -OSCTimeTag OSCTT_PlusSeconds(OSCTimeTag original, float secondsOffset) { - OSCTimeTag result; - result.seconds = 0; - result.fraction = 1; - return result; -} - -int OSCTT_Compare(OSCTimeTag left, OSCTimeTag right) { - /* Untested! */ - int highResult = left.seconds - right.seconds; - - if (highResult != 0) return highResult; - - return left.fraction - right.fraction; -} - - -#endif /* HAS8BYTEINT */ - diff --git a/libOSC/OSC-timetag.h b/libOSC/OSC-timetag.h deleted file mode 100644 index 1de1c45..0000000 --- a/libOSC/OSC-timetag.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -Written by Matt Wright, The Center for New Music and Audio Technologies, -University of California, Berkeley. Copyright (c) 1998,99,2000,01,02,03,04 -The Regents of the University of California (Regents). - -Permission to use, copy, modify, distribute, and distribute modified versions -of this software and its documentation without fee and without a signed -licensing agreement, is hereby granted, provided that the above copyright -notice, this paragraph and the following two paragraphs appear in all copies, -modifications, and distributions. - -IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING -OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED -HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE -MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - -The OpenSound Control WWW page is - http://www.cnmat.berkeley.edu/OpenSoundControl -*/ - -/* - OSC_timeTag.h: library for manipulating OSC time tags - Matt Wright, 5/29/97 - - Time tags in OSC have the same format as in NTP: 64 bit fixed point, with the - top 32 bits giving number of seconds sinve midnight 1/1/1900 and the bottom - 32 bits giving fractional parts of a second. We represent this by an 8-byte - unsigned long if possible, or else a struct. - - NB: On many architectures with 8-byte ints, it's illegal (like maybe a bus error) - to dereference a pointer to an 8 byte int that's not 8-byte aligned. -*/ - -#ifndef OSC_TIMETAG -#define OSC_TIMETAG - -#ifdef __sgi - #define HAS8BYTEINT - /* You may have to change this typedef if there's some other - way to specify 8 byte ints on your system */ - typedef long long int8; - typedef unsigned long long uint8; - typedef unsigned long uint4; -#else - /* You may have to redefine this typedef if ints on your system - aren't 4 bytes. */ - typedef unsigned int uint4; -#endif - - -#ifdef HAS8BYTEINT - typedef uint8 OSCTimeTag; -#else - typedef struct { - uint4 seconds; - uint4 fraction; - } OSCTimeTag; -#endif - - - -/* Return a time tag representing the current time (as of when this - procedure is called). */ -OSCTimeTag OSCTT_CurrentTime(void); - -/* Return the time tag 0x0000000000000001, indicating to the receiving device - that it should process the message immediately. */ -OSCTimeTag OSCTT_Immediately(void); - -/* Return the time tag 0xffffffffffffffff, a time so far in the future that - it's effectively infinity. */ -OSCTimeTag OSCTT_BiggestPossibleTimeTag(void); - -/* Given a time tag and a number of seconds to add to the time tag, return - the new time tag */ -OSCTimeTag OSCTT_PlusSeconds(OSCTimeTag original, float secondsOffset); - -/* Compare two time tags. Return negative if first is < second, 0 if - they're equal, and positive if first > second. */ -int OSCTT_Compare(OSCTimeTag left, OSCTimeTag right); - -#endif /* OSC_TIMETAG */ diff --git a/libOSC/test_OSC.c b/libOSC/test_OSC.c deleted file mode 100644 index 4593ec6..0000000 --- a/libOSC/test_OSC.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 1997 Regents of the University of California. - * All rights reserved. - * - * The name of the University may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE - * IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE. - */ - -/* - test_OSC.c - Trivial program to test OpenSoundControl.[ch] - - Matt Wright 6/2/97 -*/ - -#include -#include -#include "OpenSoundControl.h" - -#define SIZE 10000 - -void PrintBuf(OSCbuf *b) { - printf("Buffer is %sempty.\n", OSC_isBufferEmpty(b) ? "" : "not "); - printf("%d bytes free in buffer\n", OSC_freeSpaceInBuffer(b)); - printf("Buffer is %sready to send\n", OSC_isBufferDone(b) ?"":"not "); - - printf("Buffer: bufptr %p, state %d, thisMsgSize %p, bundleDepth %d\n" - "prevCounts[%d] %p\n", b->bufptr, b->state, b->thisMsgSize, - b->bundleDepth, b->bundleDepth, b->prevCounts[b->bundleDepth]); -} - -void PrintPacket(OSCbuf *b) { - char *p = OSC_getPacket(b); - int size = OSC_packetSize(b); - unsigned int *intp; - int i; - - printf("PrintPacket: packet at %p, size %d\n", p, size); - if (p == 0 || size == 0) return; - - printf("Hex version:"); - for (i = 0, intp = (unsigned int *)p; i < size; i += 4, intp++) { - if (i % 40 == 0) printf("\n"); - printf("%x ", *intp); - } - - printf("\n\nString version:"); - for (i = 0; i < size; i++) { - if (i % 40 == 0) printf("\n"); - if (isprint(p[i])) { - printf("%c", p[i]); - } else { - printf("\\%x", p[i] & 0x000000ff); - } - } - printf("\n"); -} - - -main() { - OSCbuf myBuf; - OSCbuf *b = &myBuf; - char bytes[SIZE]; - OSCTimeTag tt; - - printf("OSC_initBuffer\n"); - OSC_initBuffer(b, SIZE, bytes); - - PrintBuf(b); - - printf("Testing one-message packet\n"); - if (OSC_writeAddress(b, "/blah/bleh/singlemessage")) { - printf("** ERROR: %s\n", OSC_errorMessage); - } - - if (OSC_writeFloatArg(b, 1.23456f)) { - printf("** ERROR: %s\n", OSC_errorMessage); - } - - { - float floatarray[10]; - int i; - for (i = 0; i < 10; ++i) { - floatarray[i] = i * 10.0f; - } - if (OSC_writeFloatArgs(b, 10, floatarray)) { - printf("** ERROR: %s\n", OSC_errorMessage); - } - } - - if (OSC_writeIntArg(b, 123456)) { - printf("** ERROR: %s\n", OSC_errorMessage); - } - - if (OSC_writeStringArg(b, "This is a cool string, dude.")) { - printf("** ERROR: %s\n", OSC_errorMessage); - } - - PrintBuf(b); - PrintPacket(b); - - printf("Resetting\n"); - OSC_resetBuffer(b); - - printf("Testing time tags\n"); - tt = OSCTT_CurrentTime(); - printf("Time now is %llx\n", tt); - - printf("Testing bundles\n"); - if (OSC_openBundle(b, tt)) { - printf("** ERROR: %s\n", OSC_errorMessage); - } - - if (OSC_writeAddress(b, "/a/hello")) { - printf("** ERROR: %s\n", OSC_errorMessage); - } - - if (OSC_writeIntArg(b, 16)) { - printf("** ERROR: %s\n", OSC_errorMessage); - } - - if (OSC_writeIntArg(b, 32)) { - printf("** ERROR: %s\n", OSC_errorMessage); - } - - if (OSC_openBundle(b, OSCTT_PlusSeconds(tt, 1.0f))) { - printf("** ERROR: %s\n", OSC_errorMessage); - } - - if (OSC_writeAddress(b, "/b/hello")) { - printf("** ERROR: %s\n", OSC_errorMessage); - } - - if (OSC_writeAddress(b, "/c/hello")) { - printf("** ERROR: %s\n", OSC_errorMessage); - } - - OSC_closeAllBundles(b); - - PrintBuf(b); - PrintPacket(b); -} - - - diff --git a/libOSC/test_OSC_timeTag.c b/libOSC/test_OSC_timeTag.c deleted file mode 100644 index 8a1cabf..0000000 --- a/libOSC/test_OSC_timeTag.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 1997 Regents of the University of California. - * All rights reserved. - * - * The name of the University may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE - * IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR - * PURPOSE. - */ - -/* - test_OSC_timeTag.c - Matt Wright, 5/30/97 -*/ - -#include -#include "OSC_timeTag.h" - -main() { - OSCTimeTag now, later; - - now = OSCTT_CurrentTime(); - printf("Now it's %llu (0x%llx)\n", now, now); - - printf("Immediately would be %llu (0x%llx)\n", OSCTT_Immediately(), - OSCTT_Immediately()); - - later = OSCTT_PlusSeconds(now, 1.0f); - printf("One second from now would be %llu (0x%llx)\n", later, later); - - now = OSCTT_CurrentTime(); - printf("And *now* it's %llu (0x%llx)\n", now, now); -} - diff --git a/oscx-meta.pd b/oscx-meta.pd new file mode 100644 index 0000000..5c1e2f0 --- /dev/null +++ b/oscx-meta.pd @@ -0,0 +1,7 @@ +#N canvas 15 49 200 200 10; +#N canvas 25 49 420 300 META 1; +#X text 13 41 NAME oscx; +#X text 10 25 AUTHOR Adrian Freed \, Matt Wright \, raf@interaccess.com\, piotr@majdak.com \, jdl@xdv.org \, Hans-Christoph Steiner ; +#X text 10 10 VERSION 0.3.1; +#X text 10 60 LICENSE GPLv2+; +#X restore 10 10 pd META; diff --git a/send+dump/Makefile.in b/send+dump/Makefile.in deleted file mode 100644 index 8bf6b69..0000000 --- a/send+dump/Makefile.in +++ /dev/null @@ -1,30 +0,0 @@ -LIBS = @LIBS@ -LIBOSCDIR = ../libOSC -LIBOSC = ${LIBOSCDIR}/libOSC.a - -# strange bug requires this... -CFLAGS= @CFLAGS@ @INCLUDES@ -# INCLUDES= @INCLUDES@ - -DUMPOBJS=dumpOSC.o - - -both: sendOSC dumpOSC - -sendOSC: sendOSC.o htmsocket.o ${LIBOSC} - ${CC} ${CFLAGS} $(INCLUDES) -o sendOSC sendOSC.o htmsocket.o $(LIBS) ${LIBOSC} - -dumpOSC: ${DUMPOBJS} - ${CC} ${CFLAGS} $(INCLUDES) -o $@ ${DUMPOBJS} $(LIBS) - -dumpUDP: dumpUDP.o - ${CC} ${CFLAGS} $(INCLUDES) -o dumpUDP dumpUDP.o $(LIBS) - -${LIBOSC}: - echo "You need to go to " ${LIBOSCDIR} " and do a make." - (cd ../libOSC ; make) - -clean: - rm -f sendOSC dumpOSC *.o - - diff --git a/send+dump/dumpOSC.c b/send+dump/dumpOSC.c deleted file mode 100644 index 7603fca..0000000 --- a/send+dump/dumpOSC.c +++ /dev/null @@ -1,723 +0,0 @@ -/* -Written by Matt Wright and Adrian Freed, The Center for New Music and -Audio Technologies, University of California, Berkeley. Copyright (c) -1992,93,94,95,96,97,98,99,2000,01,02,03,04 The Regents of the University of -California (Regents). - -Permission to use, copy, modify, distribute, and distribute modified versions -of this software and its documentation without fee and without a signed -licensing agreement, is hereby granted, provided that the above copyright -notice, this paragraph and the following two paragraphs appear in all copies, -modifications, and distributions. - -IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING -OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED -HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE -MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - - -The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl -*/ - - - /* - - dumpOSC.c - server that displays OpenSoundControl messages sent to it - for debugging client udp and UNIX protocol - - by Matt Wright, 6/3/97 - modified from dumpSC.c, by Matt Wright and Adrian Freed - - version 0.2: Added "-silent" option a.k.a. "-quiet" - - version 0.3: Incorporated patches from Nicola Bernardini to make - things Linux-friendly. Also added ntohl() in the right places - to support little-endian architectures. - - CNMAT OSX compile changes not included (20040820) jdl - - compile: - cc -o dumpOSC dumpOSC.c - - to-do: - - More robustness in saying exactly what's wrong with ill-formed - messages. (If they don't make sense, show exactly what was - received.) - - Time-based features: print time-received for each packet - - Clean up to separate OSC parsing code from socket/select stuff - -*/ - - -#ifdef UNIX -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef __APPLE__ - #include - #include -#endif - -#ifdef NEED_SCHEDCTL_AND_LOCK -#include -#include -#endif - - -char *htm_error_string; -typedef int Boolean; -typedef void *OBJ; - -typedef struct ClientAddressStruct { - struct sockaddr_in cl_addr; - int clilen; - int sockfd; -} *ClientAddr; - -Boolean ShowBytes = FALSE; -Boolean Silent = FALSE; - -/* Declarations */ -static int unixinitudp(int chan); -static int initudp(int chan); -static void closeudp(int sockfd); -Boolean ClientReply(int packetsize, void *packet, int socketfd, - void *clientaddresspointer, int clientaddressbufferlength); -void sgi_CleanExit(void); -Boolean sgi_HaveToQuit(void); -int RegisterPollingDevice(int fd, void (*callbackfunction)(int , void *), void *dummy); -#ifndef __APPLE__ -static void catch_sigint(); -#endif -static int Synthmessage(char *m, int n, void *clientdesc, int clientdesclength, int fd) ; -void ParseOSCPacket(char *buf, int n, ClientAddr returnAddr); -static void Smessage(char *address, void *v, int n, ClientAddr returnAddr); -static void PrintTypeTaggedArgs(void *v, int n); -static void PrintHeuristicallyTypeGuessedArgs(void *v, int n, int skipComma); -char *DataAfterAlignedString(char *string, char *boundary) ; -Boolean IsNiceString(char *string, char *boundary) ; -void complain(char *s, ...); - - -#define UNIXDG_PATH "/tmp/htm" -#define UNIXDG_TMP "/tmp/htm.XXXXXX" -static int unixinitudp(int chan) -{ - struct sockaddr_un serv_addr; - int sockfd; - - if((sockfd = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0) - return sockfd; - - bzero((char *)&serv_addr, sizeof(serv_addr)); - serv_addr.sun_family = AF_UNIX; - strcpy(serv_addr.sun_path, UNIXDG_PATH); - sprintf(serv_addr.sun_path+strlen(serv_addr.sun_path), "%d", chan); - unlink(serv_addr.sun_path); - if(bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr.sun_family)+strlen(serv_addr.sun_path)) < 0) - { - perror("unable to bind\n"); - return -1; - } - - fcntl(sockfd, F_SETFL, FNDELAY); - return sockfd; -} - -static int initudp(int chan) -{ - struct sockaddr_in serv_addr; - int sockfd; - - if((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) - return sockfd; - bzero((char *)&serv_addr, sizeof(serv_addr)); - serv_addr.sin_family = AF_INET; - serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); - serv_addr.sin_port = htons(chan); - - if(bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) - { - perror("unable to bind\n"); - return -1; - } - - fcntl(sockfd, F_SETFL, FNDELAY); - return sockfd; -} - -static void closeudp(int sockfd) { - close(sockfd); -} - -static Boolean catchupflag=FALSE; -Boolean ClientReply(int packetsize, void *packet, int socketfd, - void *clientaddresspointer, int clientaddressbufferlength) -{ - if(!clientaddresspointer) return FALSE; - catchupflag= TRUE; - return packetsize==sendto(socketfd, packet, packetsize, 0, clientaddresspointer, clientaddressbufferlength); -} - -static Boolean exitflag= FALSE; -void sgi_CleanExit(void) { - exitflag = TRUE; -} - -Boolean sgi_HaveToQuit(void) { - return exitflag; -} - - -/* file descriptor poll table */ -static int npolldevs =0; -typedef struct polldev -{ - int fd; - void (*callbackfunction)(int , void *); - void *dummy; -} polldev; -#define TABMAX 8 -static polldev polldevs[TABMAX]; - - -/* Register a device (referred to by a file descriptor that the caller - should have already successfully obtained from a system call) to be - polled as real-time constraints allowed. - - When a select(2) call indicates activity on the file descriptor, the - callback function is called with the file descripter as first - argument and the given dummy argument (presumably a pointer to the - instance variables associated with the device). -*/ -int RegisterPollingDevice(int fd, void (*callbackfunction)(int , void *), void *dummy) -{ - if(npolldevscl_addr.sin_addr.s_addr; - printf("Client address %p:\n", CA); - printf(" clilen %d, sockfd %d\n", CA->clilen, CA->sockfd); - printf(" sin_family %d, sin_port %d\n", CA->cl_addr.sin_family, - CA->cl_addr.sin_port); - printf(" address: (%x) %s\n", addr, inet_ntoa(CA->cl_addr.sin_addr)); - - printf(" sin_zero = \"%c%c%c%c%c%c%c%c\"\n", - CA->cl_addr.sin_zero[0], - CA->cl_addr.sin_zero[1], - CA->cl_addr.sin_zero[2], - CA->cl_addr.sin_zero[3], - CA->cl_addr.sin_zero[4], - CA->cl_addr.sin_zero[5], - CA->cl_addr.sin_zero[6], - CA->cl_addr.sin_zero[7]); - - printf("\n"); -} - - -void ParseOSCPacket(char *buf, int n, ClientAddr returnAddr) { - int size, messageLen, i; - char *messageName; - char *args; - -#ifdef PRINTADDRS - PrintClientAddr(returnAddr); -#endif - - - if ((n%4) != 0) { - complain("SynthControl packet size (%d) not a multiple of 4 bytes: dropping", - n); - return; - } - - if ((n >= 8) && (strncmp(buf, "#bundle", 8) == 0)) { - /* This is a bundle message. */ - - if (n < 16) { - complain("Bundle message too small (%d bytes) for time tag", n); - return; - } - - /* Print the time tag */ - printf("[ %lx%08lx\n", ntohl(*((unsigned long *)(buf+8))), - ntohl(*((unsigned long *)(buf+12)))); - /* Note: if we wanted to actually use the time tag as a little-endian - 64-bit int, we'd have to word-swap the two 32-bit halves of it */ - - i = 16; /* Skip "#group\0" and time tag */ - while(i n) { - complain("Bad size count %d in bundle (only %d bytes left in entire bundle)", - size, n-i-4); - return; - } - - /* Recursively handle element of bundle */ - ParseOSCPacket(buf+i+4, size, returnAddr); - i += 4 + size; - } - if (i != n) { - complain("This can't happen"); - } - printf("]\n"); - } else { - /* This is not a bundle message */ - - messageName = buf; - args = DataAfterAlignedString(messageName, buf+n); - if (args == 0) { - complain("Bad message name string: %s\nDropping entire message.\n", - htm_error_string); - return; - } - messageLen = args-messageName; - Smessage(messageName, (void *)args, n-messageLen, returnAddr); - } -} - -#define SMALLEST_POSITIVE_FLOAT 0.000001f - -static void Smessage(char *address, void *v, int n, ClientAddr returnAddr) { - char *chars = v; - - printf("%s ", address); - - if (n != 0) { - if (chars[0] == ',') { - if (chars[1] != ',') { - /* This message begins with a type-tag string */ - PrintTypeTaggedArgs(v, n); - } else { - /* Double comma means an escaped real comma, not a type string */ - PrintHeuristicallyTypeGuessedArgs(v, n, 1); - } - } else { - PrintHeuristicallyTypeGuessedArgs(v, n, 0); - } - } - - printf("\n"); - fflush(stdout); /* Added for Sami 5/21/98 */ -} - -static void PrintTypeTaggedArgs(void *v, int n) { - char *typeTags, *thisType; - char *p; - - typeTags = v; - - if (!IsNiceString(typeTags, typeTags+n)) { - /* No null-termination, so maybe it wasn't a type tag - string after all */ - PrintHeuristicallyTypeGuessedArgs(v, n, 0); - return; - } - - p = DataAfterAlignedString(typeTags, typeTags+n); - - - for (thisType = typeTags + 1; *thisType != 0; ++thisType) { - switch (*thisType) { - case 'i': case 'r': case 'm': case 'c': - printf("%d ", ntohl(*((int *) p))); - p += 4; - break; - - case 'f': { - int i = ntohl(*((int *) p)); - float *floatp = ((float *) (&i)); - printf("%f ", *floatp); - p += 4; - } - break; - - case 'h': case 't': - printf("[A 64-bit int] "); - p += 8; - break; - - case 'd': - printf("[A 64-bit float] "); - p += 8; - break; - - case 's': case 'S': - if (!IsNiceString(p, typeTags+n)) { - printf("Type tag said this arg is a string but it's not!\n"); - return; - } else { - printf("\"%s\" ", p); - p = DataAfterAlignedString(p, typeTags+n); - } - break; - - case 'T': printf("[True] "); break; - case 'F': printf("[False] "); break; - case 'N': printf("[Nil]"); break; - case 'I': printf("[Infinitum]"); break; - - default: - printf("[Unrecognized type tag %c]", *thisType); - return; - } - } -} - -static void PrintHeuristicallyTypeGuessedArgs(void *v, int n, int skipComma) { - int i, thisi; - float thisf; - int *ints; - char *chars; - char *string, *nextString; - - - /* Go through the arguments 32 bits at a time */ - ints = v; - chars = v; - - for (i = 0; i= -1000 && thisi <= 1000000) { - printf("%d ", thisi); - i++; - } else if (thisf >= -1000.f && thisf <= 1000000.f && - (thisf <=0.0f || thisf >= SMALLEST_POSITIVE_FLOAT)) { - printf("%f ", thisf); - i++; - } else if (IsNiceString(string, chars+n)) { - nextString = DataAfterAlignedString(string, chars+n); - printf("\"%s\" ", (i == 0 && skipComma) ? string +1 : string); - i += (nextString-string) / 4; - } else { - printf("0x%x ", ints[i]); - i++; - } - } -} - - -#define STRING_ALIGN_PAD 4 - -char *DataAfterAlignedString(char *string, char *boundary) -{ - /* The argument is a block of data beginning with a string. The - string has (presumably) been padded with extra null characters - so that the overall length is a multiple of STRING_ALIGN_PAD - bytes. Return a pointer to the next byte after the null - byte(s). The boundary argument points to the character after - the last valid character in the buffer---if the string hasn't - ended by there, something's wrong. - - If the data looks wrong, return 0, and set htm_error_string */ - - int i; - - if ((boundary - string) %4 != 0) { - fprintf(stderr, "Internal error: DataAfterAlignedString: bad boundary\n"); - return 0; - } - - for (i = 0; string[i] != '\0'; i++) { - if (string + i >= boundary) { - htm_error_string = "DataAfterAlignedString: Unreasonably long string"; - return 0; - } - } - - /* Now string[i] is the first null character */ - i++; - - for (; (i % STRING_ALIGN_PAD) != 0; i++) { - if (string + i >= boundary) { - htm_error_string = "DataAfterAlignedString: Unreasonably long string"; - return 0; - } - if (string[i] != '\0') { - htm_error_string = "DataAfterAlignedString: Incorrectly padded string."; - return 0; - } - } - - return string+i; -} - -Boolean IsNiceString(char *string, char *boundary) -{ - /* Arguments same as DataAfterAlignedString(). Is the given "string" - really a string? I.e., is it a sequence of isprint() characters - terminated with 1-4 null characters to align on a 4-byte boundary? */ - - int i; - - if ((boundary - string) %4 != 0) { - fprintf(stderr, "Internal error: IsNiceString: bad boundary\n"); - return 0; - } - - for (i = 0; string[i] != '\0'; i++) { - if (!isprint(string[i])) return FALSE; - if (string + i >= boundary) return FALSE; - } - - /* If we made it this far, it's a null-terminated sequence of printing characters - in the given boundary. Now we just make sure it's null padded... */ - - /* Now string[i] is the first null character */ - i++; - for (; (i % STRING_ALIGN_PAD) != 0; i++) { - if (string[i] != '\0') return FALSE; - } - - return TRUE; -} - - - - - - - -#define MAXMESG 32768 -static char mbuf[MAXMESG]; - -int main(int argc, char **argv) { - int udp_port; /* port to receive parameter updates from */ - - struct sockaddr_in cl_addr; - int clilen,maxclilen=sizeof(cl_addr); - struct sockaddr_un ucl_addr; - int uclilen,umaxclilen=sizeof(ucl_addr); - int i,n; - - - clilen = maxclilen; - uclilen = umaxclilen; - - udp_port = -1; - for (i=1; i < argc; ++i) { - if (strcmp(argv[i], "-showbytes") == 0) { - ShowBytes = TRUE; - } else if (strcmp(argv[i], "-silent") == 0 || - strcmp(argv[i], "-quiet") == 0) { - Silent = TRUE; - } else if (udp_port != -1) { - goto usageError; - } else { - udp_port = atoi(argv[i]); - if (udp_port == 0) { - goto usageError; - } - } - } - - if (udp_port == -1) { - usageError: - fprintf(stderr, "Usage\n\tdumpOSC portno [-showbytes] [-quiet]\n\t(responds to udp and UNIX packets on that port no)\n"); - exit(1); - } - - - n = recvfrom(0, mbuf, MAXMESG, 0, &cl_addr, &clilen); - if(n>0) - { - sockfd = 0; - udp_port = -1; - Synthmessage(mbuf, n, &cl_addr, clilen,sockfd) ; - } - else - { sockfd=initudp(udp_port); - usockfd=unixinitudp(udp_port); - } - - if (!Silent) { - printf("dumpOSC version 0.2 (6/18/97 Matt Wright). Unix/UDP Port %d \n", udp_port); - printf("Copyright (c) 1992,1996,1997 Regents of the University of California.\n"); - } - if(sockfd>=0 && usockfd>=0) - { - fd_set read_fds, write_fds; - int nfds; -#define max(a,b) (((a) > (b)) ? (a) : (b)) - nfds = max(sockfd, usockfd)+ 1; - { - int j; - for(j=0;j=nfds) - { - nfds = polldevs[j].fd+1; -/* -printf("polldev %d\n", polldevs[j].fd); -*/ - } - } -/* - printf("nfds %d\n", nfds); -*/ - caught_sigint = 0; -#ifndef __APPLE__ - sigset(SIGINT, catch_sigint); /* set sig handler */ -#endif - while(!caught_sigint) - { - - int r; - - back: - - FD_ZERO(&read_fds); /* clear read_fds */ - FD_ZERO(&write_fds); /* clear write_fds */ - FD_SET(sockfd, &read_fds); - FD_SET(usockfd, &read_fds); - { - int j; - - for(j=0;j0) - { - int r; - /* printf("received UDP packet of length %d\n", n); */ - r = Synthmessage(mbuf, n, &cl_addr, clilen, sockfd) ; - - if( sgi_HaveToQuit()) goto out; - if(r>0) goto back; - clilen = maxclilen; - } - } - if(FD_ISSET(usockfd, &read_fds)) - { - uclilen = umaxclilen; - while( (n = recvfrom(usockfd, mbuf, MAXMESG, 0, &ucl_addr, &uclilen)) >0) - { - int r; - /* printf("received UNIX packet of length %d\n", n); */ - - r=Synthmessage(mbuf, n, &ucl_addr, uclilen,usockfd) ; - - if( sgi_HaveToQuit()) goto out; - if(r>0) goto back; - uclilen = umaxclilen; - } - } - } /* End of while(!caught_sigint) */ - closeudp(sockfd); - -out: ; - } - else - perror("initudp"); - - return 0; -} - - -#include -void complain(char *s, ...) { - va_list ap; - va_start(ap, s); - fprintf(stderr, "*** ERROR: "); - vfprintf(stderr, s, ap); - fprintf(stderr, "\n"); - va_end(ap); -} - -#endif /* __sgi or LINUX */ diff --git a/send+dump/dumpUDP.c b/send+dump/dumpUDP.c deleted file mode 100644 index 494a6e3..0000000 --- a/send+dump/dumpUDP.c +++ /dev/null @@ -1,190 +0,0 @@ -/* -Written by Matt Wright, The Center for New Music and -Audio Technologies, University of California, Berkeley. Copyright (c) -1998,99,2000,01,02,03,04 The Regents of the University of -California (Regents). - -Permission to use, copy, modify, distribute, and distribute modified versions -of this software and its documentation without fee and without a signed -licensing agreement, is hereby granted, provided that the above copyright -notice, this paragraph and the following two paragraphs appear in all copies, -modifications, and distributions. - -IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING -OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED -HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE -MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - - -The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl - -dumpUDP.c: smallest UDP receiving application -by Matt Wright, 9/9/98 - -*/ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -typedef struct ClientAddressStruct { - struct sockaddr_in cl_addr; - int clilen; - int sockfd; -} *ClientAddr; - -void PrintClientAddr(ClientAddr CA) { - unsigned long addr = CA->cl_addr.sin_addr.s_addr; - printf("Client address %p:\n", CA); - printf(" clilen %d, sockfd %d\n", CA->clilen, CA->sockfd); - printf(" sin_family %d, sin_port %d\n", CA->cl_addr.sin_family, - CA->cl_addr.sin_port); - printf(" address: (%x) %s\n", addr, inet_ntoa(CA->cl_addr.sin_addr)); - - printf(" sin_zero = \"%c%c%c%c%c%c%c%c\"\n", - CA->cl_addr.sin_zero[0], - CA->cl_addr.sin_zero[1], - CA->cl_addr.sin_zero[2], - CA->cl_addr.sin_zero[3], - CA->cl_addr.sin_zero[4], - CA->cl_addr.sin_zero[5], - CA->cl_addr.sin_zero[6], - CA->cl_addr.sin_zero[7]); - - printf("\n"); -} - - -static int initudp(int port) { - struct sockaddr_in serv_addr; - int n, sockfd; - - if((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) - return sockfd; - bzero((char *)&serv_addr, sizeof(serv_addr)); - serv_addr.sin_family = AF_INET; - serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); - serv_addr.sin_port = htons(port); - - if(bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) - { - perror("unable to bind\n"); - return -1; - } - - fcntl(sockfd, F_SETFL, FNDELAY); - return sockfd; -} - - -static void closeudp(int sockfd) { - close(sockfd); -} - - -static int time_to_quit; - -static void catch_sigint() { - time_to_quit = 1; -} - -void GotAPacket(char *buf, int n, ClientAddr returnAddr) { - printf("received UDP packet of length %d\n", n); - PrintClientAddr(returnAddr); -} - -#define MAXMESG 32768 -static char mbuf[MAXMESG]; - -void ReceivePacket(int sockfd) { - struct ClientAddressStruct returnAddress; - int maxclilen=sizeof(returnAddress.cl_addr); - int n; - - returnAddress.clilen = maxclilen; - while( (n = recvfrom(sockfd, mbuf, MAXMESG, 0, &(returnAddress.cl_addr), - &(returnAddress.clilen))) >0) { - GotAPacket(mbuf, n, &returnAddress); - - if (time_to_quit) return; - returnAddress.clilen = maxclilen; - } -} - -void main(int argc, char **argv) { - int udp_port; /* port to receive parameter updates from */ - int sockfd; - int i; - - fd_set read_fds, write_fds; - int nfds; - - udp_port = 7000; - - sockfd=initudp(udp_port); - - if(sockfd<0) { - perror("initudp"); - return; - } - - nfds = sockfd + 1; - - time_to_quit = 0; - sigset(SIGINT, catch_sigint); /* set sig handler */ - - while(!time_to_quit) - { - - int c,r; - - back: - - FD_ZERO(&read_fds); /* clear read_fds */ - FD_ZERO(&write_fds); /* clear write_fds */ - FD_SET(sockfd, &read_fds); - - - r = select(nfds, &read_fds, &write_fds, (fd_set *)0, - (struct timeval *)0); - if (r < 0) /* select reported an error */ - goto out; - - if(FD_ISSET(sockfd, &read_fds)) { - ReceivePacket(sockfd); - } - - } /* End of while(!time_to_quit) */ -out: ; -} diff --git a/send+dump/htmsocket.c b/send+dump/htmsocket.c deleted file mode 100644 index 1cc17cd..0000000 --- a/send+dump/htmsocket.c +++ /dev/null @@ -1,313 +0,0 @@ -/* -Written by Adrian Freed, The Center for New Music and Audio Technologies, -University of California, Berkeley. Copyright (c) 1992,93,94,95,96,97,98,99,2000,01,02,03,04 -The Regents of the University of California (Regents). - -Permission to use, copy, modify, distribute, and distribute modified versions -of this software and its documentation without fee and without a signed -licensing agreement, is hereby granted, provided that the above copyright -notice, this paragraph and the following two paragraphs appear in all copies, -modifications, and distributions. - -IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING -OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED -HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE -MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - - -The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl -*/ - - /* htmsocket.c - - Adrian Freed - send parameters to htm servers by udp or UNIX protocol - - Modified 6/6/96 by Matt Wright to understand symbolic host names - in addition to X.X.X.X addresses. - - pd: branched jdl - -- win additions raf 2002 - -- enabled broadcast jdl 2003 - */ - -#if HAVE_CONFIG_H -#include -#endif - -#ifdef __APPLE__ - #include -#endif - -#ifdef _WIN32 - #include - #include - #include - #include - #include - #include - #include - #include "OSC-common.h" - #include -#else - #include - #include - #include - #include - #include - -// #include - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -// #include - - #include -#endif - -#define UNIXDG_PATH "/tmp/htm" -#define UNIXDG_TMP "/tmp/htm.XXXXXX" -#include "htmsocket.h" -typedef struct -{ - float srate; - - struct sockaddr_in serv_addr; /* udp socket */ - #ifndef WIN32 - struct sockaddr_un userv_addr; /* UNIX socket */ - #endif - int sockfd; /* socket file descriptor */ - int index, len,uservlen; - void *addr; - int id; -} desc; - -/* open a socket for HTM communication to given host on given portnumber */ -/* if host is 0 then UNIX protocol is used (i.e. local communication */ -void *OpenHTMSocket(char *host, int portnumber) -{ - struct sockaddr_in cl_addr; - #ifndef WIN32 - int sockfd; - struct sockaddr_un ucl_addr; - #else - unsigned int sockfd; - #endif - - char oval = 1; - - desc *o; - o = malloc(sizeof(*o)); - if(!o) - return 0; - - #ifndef WIN32 - - if(!host) - { - char *mktemp(char *); - int clilen; - o->len = sizeof(ucl_addr); - /* - * Fill in the structure "userv_addr" with the address of the - * server that we want to send to. - */ - - bzero((char *) &o->userv_addr, sizeof(o->userv_addr)); - o->userv_addr.sun_family = AF_UNIX; - strcpy(o->userv_addr.sun_path, UNIXDG_PATH); - sprintf(o->userv_addr.sun_path+strlen(o->userv_addr.sun_path), "%d", portnumber); - o->uservlen = sizeof(o->userv_addr.sun_family) + strlen(o->userv_addr.sun_path); - o->addr = &(o->userv_addr); - /* - * Open a socket (a UNIX domain datagram socket). - */ - - if ( (sockfd = socket(AF_UNIX, SOCK_DGRAM, 0)) >= 0) - { - /* - * Bind a local address for us. - * In the UNIX domain we have to choose our own name (that - * should be unique). We'll use mktemp() to create a unique - * pathname, based on our process id. - */ - - bzero((char *) &ucl_addr, sizeof(ucl_addr)); /* zero out */ - ucl_addr.sun_family = AF_UNIX; - strcpy(ucl_addr.sun_path, UNIXDG_TMP); - - mktemp(ucl_addr.sun_path); - clilen = sizeof(ucl_addr.sun_family) + strlen(ucl_addr.sun_path); - - if (bind(sockfd, (struct sockaddr *) &ucl_addr, clilen) < 0) - { - perror("client: can't bind local address"); - close(sockfd); - sockfd = -1; - } - } - else - perror("unable to make socket\n"); - - }else - - #endif - - { - /* - * Fill in the structure "serv_addr" with the address of the - * server that we want to send to. - */ - o->len = sizeof(cl_addr); - - #ifdef WIN32 - ZeroMemory((char *)&o->serv_addr, sizeof(o->serv_addr)); - #else - bzero((char *)&o->serv_addr, sizeof(o->serv_addr)); - #endif - - o->serv_addr.sin_family = AF_INET; - - /* MW 6/6/96: Call gethostbyname() instead of inet_addr(), - so that host can be either an Internet host name (e.g., - "les") or an Internet address in standard dot notation - (e.g., "128.32.122.13") */ - { - struct hostent *hostsEntry; - unsigned long address; - - hostsEntry = gethostbyname(host); - if (hostsEntry == NULL) { - fprintf(stderr, "Couldn't decipher host name \"%s\"\n", host); - #ifndef WIN32 - herror(NULL); - #endif - return 0; - } - - address = *((unsigned long *) hostsEntry->h_addr_list[0]); - o->serv_addr.sin_addr.s_addr = address; - } - - /* was: o->serv_addr.sin_addr.s_addr = inet_addr(host); */ - - /* End MW changes */ - - /* - * Open a socket (a UDP domain datagram socket). - */ - - - #ifdef WIN32 - o->serv_addr.sin_port = htons((USHORT)portnumber); - o->addr = &(o->serv_addr); - if((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) != INVALID_SOCKET) { - ZeroMemory((char *)&cl_addr, sizeof(cl_addr)); - cl_addr.sin_family = AF_INET; - cl_addr.sin_addr.s_addr = htonl(INADDR_ANY); - cl_addr.sin_port = htons(0); - - // enable broadcast: jdl ~2003 - if(setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &oval, sizeof(int)) == -1) { - perror("setsockopt"); - } - - if(bind(sockfd, (struct sockaddr *) &cl_addr, sizeof(cl_addr)) < 0) { - perror("could not bind\n"); - closesocket(sockfd); - sockfd = -1; - } - } - else { perror("unable to make socket\n");} - #else - o->serv_addr.sin_port = htons(portnumber); - o->addr = &(o->serv_addr); - if((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) >= 0) { - bzero((char *)&cl_addr, sizeof(cl_addr)); - cl_addr.sin_family = AF_INET; - cl_addr.sin_addr.s_addr = htonl(INADDR_ANY); - cl_addr.sin_port = htons(0); - - // enable broadcast: jdl ~2003 - if(setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &oval, sizeof(int)) == -1) { - perror("setsockopt"); - } - - if(bind(sockfd, (struct sockaddr *) &cl_addr, sizeof(cl_addr)) < 0) { - perror("could not bind\n"); - close(sockfd); - sockfd = -1; - } - } - else { perror("unable to make socket\n");} - #endif - } - #ifdef WIN32 - if(sockfd == INVALID_SOCKET) { - #else - if(sockfd < 0) { - #endif - free(o); - o = 0; - } - else - o->sockfd = sockfd; - return o; -} - - -#include - -static bool sendudp(const struct sockaddr *sp, int sockfd,int length, int count, void *b) -{ - int rcount; - if((rcount=sendto(sockfd, b, count, 0, sp, length)) != count) - { - printf("sockfd %d count %d rcount %dlength %d errno %d\n", sockfd,count,rcount,length, errno); - return FALSE; - } - return TRUE; -} -bool SendHTMSocket(void *htmsendhandle, int length_in_bytes, void *buffer) -{ - desc *o = (desc *)htmsendhandle; - return sendudp(o->addr, o->sockfd, o->len, length_in_bytes, buffer); -} -void CloseHTMSocket(void *htmsendhandle) -{ - desc *o = (desc *)htmsendhandle; - #ifdef WIN32 - if(SOCKET_ERROR == closesocket(o->sockfd)) { - perror("CloseHTMSocket::closesocket failed\n"); - return; - } - #else - if(close(o->sockfd) == -1) - { - perror("CloseHTMSocket::closesocket failed"); - return; - } - #endif - - free(o); -} diff --git a/send+dump/htmsocket.h b/send+dump/htmsocket.h deleted file mode 100644 index 07bea93..0000000 --- a/send+dump/htmsocket.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -Written by Adrian Freed, The Center for New Music and Audio Technologies, -University of California, Berkeley. Copyright (c) 1992,93,94,95,96,97,98,99,2000,01,02,03,04 -The Regents of the University of California (Regents). - -Permission to use, copy, modify, distribute, and distribute modified versions -of this software and its documentation without fee and without a signed -licensing agreement, is hereby granted, provided that the above copyright -notice, this paragraph and the following two paragraphs appear in all copies, -modifications, and distributions. - -IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING -OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED -HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE -MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - - -The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl -*/ - - - /* htmparam.h - - Adrian Freed - send parameters to htm servers by udp or UNIX protocol - */ -#ifndef TRUE -#define TRUE 1 -#define FALSE 0 -#endif -typedef int bool; - -/* open a socket for HTM communication to given host on given portnumber */ -/* if host is 0 then UNIX protocol is used (i.e. local communication) */ -void *OpenHTMSocket(char *host, int portnumber); - -/* send a buffer of data over htm socket, returns TRUE on success. - Note that udp sends rarely fail. UNIX sends fail if a kernal buffer overflows */ -bool SendHTMSocket(void *htmsendhandle, int length_in_bytes, void *buffer); - -/* close the socket(2) and release memory associated with it */ -void CloseHTMSocket(void *htmsendhandle); diff --git a/send+dump/sendOSC.c b/send+dump/sendOSC.c deleted file mode 100644 index bde4f8d..0000000 --- a/send+dump/sendOSC.c +++ /dev/null @@ -1,602 +0,0 @@ -/* -Written by Matt Wright, The Center for New Music and Audio Technologies, -University of California, Berkeley. Copyright (c) 1996,97,98,99,2000,01,02,03 -The Regents of the University of California (Regents). - -Permission to use, copy, modify, distribute, and distribute modified versions -of this software and its documentation without fee and without a signed -licensing agreement, is hereby granted, provided that the above copyright -notice, this paragraph and the following two paragraphs appear in all copies, -modifications, and distributions. - -IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING -OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED -HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE -MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - - -The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl -*/ - -/* sendOSC.c - - Matt Wright, 6/3/97 - based on sendSC.c, which was based on a version by Adrian Freed - - Text-based OpenSoundControl client. User can enter messages via command - line arguments or standard input. - - Version 0.1: "play" feature - Version 0.2: Message type tags. - -*/ - -#define VERSION "http://cnmat.berkeley.edu/OpenSoundControl/sendOSC-0.1.html" - -/* -compiling: - cc -o sendOSC sendOSC.c htmsocket.c OpenSoundControl.c OSC_timeTag.c -*/ - - -#include "OSC-client.h" -#include "htmsocket.h" - -#include -#include -/* #include */ -#include - -#ifdef UNIX - #include - #include -#endif - -typedef struct { - enum {INT, FLOAT, STRING} type; - union { - int i; - float f; - char *s; - } datum; -} typedArg; - -void CommandLineMode(int argc, char *argv[], void *htmsocket); -void InteractiveMode(void *htmsocket); -OSCTimeTag ParseTimeTag(char *s); -void ParseInteractiveLine(OSCbuf *buf, char *mesg); -typedArg ParseToken(char *token); -int WriteMessage(OSCbuf *buf, char *messageName, int numArgs, typedArg *args); -void SendBuffer(void *htmsocket, OSCbuf *buf); -void SendData(void *htmsocket, int size, char *data); -void fatal_error(char *s); -void complain(char *s, ...); - -/* Exit status codes: - 0: successful - 2: Message(s) dropped because of buffer overflow - 3: Socket error - 4: Usage error - 5: Internal error -*/ -static int exitStatus = 0; - - -static int useTypeTags = 1; - -int main(int argc, char *argv[]) { - int portnumber; - char *hostname = 0; - void *htmsocket; - - argc--; - argv++; - - if (argc == 0) { - goto usageerror; - } - - if (argc >= 1 && (strncmp(*argv, "-notypetags", 2) == 0)) { - useTypeTags = 0; - argv++; - argc--; - } - - if (argc >= 2 && (strncmp(*argv, "-r", 2) == 0)) { - hostname = getenv("REMOTE_ADDR"); - if (hostname == NULL) { - complain("sendSC -r: REMOTE_ADDR not in environment\n"); - exit(4); - } - argv++; - argc--; - } - - if (argc >= 3 && (strncmp(*argv, "-h", 2) == 0)) { - hostname = argv[1]; - argv += 2; - argc -= 2; - } - portnumber = atoi(*argv); - argv++; - argc--; - - htmsocket = OpenHTMSocket(hostname, portnumber); - if (!htmsocket) { - perror("Couldn't open socket: "); - exit(3); - } - - if (argc > 0) { - printf("host %s, port %d, %s\n", hostname, portnumber, - useTypeTags ? "use type tags" : "don't use type tags"); - CommandLineMode(argc, argv, htmsocket); - } else { - printf("sendOSC version " VERSION "\n"); - printf("by Matt Wright. Copyright (c) 1996, 1997 Regents of the University of California.\n"); - printf("host %s, port %d, %s\n", hostname, portnumber, - useTypeTags ? "use type tags" : "don't use type tags"); - InteractiveMode(htmsocket); - } - CloseHTMSocket(htmsocket); - exit(exitStatus); - - - usageerror: - complain("usage: %s [-notypetags] [-r] [-h target_host_name] port_number [message...]\n", - argv[-1]); - exit(4); - -} - - -#define MAX_ARGS 2000 -#define SC_BUFFER_SIZE 32000 -static char bufferForOSCbuf[SC_BUFFER_SIZE]; - -void CommandLineMode(int argc, char *argv[], void *htmsocket) { - char *messageName; - char *token; - typedArg args[MAX_ARGS]; - int i,j, numArgs; - OSCbuf buf[1]; - - OSC_initBuffer(buf, SC_BUFFER_SIZE, bufferForOSCbuf); - - if (argc > 1) { - if (OSC_openBundle(buf, OSCTT_Immediately())) { - complain("Problem opening bundle: %s\n", OSC_errorMessage); - return; - } - } - - for (i = 0; i < argc; i++) { - messageName = strtok(argv[i], ","); - if (messageName == NULL) { - break; - } - - j = 0; - while ((token = strtok(NULL, ",")) != NULL) { - args[j] = ParseToken(token); - j++; - if (j >= MAX_ARGS) { - complain("Sorry; your message has more than MAX_ARGS (%d) arguments; ignoring the rest.\n", - MAX_ARGS); - break; - } - } - numArgs = j; - - WriteMessage(buf, messageName, numArgs, args); - } - - if (argc > 1) { - if (OSC_closeBundle(buf)) { - complain("Problem closing bundle: %s\n", OSC_errorMessage); - return; - } - } - - SendBuffer(htmsocket, buf); -} - -#define MAXMESG 2048 - -void InteractiveMode(void *htmsocket) { - char mesg[MAXMESG]; - OSCbuf buf[1]; - int bundleDepth = 0; /* At first, we haven't seen "[". */ - - OSC_initBuffer(buf, SC_BUFFER_SIZE, bufferForOSCbuf); - - while (fgets(mesg, MAXMESG, stdin) != NULL) { - if (mesg[0] == '\n') { - if (bundleDepth > 0) { - /* Ignore blank lines inside a group. */ - } else { - /* blank line => repeat previous send */ - SendBuffer(htmsocket, buf); - } - continue; - } - - if (bundleDepth == 0) { - OSC_resetBuffer(buf); - } - - if (mesg[0] == '[') { - OSCTimeTag tt = ParseTimeTag(mesg+1); - if (OSC_openBundle(buf, tt)) { - complain("Problem opening bundle: %s\n", OSC_errorMessage); - OSC_resetBuffer(buf); - bundleDepth = 0; - continue; - } - bundleDepth++; - } else if (mesg[0] == ']' && mesg[1] == '\n' && mesg[2] == '\0') { - if (bundleDepth == 0) { - complain("Unexpected ']': not currently in a bundle.\n"); - } else { - if (OSC_closeBundle(buf)) { - complain("Problem closing bundle: %s\n", OSC_errorMessage); - OSC_resetBuffer(buf); - bundleDepth = 0; - continue; - } - - bundleDepth--; - if (bundleDepth == 0) { - SendBuffer(htmsocket, buf); - } - } - } else { - ParseInteractiveLine(buf, mesg); - if (bundleDepth != 0) { - /* Don't send anything until we close all bundles */ - } else { - SendBuffer(htmsocket, buf); - } - } - } -} - -OSCTimeTag ParseTimeTag(char *s) { - char *p, *newline; - typedArg arg; - - p = s; - while (isspace(*p)) p++; - if (*p == '\0') return OSCTT_Immediately(); - - if (*p == '+') { - /* Time tag is for some time in the future. It should be a - number of seconds as an int or float */ - - newline = strchr(s, '\n'); - if (newline != NULL) *newline = '\0'; - - p++; /* Skip '+' */ - while (isspace(*p)) p++; - - arg = ParseToken(p); - if (arg.type == STRING) { - complain("warning: inscrutable time tag request: %s\n", s); - return OSCTT_Immediately(); - } else if (arg.type == INT) { - return OSCTT_PlusSeconds(OSCTT_CurrentTime(), - (float) arg.datum.i); - } else if (arg.type == FLOAT) { - return OSCTT_PlusSeconds(OSCTT_CurrentTime(), arg.datum.f); - } else { - fatal_error("This can't happen!"); - } - } - - if (isdigit(*p) || (*p >= 'a' && *p <='f') || (*p >= 'A' && *p <='F')) { - /* They specified the 8-byte tag in hex */ - OSCTimeTag tt; - if (sscanf(p, "%llx", &tt) != 1) { - complain("warning: couldn't parse time tag %s\n", s); - return OSCTT_Immediately(); - } -#ifndef HAS8BYTEINT - if (ntohl(1) != 1) { - /* tt is a struct of seconds and fractional part, - and this machine is little-endian, so sscanf - wrote each half of the time tag in the wrong half - of the struct. */ - uint4 temp; - temp = tt.seconds; - tt.seconds = tt.fraction ; - tt.fraction = temp; - } -#endif - return tt; - } - - complain("warning: invalid time tag: %s\n", s); - return OSCTT_Immediately(); -} - - -void ParseInteractiveLine(OSCbuf *buf, char *mesg) { - char *messageName, *token, *p; - typedArg args[MAX_ARGS]; - int thisArg; - - p = mesg; - while (isspace(*p)) p++; - if (*p == '\0') return; - - messageName = p; - - if (strcmp(messageName, "play\n") == 0) { - /* Special kludge feature to save typing */ - typedArg arg; - - if (OSC_openBundle(buf, OSCTT_Immediately())) { - complain("Problem opening bundle: %s\n", OSC_errorMessage); - return; - } - - arg.type = INT; - arg.datum.i = 0; - WriteMessage(buf, "/voices/0/tp/timbre_index", 1, &arg); - - arg.type = FLOAT; - arg.datum.i = 0.0f; - WriteMessage(buf, "/voices/0/tm/goto", 1, &arg); - - if (OSC_closeBundle(buf)) { - complain("Problem closing bundle: %s\n", OSC_errorMessage); - } - - return; - } - - while (!isspace(*p) && *p != '\0') p++; - if (isspace(*p)) { - *p = '\0'; - p++; - } - - thisArg = 0; - while (*p != '\0') { - /* flush leading whitespace */ - while (isspace(*p)) p++; - if (*p == '\0') break; - - if (*p == '"') { - /* A string argument: scan for close quotes */ - p++; - args[thisArg].type = STRING; - args[thisArg].datum.s = p; - - while (*p != '"') { - if (*p == '\0') { - complain("Unterminated quote mark: ignoring line\n"); - return; - } - p++; - } - *p = '\0'; - p++; - } else { - token = p; - while (!isspace(*p) && (*p != '\0')) p++; - if (isspace(*p)) { - *p = '\0'; - p++; - } - args[thisArg] = ParseToken(token); - } - thisArg++; - if (thisArg >= MAX_ARGS) { - complain("Sorry, your message has more than MAX_ARGS (%d) arguments; ignoring the rest.\n", - MAX_ARGS); - break; - } - } - - if (WriteMessage(buf, messageName, thisArg, args) != 0) { - complain("Problem sending message: %s\n", OSC_errorMessage); - } -} - -typedArg ParseToken(char *token) { - char *p = token; - typedArg returnVal; - - /* It might be an int, a float, or a string */ - - if (*p == '-') p++; - - if (isdigit(*p) || *p == '.') { - while (isdigit(*p)) p++; - if (*p == '\0') { - returnVal.type = INT; - returnVal.datum.i = atoi(token); - return returnVal; - } - if (*p == '.') { - p++; - while (isdigit(*p)) p++; - if (*p == '\0') { - returnVal.type = FLOAT; - returnVal.datum.f = atof(token); - return returnVal; - } - } - } - - returnVal.type = STRING; - returnVal.datum.s = token; - return returnVal; -} - -int WriteMessage(OSCbuf *buf, char *messageName, int numArgs, typedArg *args) { - int j, returnVal; - - returnVal = 0; - -#ifdef DEBUG - printf("WriteMessage: %s ", messageName); - - for (j = 0; j < numArgs; j++) { - switch (args[j].type) { - case INT: - printf("%d ", args[j].datum.i); - break; - - case FLOAT: - printf("%f ", args[j].datum.f); - break; - - case STRING: - printf("%s ", args[j].datum.s); - break; - - default: - fatal_error("Unrecognized arg type"); - exit(5); - } - } - printf("\n"); -#endif - - if (!useTypeTags) { - returnVal = OSC_writeAddress(buf, messageName); - if (returnVal) { - complain("Problem writing address: %s\n", OSC_errorMessage); - } - } else { - /* First figure out the type tags */ - char typeTags[MAX_ARGS+2]; - int i; - - typeTags[0] = ','; - - for (i = 0; i < numArgs; ++i) { - switch (args[i].type) { - case INT: - typeTags[i+1] = 'i'; - break; - - case FLOAT: - typeTags[i+1] = 'f'; - break; - - case STRING: - typeTags[i+1] = 's'; - break; - - default: - fatal_error("Unrecognized arg type"); - exit(5); - } - } - typeTags[i+1] = '\0'; - - returnVal = OSC_writeAddressAndTypes(buf, messageName, typeTags); - if (returnVal) { - complain("Problem writing address: %s\n", OSC_errorMessage); - } - } - - for (j = 0; j < numArgs; j++) { - switch (args[j].type) { - case INT: - if ((returnVal = OSC_writeIntArg(buf, args[j].datum.i)) != 0) { - return returnVal; - } - break; - - case FLOAT: - if ((returnVal = OSC_writeFloatArg(buf, args[j].datum.f)) != 0) { - return returnVal; - } - break; - - case STRING: - if ((returnVal = OSC_writeStringArg(buf, args[j].datum.s)) != 0) { - return returnVal; - } - break; - - default: - fatal_error("Unrecognized arg type"); - exit(5); - } - } - - return returnVal; -} - -void SendBuffer(void *htmsocket, OSCbuf *buf) { -#ifdef DEBUG - printf("Sending buffer...\n"); -#endif - if (OSC_isBufferEmpty(buf)) return; - if (!OSC_isBufferDone(buf)) { - fatal_error("SendBuffer() called but buffer not ready!"); - exit(5); - } - SendData(htmsocket, OSC_packetSize(buf), OSC_getPacket(buf)); -} - -void SendData(void *htmsocket, int size, char *data) { - if (!SendHTMSocket(htmsocket, size, data)) { - perror("Couldn't send out socket: "); - CloseHTMSocket(htmsocket); - exit(3); - } -} - -void fatal_error(char *s) { - fprintf(stderr, "%s\n", s); - exit(4); -} - -#include -void complain(char *s, ...) { - va_list ap; - va_start(ap, s); - vfprintf(stderr, s, ap); - va_end(ap); -} - - -#ifdef COMPUTE_MESSAGE_SIZE - /* Unused code to find the size of a message */ - - /* Compute size */ - size = SynthControl_effectiveStringLength(messageName); - - for (j = 0; j < numArgs; j++) { - switch (args[j].type) { - case INT: case FLOAT: - size += 4; - break; - - case STRING: - size += SynthControl_effectiveStringLength(args[j].datum.s); - break; - - default: - fatal_error("Unrecognized token type"); - exit(4); - } - } - - if (!SynthControl_willMessageFit(buf, size)) { - complain("Message \"%s\" won't fit in buffer: dropping.", messageName); - return; - } -#endif diff --git a/sendOSC-help.pd b/sendOSC-help.pd new file mode 100644 index 0000000..f0c92a1 --- /dev/null +++ b/sendOSC-help.pd @@ -0,0 +1,62 @@ +#N canvas 496 472 856 475 10; +#X obj 59 396 sendOSC; +#X floatatom 59 423 5 0 0 0 - - -; +#X msg 44 119 disconnect; +#X msg 79 163 send /test/bla 1 2 3; +#X msg 26 93 connect localhost 9999; +#X msg 91 187 send /ix/bli 4 fuenf 6; +#X msg 103 211 send /yps/blo 7.8 9.1 zehnkommaelf; +#X text 8 142 ========================================; +#X msg 274 92 connect localhost 10001; +#X msg 149 301 typetags 1; +#X msg 144 333 typetags 0; +#X text 475 112 typetags; +#X text 475 129 sendOSC now by default uses; +#X text 477 145 typetags.; +#X text 477 166 dumOSC on the other hand; +#X text 477 186 should be able to interpret; +#X text 478 208 this.; +#X text 474 93 new (or again):; +#X msg 423 294 [; +#X msg 423 321 ]; +#X msg 256 249 send /bla 1 2 3 \, send /bli 3 4 5 \, send /blo 4 5 +6; +#X text 462 312 when last bundle is closed the buffer is sent.; +#X text 463 333 so: first "[" \, then add messages with send /bla; +#X text 466 351 open nested nudle etc \, close with "]"; +#X floatatom 113 425 5 0 0 0 - - -; +#X text 162 428 bundleDepth; +#X text 24 11 sendOSC: send OSC formatted packet to network. at the +moment over UDP only is supported.; +#X text 28 38 supported int \, flot + string.; +#X text 462 291 open / close bundles here.; +#X text 465 372 watch the bundleDepth index change while you do this. +; +#X text 231 299 switch usage of typetags; +#X text 232 316 on/off.; +#X text 231 332 default: on; +#X text 465 392 MAX_BUNDLE_NESTING: 32; +#X msg 315 154 send; +#X msg 315 179 send /; +#X msg 368 156 send /bang; +#X msg 265 57 connect 192.168.0.255 5555; +#X text 462 58 use something like this to broadcast on UDP; +#X text 607 435 for more info \, get help on:; +#X obj 798 435 OSC; +#X connect 0 0 1 0; +#X connect 0 1 24 0; +#X connect 2 0 0 0; +#X connect 3 0 0 0; +#X connect 4 0 0 0; +#X connect 5 0 0 0; +#X connect 6 0 0 0; +#X connect 8 0 0 0; +#X connect 9 0 0 0; +#X connect 10 0 0 0; +#X connect 18 0 0 0; +#X connect 19 0 0 0; +#X connect 20 0 0 0; +#X connect 34 0 0 0; +#X connect 35 0 0 0; +#X connect 36 0 0 0; +#X connect 37 0 0 0; diff --git a/sendOSC.c b/sendOSC.c new file mode 100644 index 0000000..ffbffab --- /dev/null +++ b/sendOSC.c @@ -0,0 +1,585 @@ +/* +Written by Matt Wright, The Center for New Music and Audio Technologies, +University of California, Berkeley. Copyright (c) 1996,97,98,99,2000,01,02,03 +The Regents of the University of California (Regents). + +Permission to use, copy, modify, distribute, and distribute modified versions +of this software and its documentation without fee and without a signed +licensing agreement, is hereby granted, provided that the above copyright +notice, this paragraph and the following two paragraphs appear in all copies, +modifications, and distributions. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING +OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED +HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + + +The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl +*/ + + + +/* sendOSC.c + + Matt Wright, 6/3/97 + based on sendOSC.c, which was based on a version by Adrian Freed + + Text-based OpenSoundControl client. User can enter messages via command + line arguments or standard input. + + Version 0.1: "play" feature + Version 0.2: Message type tags. + + pd version branched from http://www.cnmat.berkeley.edu/OpenSoundControl/src/sendOSC/sendOSC.c + ------------- + -- added bundle stuff to send. jdl 20020416 + -- tweaks for Win32 www.zeggz.com/raf 13-April-2002 + -- ost_at_test.at + i22_at_test.at, 2000-2002 + modified to compile as pd externel + --20060308 MP clear out some unused code and improve conversion from pd types to OSC types +*/ + +#if HAVE_CONFIG_H +#include +#endif + +#define MAX_ARGS 2000 +#define SC_BUFFER_SIZE 64000 + +#include "m_pd.h" + +#include "OSC-common.h" +#include "OSC-client.h" +#include "htmsocket.h" + +#include +#include + +#ifdef WIN32 +#include +#else +#include +#include +#include +#include +#include +#endif + +/////////////////////// +// from sendOSC + +typedef struct +{ + enum {INT_osc, FLOAT_osc, STRING_osc, NOTYPE_osc} type; + union + { + int i; + t_float f; + char *s; + } datum; +} typedArg; + + +//static int exitStatus = 0; +static int useTypeTags = 0; + +static char bufferForOSCbuf[SC_BUFFER_SIZE]; + + +///////// +// end from sendOSC + +static t_class *sendOSC_class; + +typedef struct _sendOSC +{ + t_object x_obj; + int x_protocol; // UDP/TCP (udp only atm) + t_int x_typetags; // typetag flag + void *x_htmsocket; // sending socket + int x_bundle; // bundle open flag + OSCbuf x_oscbuf[1]; // OSCbuffer + t_outlet *x_bdpthout;// bundle-depth floatoutlet +} t_sendOSC; + +static void *sendOSC_new(t_floatarg udpflag); +void sendOSC_openbundle(t_sendOSC *x); +static void sendOSC_closebundle(t_sendOSC *x); +static void sendOSC_settypetags(t_sendOSC *x, t_float *f); +static void sendOSC_connect(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv); +void sendOSC_disconnect(t_sendOSC *x); +static void sendOSC_sendtyped(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv); +void sendOSC_send(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv); +static void sendOSC_free(t_sendOSC *x); +void sendOSC_setup(void); +typedArg ParseAtom(t_atom *a); +int WriteMessage(OSCbuf *buf, char *messageName, int numArgs, typedArg *args); +void SendBuffer(void *htmsocket, OSCbuf *buf); +void SendData(void *htmsocket, int size, char *data); + +static void *sendOSC_new(t_floatarg udpflag) +{ + t_sendOSC *x = (t_sendOSC *)pd_new(sendOSC_class); + + outlet_new(&x->x_obj, &s_float); + x->x_htmsocket = 0; // {{raf}} + // set udp + x->x_protocol = SOCK_DGRAM; ////MP20060308// not SOCK_STREAM but we don't use it anyway... + // set typetags to 1 by default + x->x_typetags = 1; + // bundle is closed + x->x_bundle = 0; + OSC_initBuffer(x->x_oscbuf, SC_BUFFER_SIZE, bufferForOSCbuf); + x->x_bdpthout = outlet_new(&x->x_obj, 0); // outlet_float(); + //x->x_oscbuf = + return (x); +} + + +void sendOSC_openbundle(t_sendOSC *x) +{ + if (x->x_oscbuf->bundleDepth + 1 >= MAX_BUNDLE_NESTING || + OSC_openBundle(x->x_oscbuf, OSCTT_Immediately())) + { + error("Problem opening bundle: %s\n", OSC_errorMessage); + return; + } + x->x_bundle = 1; + outlet_float(x->x_bdpthout, (t_float)x->x_oscbuf->bundleDepth); +} + +static void sendOSC_closebundle(t_sendOSC *x) +{ + if (OSC_closeBundle(x->x_oscbuf)) + { + error("Problem closing bundle: %s\n", OSC_errorMessage); + return; + } + outlet_float(x->x_bdpthout, (t_float)x->x_oscbuf->bundleDepth); + // in bundle mode we send when bundle is closed? + if(!OSC_isBufferEmpty(x->x_oscbuf) > 0 && OSC_isBufferDone(x->x_oscbuf)) + { + // post("x_oscbuf: something inside me?"); + if (x->x_htmsocket) + { + SendBuffer(x->x_htmsocket, x->x_oscbuf); + } + else + { + post("sendOSC: not connected"); + } + OSC_initBuffer(x->x_oscbuf, SC_BUFFER_SIZE, bufferForOSCbuf); + x->x_bundle = 0; + return; + } + // post("x_oscbuf: something went wrong"); +} + +static void sendOSC_settypetags(t_sendOSC *x, t_float *f) + { + x->x_typetags = (int)f; + post("sendOSC.c: setting typetags %d",x->x_typetags); + } + +static void sendOSC_connect(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv) // t_symbol *hostname, t_floatarg fportno, int argc, t_atom *argv) +{ + t_float fportno=0; + t_symbol *hostname; + int portno = fportno; + short ttl=-1; + char *protocolStr; + /* create a socket */ + + if (argc < 2) + return; + + if (argv[0].a_type==A_SYMBOL) + hostname = argv[0].a_w.w_symbol; + else + return; + + if (argv[1].a_type==A_FLOAT) + portno = (int)argv[1].a_w.w_float; + else + return; + + if (argc >= 3) { + if (argv[2].a_type==A_FLOAT) + ttl = (short)(unsigned char)argv[2].a_w.w_float; + else + return; + } + + // make sure handle is available + if(x->x_htmsocket == 0) + { + x->x_htmsocket = OpenHTMSocket(hostname->s_name, portno, &ttl); + if (!x->x_htmsocket) { + post("sendOSC: Couldn't open socket: "); + if (ttl==-2) + post("sendOSC: Multicast group range 224.0.0.[0-255] is reserved.\n"); + } + else + { + switch (x->x_protocol) + { + case SOCK_DGRAM: + protocolStr = "UDP"; + break; + case SOCK_STREAM: + protocolStr = "TCP"; + break; + default: + protocolStr = "unknown"; + break; + } + if (ttl>=0) + post("sendOSC: connected to port %s:%d (hSock=%d) protocol = %s ttl = %d", + hostname->s_name, portno, x->x_htmsocket, protocolStr, ttl); + else + post("sendOSC: connected to port %s:%d (hSock=%d) protocol = %s", + hostname->s_name, portno, x->x_htmsocket, protocolStr); + outlet_float(x->x_obj.ob_outlet, 1); + } + } + else + perror("call to sendOSC_connect() against unavailable socket handle"); +} + +void sendOSC_disconnect(t_sendOSC *x) +{ + if (x->x_htmsocket) + { + post("sendOSC: disconnecting htmsock (hSock=%d)...", x->x_htmsocket); + CloseHTMSocket(x->x_htmsocket); + x->x_htmsocket = 0; // {{raf}} semi-quasi-semaphorize this + outlet_float(x->x_obj.ob_outlet, 0); + } + else + { + perror("call to sendOSC_disconnect() against unused socket handle"); + } +} + + +////////////////////////////////////////////////////////////////////// +// this is the real and only sending routine now, for both typed and +// undtyped mode. + +static void sendOSC_sendtyped(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv) +{ + char messageName[MAXPDSTRING]; + // char *token; + typedArg args[MAX_ARGS]; + int i; + + messageName[0] = '\0'; // empty + + if(argc>MAX_ARGS) + { + post ("sendOSC: too many arguments! (max: %d)", MAX_ARGS); + return; + } + + // this sock needs to be larger than 0, not >= .. + if (x->x_htmsocket > 0) + { +#ifdef DEBUG + post ("sendOSC: type tags? %d", useTypeTags); +#endif + + atom_string(&argv[0], messageName, MAXPDSTRING); +// messageName = strtok(targv[0], ","); + for (i = 0; i < argc-1; i++) + { +// token = strtok(targv[i],","); + + args[i] = ParseAtom(&argv[i+1]); +#ifdef DEBUG + switch (args[i].type) + { + case INT_osc: + printf("cell-cont: %d\n", args[i].datum.i); + break; + case FLOAT_osc: + printf("cell-cont: %f\n", args[i].datum.f); + break; + case STRING_osc: + printf("cell-cont: %s\n", args[i].datum.s); + break; + case NOTYPE_osc: + printf("unknown type\n"); + break; + } + printf(" type-id: %d\n", args[i].type); +#endif + } + + if(WriteMessage(x->x_oscbuf, messageName, i, args)) + { + post("sendOSC: usage error, write-msg failed: %s", OSC_errorMessage); + return; + } + + if(!x->x_bundle) + { + SendBuffer(x->x_htmsocket, x->x_oscbuf); + OSC_initBuffer(x->x_oscbuf, SC_BUFFER_SIZE, bufferForOSCbuf); + } + + } + else post("sendOSC: not connected"); +} + +void sendOSC_send(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv) +{ + if(!argc) + { + post("not sending empty message."); + return; + } + if(x->x_typetags) + { + useTypeTags = 1; + sendOSC_sendtyped(x,s,argc,argv); + useTypeTags = 0; + } + else + { + sendOSC_sendtyped(x,s,argc,argv); + } +} + +static void sendOSC_free(t_sendOSC *x) +{ + sendOSC_disconnect(x); +} + +void sendOSC_setup(void) +{ + sendOSC_class = class_new(gensym("sendOSC"), (t_newmethod)sendOSC_new, + (t_method)sendOSC_free, + sizeof(t_sendOSC), 0, A_DEFFLOAT, 0); + class_addmethod(sendOSC_class, (t_method)sendOSC_connect, + gensym("connect"), A_GIMME, 0); + class_addmethod(sendOSC_class, (t_method)sendOSC_disconnect, + gensym("disconnect"), 0); + class_addmethod(sendOSC_class, (t_method)sendOSC_settypetags, + gensym("typetags"), + A_FLOAT, 0); + class_addmethod(sendOSC_class, (t_method)sendOSC_send, + gensym("send"), + A_GIMME, 0); + class_addmethod(sendOSC_class, (t_method)sendOSC_send, + gensym("senduntyped"), + A_GIMME, 0); + class_addmethod(sendOSC_class, (t_method)sendOSC_send, + gensym("sendtyped"), + A_GIMME, 0); + class_addmethod(sendOSC_class, (t_method)sendOSC_openbundle, + gensym("["), + 0, 0); + class_addmethod(sendOSC_class, (t_method)sendOSC_closebundle, + gensym("]"), + 0, 0); + class_sethelpsymbol(sendOSC_class, gensym("sendOSC-help.pd")); + error("[sendOSC]: OSCx is deprecated! \n\tConsider switching to mrpeach's [packOSC] and [udpsend]"); +} + +/* Exit status codes: + 0: successful + 2: Message(s) dropped because of buffer overflow + 3: Socket error + 4: Usage error + 5: Internal error +*/ + + +typedArg ParseAtom(t_atom *a) +{ + typedArg returnVal; + t_float f; + t_int i; + t_symbol s; + char buf[MAXPDSTRING]; + + atom_string(a, buf, MAXPDSTRING); +#ifdef DEBUG + post("sendOSC: atom type %d (%s)", a->a_type, buf); +#endif + /* It might be an int, a float, or a string */ + switch (a->a_type) + { + + case A_FLOAT: + f = atom_getfloat(a); + i = atom_getint(a); + if (f == (t_float)i) + { // assume that if the int and float are the same, it's an int + returnVal.type = INT_osc; + returnVal.datum.i = i; + } + else + { + returnVal.type = FLOAT_osc; + returnVal.datum.f = f; + } + return returnVal; + case A_SYMBOL: + s = *atom_getsymbol(a); + returnVal.type = STRING_osc; + returnVal.datum.s = s.s_name; + return returnVal; + default: + atom_string(a, buf, MAXPDSTRING); + error("sendOSC: atom type %d not implemented (%s)", a->a_type, buf); + returnVal.type = NOTYPE_osc; + returnVal.datum.s = NULL; + return returnVal; +} +} + +int WriteMessage(OSCbuf *buf, char *messageName, int numArgs, typedArg *args) +{ + int j, returnVal; + + returnVal = 0; + +#ifdef DEBUG + printf("WriteMessage: %s ", messageName); + + for (j = 0; j < numArgs; j++) + { + switch (args[j].type) + { + case INT_osc: + printf("%d ", args[j].datum.i); + break; + + case FLOAT_osc: + printf("%f ", args[j].datum.f); + break; + + case STRING_osc: + printf("%s ", args[j].datum.s); + break; + + default: + error("Unrecognized arg type %d", args[j].type); + break; + } + } + printf("\n"); +#endif + + if (!useTypeTags) + { + returnVal = OSC_writeAddress(buf, messageName); + if (returnVal) + { + error("Problem writing address: %s\n", OSC_errorMessage); + } + } + else + { + /* First figure out the type tags */ + char typeTags[MAX_ARGS+2]; + + typeTags[0] = ','; + + for (j = 0; j < numArgs; ++j) + { + switch (args[j].type) + { + case INT_osc: + typeTags[j+1] = 'i'; + break; + + case FLOAT_osc: + typeTags[j+1] = 'f'; + break; + + case STRING_osc: + typeTags[j+1] = 's'; + break; + + default: + error("sendOSC: arg %d type is unrecognized(%d)", j, args[j].type); + break; + } + } + typeTags[j+1] = '\0'; + + returnVal = OSC_writeAddressAndTypes(buf, messageName, typeTags); + if (returnVal) + { + error("Problem writing address: %s\n", OSC_errorMessage); + } + } + + for (j = 0; j < numArgs; j++) + { + switch (args[j].type) + { + case INT_osc: + if ((returnVal = OSC_writeIntArg(buf, args[j].datum.i)) != 0) + { + return returnVal; + } + break; + + case FLOAT_osc: + if ((returnVal = OSC_writeFloatArg(buf, args[j].datum.f)) != 0) + { + return returnVal; + } + break; + + case STRING_osc: + if ((returnVal = OSC_writeStringArg(buf, args[j].datum.s)) != 0) + { + return returnVal; + } + break; + + default: + break; // just skip bad types (which we won't get anyway unless this code is buggy) + } + } + return returnVal; +} + +void SendBuffer(void *htmsocket, OSCbuf *buf) +{ +#ifdef DEBUG + printf("Sending buffer...\n"); +#endif + if (OSC_isBufferEmpty(buf)) + { + post("SendBuffer() called but buffer empty"); + return; + } + if (!OSC_isBufferDone(buf)) + { + fatal_error("SendBuffer() called but buffer not ready!, not exiting"); + return; //{{raf}} + } + SendData(htmsocket, OSC_packetSize(buf), OSC_getPacket(buf)); +} + +void SendData(void *htmsocket, int size, char *data) +{ + if (!SendHTMSocket(htmsocket, size, data)) + { + post("SendData::SendHTMSocket()failure -- not connected"); + CloseHTMSocket(htmsocket); +} +} + diff --git a/src/INVENTORY.txt b/src/INVENTORY.txt deleted file mode 100644 index 98f3698..0000000 --- a/src/INVENTORY.txt +++ /dev/null @@ -1,21 +0,0 @@ -OSC protocol inventory for OSC4PD - -sendOSC, dumpOSC, OSCroute -========================== - INCLUDES - * typed and untyped packing of OSC messages - * #bundle packing - * transmission of OSC messages via UDP socket - - * receive OSC messages on UDP socket - * unpacking of typed and untyped OSC messages - * #bundle unpacking - - * static address resolution - * pattern matching - - OMITS - * working with timetags - * all advanced protocol features of documentation, typesigs, etc - * connection oriented communication - diff --git a/src/Makefile.in b/src/Makefile.in deleted file mode 100644 index 41032de..0000000 --- a/src/Makefile.in +++ /dev/null @@ -1,65 +0,0 @@ -# -# Copyright (C) 2004 Hans-Christoph Steiner -# -# 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. - - -EXT=o -LIBS = @LIBS@ -LIBOSC = ../libOSC/@LIBOSC@ - -CFLAGS = @CFLAGS@ -INCLUDES = @INCLUDES@ -LDFLAGS = @LDFLAGS@ - -prefix=@prefix@ - -SOURCES = OSC-pattern-match.c OSC.c dumpOSC.c htmsocket.c OSCroute.c sendOSC.c OSC-system-dependent.c -TARGETS = $(SOURCES:.c=.o) -EXTS=sendOSC.@pd_suffix@ dumpOSC.@pd_suffix@ OSCroute.@pd_suffix@ - -# ----------------------- autoconf ----------------------- - -all: $(EXTS) - -lib: OSC.@pd_suffix@ - -dumpOSC.@pd_suffix@: dumpOSC.o - $(CC) $(LDFLAGS) -o dumpOSC.@pd_suffix@ $? $(LIBS) - -sendOSC.@pd_suffix@: sendOSC.o htmsocket.o OSC-system-dependent.o - $(CC) $(LDFLAGS) -o sendOSC.@pd_suffix@ $? $(LIBS) $(LIBOSC) - -OSCroute.@pd_suffix@: OSCroute.o OSC-pattern-match.o OSC-system-dependent.o - $(CC) $(LDFLAGS) -o OSCroute.@pd_suffix@ $? $(LIBS) - -OSC.@pd_suffix@: OSC.o sendOSC.o dumpOSC.o OSCroute.o htmsocket.o OSC-pattern-match.o OSC-system-dependent.o - $(CC) $(LDFLAGS) -o OSC.@pd_suffix@ $? $(LIBS) $(LIBOSC) - -$(TARGETS): %.o : %.c - $(CC) $(CFLAGS) $(INCLUDES) -c -o $*.o $*.c - -# ---------------------------------------------------------- - -install-doc: - @test -d $(prefix)/lib/pd/doc/5.reference || mkdir -p $(prefix)/lib/pd/doc/5.reference - cp -r ../doc/* $(prefix)/lib/pd/doc/5.reference/ - -install: install-doc - @test -d $(prefix)/lib/pd/extra || mkdir -p $(prefix)/lib/pd/extra - install -m644 *.@pd_suffix@ $(prefix)/lib/pd/extra - -clean: - rm -rf *.$(EXT) *.@pd_suffix@ diff --git a/src/OSC-common.h b/src/OSC-common.h deleted file mode 100644 index abea838..0000000 --- a/src/OSC-common.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -Copyright © 1998. The Regents of the University of California (Regents). -All Rights Reserved. - -Written by Matt Wright, The Center for New Music and Audio Technologies, -University of California, Berkeley. - -Permission to use, copy, modify, distribute, and distribute modified versions -of this software and its documentation without fee and without a signed -licensing agreement, is hereby granted, provided that the above copyright -notice, this paragraph and the following two paragraphs appear in all copies, -modifications, and distributions. - -IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING -OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED -HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE -MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - -The OpenSound Control WWW page is - http://www.cnmat.berkeley.edu/OpenSoundControl -*/ - - - -/* OSC-common.h - Simple stuff to #include everywhere in the OSC package - - by Matt Wright, 3/13/98 -*/ - -#ifndef _OSC_COMMON_H -#define _OSC_COMMON_H - -/* Boolean type */ - -#ifndef TRUE -typedef int Boolean; -#define TRUE 1 -#define FALSE 0 -#endif - - -#ifdef _WIN32 - #include - #ifdef _DEBUG - #define DEBUG - #endif -#endif /* _WIN32 */ - -/* only needed on Microsoft compilers */ -#ifdef _MSC_VER - #ifdef OSC_EXPORTS - #define OSC_API __declspec(dllexport) - #else - #define OSC_API __declspec(dllimport) - #endif -#endif /* _MSC_VER */ - -//#define int32_t t_int - -/* Fixed byte width types */ -typedef int int4; /* 4 byte int */ - -/* Printing type procedures. All take printf-style format string */ - -/* Catastrophic failure: print message and halt system */ -void fatal_error(char *s, ...); - -/* Error message for user */ -void OSCProblem(char *s, ...); - -/* Warning for user */ -void OSCWarning(char *s, ...); - - - -#endif /* _OSC_COMMON_H */ - diff --git a/src/OSC-pattern-match.c b/src/OSC-pattern-match.c deleted file mode 100644 index 847ebb3..0000000 --- a/src/OSC-pattern-match.c +++ /dev/null @@ -1,192 +0,0 @@ -/* -Copyright © 1998. The Regents of the University of California (Regents). -All Rights Reserved. - -Written by Matt Wright, The Center for New Music and Audio Technologies, -University of California, Berkeley. - -Permission to use, copy, modify, distribute, and distribute modified versions -of this software and its documentation without fee and without a signed -licensing agreement, is hereby granted, provided that the above copyright -notice, this paragraph and the following two paragraphs appear in all copies, -modifications, and distributions. - -IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING -OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED -HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE -MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - -The OpenSound Control WWW page is - http://www.cnmat.berkeley.edu/OpenSoundControl -*/ - - - -/* - OSC-pattern-match.c - Matt Wright, 3/16/98 - Adapted from oscpattern.c, by Matt Wright and Amar Chaudhury - */ - -#include "OSC-common.h" -#include "OSC-pattern-match.h" - -static const char *theWholePattern; /* Just for warning messages */ - -static Boolean MatchBrackets (const char *pattern, const char *test); -static Boolean MatchList (const char *pattern, const char *test); - -Boolean PatternMatch (const char * pattern, const char * test) { - theWholePattern = pattern; - - if (pattern == 0 || pattern[0] == 0) { - return test[0] == 0; - } - - if (test[0] == 0) { - if (pattern[0] == '*') - return PatternMatch (pattern+1,test); - else - return FALSE; - } - - switch (pattern[0]) { - case 0 : return test[0] == 0; - case '?' : return PatternMatch (pattern + 1, test + 1); - case '*' : - if (PatternMatch (pattern+1, test)) { - return TRUE; - } else { - return PatternMatch (pattern, test+1); - } - case ']' : - case '}' : - OSCWarning("Spurious %c in pattern \".../%s/...\"",pattern[0], theWholePattern); - return FALSE; - case '[' : - return MatchBrackets (pattern,test); - case '{' : - return MatchList (pattern,test); - case '\\' : - if (pattern[1] == 0) { - return test[0] == 0; - } else if (pattern[1] == test[0]) { - return PatternMatch (pattern+2,test+1); - } else { - return FALSE; - } - default : - if (pattern[0] == test[0]) { - return PatternMatch (pattern+1,test+1); - } else { - return FALSE; - } - } -} - - -/* we know that pattern[0] == '[' and test[0] != 0 */ - -static Boolean MatchBrackets (const char *pattern, const char *test) { - Boolean result; - Boolean negated = FALSE; - const char *p = pattern; - - if (pattern[1] == 0) { - OSCWarning("Unterminated [ in pattern \".../%s/...\"", theWholePattern); - return FALSE; - } - - if (pattern[1] == '!') { - negated = TRUE; - p++; - } - - while (*p != ']') { - if (*p == 0) { - OSCWarning("Unterminated [ in pattern \".../%s/...\"", theWholePattern); - return FALSE; - } - if (p[1] == '-' && p[2] != 0) { - if (test[0] >= p[0] && test[0] <= p[2]) { - result = !negated; - goto advance; - } - } - if (p[0] == test[0]) { - result = !negated; - goto advance; - } - p++; - } - - result = negated; - -advance: - - if (!result) - return FALSE; - - while (*p != ']') { - if (*p == 0) { - OSCWarning("Unterminated [ in pattern \".../%s/...\"", theWholePattern); - return FALSE; - } - p++; - } - - return PatternMatch (p+1,test+1); -} - -static Boolean MatchList (const char *pattern, const char *test) { - - const char *restOfPattern, *tp = test; - - - for(restOfPattern = pattern; *restOfPattern != '}'; restOfPattern++) { - if (*restOfPattern == 0) { - OSCWarning("Unterminated { in pattern \".../%s/...\"", theWholePattern); - return FALSE; - } - } - - restOfPattern++; /* skip close curly brace */ - - - pattern++; /* skip open curly brace */ - - while (1) { - - if (*pattern == ',') { - if (PatternMatch (restOfPattern, tp)) { - return TRUE; - } else { - tp = test; - ++pattern; - } - } else if (*pattern == '}') { - return PatternMatch (restOfPattern, tp); - } else if (*pattern == *tp) { - ++pattern; - ++tp; - } else { - tp = test; - while (*pattern != ',' && *pattern != '}') { - pattern++; - } - if (*pattern == ',') { - pattern++; - } - } - } - -} - - - diff --git a/src/OSC-pattern-match.h b/src/OSC-pattern-match.h deleted file mode 100644 index 653b54d..0000000 --- a/src/OSC-pattern-match.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -Copyright © 1998. The Regents of the University of California (Regents). -All Rights Reserved. - -Written by Matt Wright, The Center for New Music and Audio Technologies, -University of California, Berkeley. - -Permission to use, copy, modify, distribute, and distribute modified versions -of this software and its documentation without fee and without a signed -licensing agreement, is hereby granted, provided that the above copyright -notice, this paragraph and the following two paragraphs appear in all copies, -modifications, and distributions. - -IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING -OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED -HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE -MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - -The OpenSound Control WWW page is - http://www.cnmat.berkeley.edu/OpenSoundControl -*/ - - -/* - OSC-pattern-match.h -*/ - -Boolean PatternMatch (const char *pattern, const char *test); - diff --git a/src/OSC-system-dependent.c b/src/OSC-system-dependent.c deleted file mode 100644 index d4f9c50..0000000 --- a/src/OSC-system-dependent.c +++ /dev/null @@ -1,82 +0,0 @@ -/* -Copyright © 1998. The Regents of the University of California (Regents). -All Rights Reserved. - -Written by Matt Wright, The Center for New Music and Audio Technologies, -University of California, Berkeley. - -Permission to use, copy, modify, distribute, and distribute modified versions -of this software and its documentation without fee and without a signed -licensing agreement, is hereby granted, provided that the above copyright -notice, this paragraph and the following two paragraphs appear in all copies, -modifications, and distributions. - -IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING -OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED -HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE -MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - -The OpenSound Control WWW page is - http://www.cnmat.berkeley.edu/OpenSoundControl -*/ - - - -/* OSC-system-dependent.c - - Matt Wright, 3/13/98 - - File of procedures OSC has to call that are not part of the OSC package - and that you, the developer adding OSC addressability to an application, - must write in a way that makes sense in the context of your system. - - You should also look at OSC-timetag.c and see if there's a better way - to handle time tags on your system. - -*/ - -#include "OSC-common.h" - -/* Printing stuff: for now, use stderr. Some cleverer stuff we could do: - - - Make a silent mode where these don't do anything. - - Return error messages via OSC to some client -*/ - -#include -#include -#include - -void fatal_error(char *s, ...) { - va_list ap; - fprintf(stderr, "Fatal error: "); - va_start(ap, s); - vfprintf(stderr, s, ap); - fprintf(stderr, "\n"); - va_end(ap); - exit(-321); -} - -void OSCProblem(char *s, ...) { - va_list ap; - fprintf(stderr, "OSC Problem: "); - va_start(ap, s); - vfprintf(stderr, s, ap); - fprintf(stderr, "\n"); - va_end(ap); -} - -void OSCWarning(char *s, ...) { - va_list ap; - fprintf(stderr, "OSC Warning: "); - va_start(ap, s); - vfprintf(stderr, s, ap); - fprintf(stderr, "\n"); - va_end(ap); -} diff --git a/src/OSC.001 b/src/OSC.001 deleted file mode 100644 index b9dd0d4..0000000 --- a/src/OSC.001 +++ /dev/null @@ -1,147 +0,0 @@ -# Microsoft Developer Studio Project File - Name="OSC" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=OSC - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "OSC.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "OSC.mak" CFG="OSC - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "OSC - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "OSC - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "OSC - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RAFOSC_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../../pd/src" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OSC_EXPORTS" /D "NT" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 pd.lib libc.lib kernel32.lib wsock32.lib LIBOSC.lib /nologo /dll /machine:I386 /nodefaultlib /out:"../../../pd/extra/OSC.dll" /libpath:"../../../pd/lib" /libpath:"../../../pd/bin" -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "OSC - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /GX /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RAFOSC_EXPORTS" /YX /FD /ZI /GZ /c -# ADD CPP /nologo /MTd /W3 /GX /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OSC_EXPORTS" /D "NT" /YX /FD /ZI /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 pd.lib libc.lib kernel32.lib wsock32.lib LIBOSC.lib /nologo /dll /debug /machine:I386 /nodefaultlib /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "OSC - Win32 Release" -# Name "OSC - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\dumpOSC.c -# End Source File -# Begin Source File - -SOURCE=.\htmsocket.c -# End Source File -# Begin Source File - -SOURCE=".\OSC-pattern-match.c" -# End Source File -# Begin Source File - -SOURCE=.\OSC.c -# End Source File -# Begin Source File - -SOURCE=.\routeOSC.c -# End Source File -# Begin Source File - -SOURCE=.\sendOSC.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\htmsocket.h -# End Source File -# Begin Source File - -SOURCE=".\OSC-client.h" -# End Source File -# Begin Source File - -SOURCE=".\OSC-common.h" -# End Source File -# Begin Source File - -SOURCE=".\OSC-pattern-match.h" -# End Source File -# Begin Source File - -SOURCE=".\OSC-timetag.h" -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/src/OSC.c b/src/OSC.c deleted file mode 100644 index 923c097..0000000 --- a/src/OSC.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - OpenSoundControl for PD - ------------- - -- init jdl at xdv dot org - -- tweaks for Win32 www.zeggz.com/raf 13-April-2002 - -- smoothed out build, clean up for Darwin 2004.04.04 - -- shoutz: miller and the others - -- Windows-ification by Piotr Majdak 30.08.2005 -*/ - -#if HAVE_CONFIG_H -#include -#endif - -#include -#include "OSC-common.h" - -#define VERSION "0.3" - -/* this is for when building with non-Microsoft compilers */ -#ifndef OSC_API -#define OSC_API -#endif - -typedef struct _OSC -{ - t_object x_obj; -} t_OSC; - - -OSC_API void OSC_setup(void); -OSC_API void OSC_version(t_OSC*); - -OSC_API void sendOSC_setup(void); -OSC_API void dumpOSC_setup(void); -OSC_API void OSCroute_setup(void); - - -static t_class* OSC_class; - - -static void* OSC_new(t_symbol* s) { - t_OSC *x = (t_OSC *)pd_new(OSC_class); - error("OSCx is deprecated! consider switching to mrpeach's osc & net objects"); - return (x); -} - - -OSC_API void OSC_version (t_OSC *x) { - - post("OSC4PD Version " VERSION "\n" - " Original code by matt wright. pd-fication jdl@xdv.org\n" - " Win32-port raf@interaccess.com unified versions hans@at.or.at\n" - " Adaptations for Windows: piotr@majdak.com\n" - " Compiled: "__DATE__); -} - -OSC_API void OSC_setup(void) { - OSC_class = class_new(gensym("OSC"), (t_newmethod)OSC_new, 0, - sizeof(t_OSC), 0,0); - class_addmethod(OSC_class, (t_method)OSC_version, gensym("version"), A_NULL, 0, 0); - - sendOSC_setup(); - dumpOSC_setup(); - OSCroute_setup(); - - post("O : Open Sound Control 4 PD, http://www.cnmat.berkeley.edu/OSC"); - post(" S : original code by matt wright, pd hakcs cxc, Win32-port raf@interaccess.com"); - post(" C: ver: "VERSION ", compiled: "__DATE__ " -- adapted by piotr@majdak.com"); - - error("OSCx is deprecated - ask IOhannes m zmoelnig why..."); -} diff --git a/src/OSC.dsp b/src/OSC.dsp deleted file mode 100644 index fc16ecd..0000000 --- a/src/OSC.dsp +++ /dev/null @@ -1,152 +0,0 @@ -# Microsoft Developer Studio Project File - Name="OSC" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=OSC - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "OSC.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "OSC.mak" CFG="OSC - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "OSC - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "OSC - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "OSC - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RAFOSC_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "c:\pd\src" /I "LIBOSC" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OSC_EXPORTS" /D "NT" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 c:\pd\bin\pd.lib libc.lib kernel32.lib wsock32.lib LIBOSC/Release/LIBOSC.lib /nologo /dll /machine:I386 /nodefaultlib /libpath:"../../../pd/lib" /libpath:"../../../pd/bin" -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "OSC - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RAFOSC_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "c:\pd\src" /I "LIBOSC" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OSC_EXPORTS" /D "NT" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 c:\pd\bin\pd.lib libc.lib kernel32.lib wsock32.lib LIBOSC/Release/LIBOSC.lib /nologo /dll /debug /machine:I386 /nodefaultlib /pdbtype:sept /libpath:"c:\pd\src" - -!ENDIF - -# Begin Target - -# Name "OSC - Win32 Release" -# Name "OSC - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\dumpOSC.c -# End Source File -# Begin Source File - -SOURCE=.\htmsocket.c -# End Source File -# Begin Source File - -SOURCE=".\OSC-pattern-match.c" -# End Source File -# Begin Source File - -SOURCE=".\OSC-system-dependent.c" -# End Source File -# Begin Source File - -SOURCE=.\OSC.c -# End Source File -# Begin Source File - -SOURCE=.\OSCroute.c -# End Source File -# Begin Source File - -SOURCE=.\sendOSC.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\htmsocket.h -# End Source File -# Begin Source File - -SOURCE=".\OSC-client.h" -# End Source File -# Begin Source File - -SOURCE=".\OSC-common.h" -# End Source File -# Begin Source File - -SOURCE=".\OSC-pattern-match.h" -# End Source File -# Begin Source File - -SOURCE=".\OSC-timetag.h" -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/src/OSC.dsw b/src/OSC.dsw deleted file mode 100644 index 293b7f7..0000000 --- a/src/OSC.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "OSC"=.\OSC.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/src/OSCroute.c b/src/OSCroute.c deleted file mode 100644 index c3afc89..0000000 --- a/src/OSCroute.c +++ /dev/null @@ -1,452 +0,0 @@ -/* -Written by Adrian Freed, The Center for New Music and Audio Technologies, -University of California, Berkeley. Copyright (c) 1992,93,94,95,96,97,98,99,2000,01,02,03,04 -The Regents of the University of California (Regents). - -Permission to use, copy, modify, distribute, and distribute modified versions -of this software and its documentation without fee and without a signed -licensing agreement, is hereby granted, provided that the above copyright -notice, this paragraph and the following two paragraphs appear in all copies, -modifications, and distributions. - -IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING -OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED -HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE -MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - - -The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl -*/ - - /* OSC-route.c - Max object for OSC-style dispatching - - To-do: - - Match a pattern against a pattern? - [Done: Only Slash-Star is allowed, see MyPatternMatch.] - Declare outlet types / distinguish leaf nodes from other children - More sophisticated (2-pass?) allmessages scheme - set message? - - - pd - ------------- - -- tweaks for Win32 www.zeggz.com/raf 13-April-2002 - - - */ - -#if HAVE_CONFIG_H -#include -#endif - - -/* the required include files */ -#include "m_pd.h" -#include "OSC-common.h" -#include "OSC-pattern-match.h" - -#include -#ifdef _WIN32 - #include - #include -#endif - -/* structure definition of your object */ -#define MAX_NUM 128 -#define OSC_ROUTE_VERSION "1.05" -/* Version 1.04: Allows #1 thru #9 as typed-in arguments - Version 1.05: Allows "list" messages as well as "message" messages. -*/ - -static Boolean MyPatternMatch (const char *pattern, const char *test) -{ - // This allows the special case of "OSCroute /* " to be an outlet that - // matches anything; i.e., it always outputs the input with the first level - // of the address stripped off. - - if (test[0] == '*' && test[1] == '\0') { - return 1; - } else { - return PatternMatch(pattern, test); - } -} - - -static t_class *OSCroute_class; - -typedef struct _OSCroute -{ - t_object x_obj; // required header - t_int x_num; // Number of address prefixes we store - t_int x_complainmode; // Do we print a message if no match? - t_int x_sendmode; // use pd internal sends instead of outlets - char *x_prefixes[MAX_NUM]; - void *x_outlets[MAX_NUM+1]; -} t_OSCroute; - -t_symbol *ps_list, *ps_complain, *ps_emptySymbol; - -/* prototypes */ - -void OSCroute_doanything(t_OSCroute *x, t_symbol *s, int argc, t_atom *argv); -void OSCroute_anything(t_OSCroute *x, t_symbol *s, int argc, t_atom *argv); -void OSCroute_list(t_OSCroute *x, t_symbol *s, int argc, t_atom *argv); -/* //void *OSCroute_new(t_symbol *s, int argc, atom *argv); */ -void *OSCroute_new(t_symbol *s, int argc, t_atom *argv); -void OSCroute_version (t_OSCroute *x); -/* void OSCroute_assist (OSCroute *x, void *box, long msg, long arg, */ -/* char *dstString); */ -void OSCroute_allmessages(t_OSCroute *x, t_symbol *s, int argc, t_atom *argv); -#ifdef _MSC_VER -OSC_API void OSCroute_setup(void); -#else -void OSCroute_setup(void); -#endif /* _MSC_VER */ - -static char *NextSlashOrNull(char *p); -static void StrCopyUntilSlash(char *target, const char *source); - - -// free -static void OSCroute_free(t_OSCroute *x) -{ - // freebytes(x->x_vec, x->x_nelement * sizeof(*x->x_vec)); -} - -/* initialization routine */ - -// setup -#ifdef _MSC_VER - OSC_API void OSCroute_setup(void) { -#else -void OSCroute_setup(void) { -#endif - OSCroute_class = class_new(gensym("OSCroute"), (t_newmethod)OSCroute_new, - (t_method)OSCroute_free,sizeof(t_OSCroute), 0, A_GIMME, 0); - class_addlist(OSCroute_class, OSCroute_list); - class_addanything(OSCroute_class, OSCroute_anything); - class_addmethod(OSCroute_class, (t_method)OSCroute_version, gensym("version"), A_NULL, 0, 0); - class_sethelpsymbol(OSCroute_class, gensym("OSCroute-help.pd")); - - /* - class_addmethod(OSCroute_class, (t_method)OSCroute_connect, - gensym("connect"), A_SYMBOL, A_FLOAT, 0); - class_addmethod(OSCroute_class, (t_method)OSCroute_disconnect, - gensym("disconnect"), 0); - class_addmethod(OSCroute_class, (t_method)OSCroute_send, gensym("send"), - A_GIMME, 0); - */ -/* ps_list = gensym("list"); */ -/* ps_complain = gensym("complain"); */ - ps_emptySymbol = gensym(""); - - post("OSCroute object version " OSC_ROUTE_VERSION " by Matt Wright. pd: jdl Win32 raf."); - post("OSCroute Copyright © 1999 Regents of the Univ. of California. All Rights Reserved."); - error("[OSCroute]: OSCx is deprecated! \n\tConsider switching to mrpeach's [routeOSC]"); -} - - - -/* instance creation routine */ - -void *OSCroute_new(t_symbol *s, int argc, t_atom *argv) -{ - - t_OSCroute *x = (t_OSCroute *)pd_new(OSCroute_class); // get memory for a new object & initialize - - int i; //{{raf}} n not used - - // EnterCallback(); - - if (argc > MAX_NUM) { - post("* OSC-route: too many arguments: %ld (max %ld)", argc, MAX_NUM); - // ExitCallback(); - return 0; - } - - x->x_complainmode = 0; - x->x_num = 0; - for (i = 0; i < argc; ++i) { - if (argv[i].a_type == A_SYMBOL) { - if (argv[i].a_w.w_symbol->s_name[0] == '/') { - /* Now that's a nice prefix */ - x->x_prefixes[i] = argv[i].a_w.w_symbol->s_name; - ++(x->x_num); - } else if (argv[i].a_w.w_symbol->s_name[0] == '#' && - argv[i].a_w.w_symbol->s_name[1] >= '1' && - argv[i].a_w.w_symbol->s_name[1] <= '9') { - /* The Max programmer is trying to make a patch that will be - a subpatch with arguments. We have to make an outlet for this - argument. */ - x->x_prefixes[i] = "dummy"; - ++(x->x_num); - } else { - /* Maybe this is an option we support */ - -/* if (argv[i].a_w.w_sym == ps_complain) { */ -/* x->x_complainmode = 1; */ -/* } else { */ -/* post("* OSC-route: Unrecognized argument %s", argv[i].a_w.w_sym->s_name); */ -/* } */ - - } - - // no LONG - -/* } else if (argv[i].a_type == A_FLOAD) { */ -/* // Convert to a numeral. Max ints are -2147483648 to 2147483647 */ -/* char *string = getbytes(12); */ -/* // I can't be bothered to plug this 12 byte memory leak */ -/* if (string == 0) { */ -/* post("* OSC-route: out of memory!"); */ -/* // ExitCallback(); */ -/* return 0; */ -/* } */ -/* sprintf(string, "%d", argv[i].a_w.w_long); */ -/* x->x_prefixes[i] = string; */ -/* ++(x->x_num); */ - - } else if (argv[i].a_type == A_FLOAT) { - post("* OSC-route: float arguments are not OK."); - // ExitCallback(); - return 0; - } else { - post("* OSC-route: unrecognized argument type!"); - // ExitCallback(); - return 0; - } - } - - - /* Have to create the outlets in reverse order */ - /* well, not in pd ? */ - // for (i = x->x_num-1; i >= 0; --i) { - // for (i = 0; i <= x->x_num-1; i++) { - for (i = 0; i <= x->x_num; i++) { - // x->x_outlets[i] = listout(x); - x->x_outlets[i] = outlet_new(&x->x_obj, &s_list); - } - - // ExitCallback(); - return (x); -} - - -void OSCroute_version (t_OSCroute *x) { - // EnterCallback(); - post("OSCroute Version " OSC_ROUTE_VERSION - ", by Matt Wright. pd jdl, win32: raf.\nOSCroute Compiled " __TIME__ " " __DATE__); - // ExitCallback(); -} - -/* I don't know why these aren't defined in some Max #include file. */ -#define ASSIST_INLET 1 -#define ASSIST_OUTLET 2 - -void OSCroute_assist (t_OSCroute *x, void *box, long msg, long arg, - char *dstString) { - // EnterCallback(); - - if (msg==ASSIST_INLET) { - sprintf(dstString, "Incoming OSC messages"); - } else if (msg==ASSIST_OUTLET) { - if (arg < 0 || arg >= x->x_num) { - post("* OSCroute_assist: No outlet corresponds to arg %ld!", arg); - } else { - sprintf(dstString, "subaddress + args for prefix %s", x->x_prefixes[arg]); - } - } else { - post("* OSCroute_assist: unrecognized message %ld", msg); - } - - // ExitCallback(); -} - -void OSCroute_list(t_OSCroute *x, t_symbol *s, int argc, t_atom *argv) { - // EnterCallback(); - if (argc > 0 && argv[0].a_type == A_SYMBOL) { - /* Ignore the fact that this is a "list" */ - OSCroute_doanything(x, argv[0].a_w.w_symbol, argc-1, argv+1); - } else if (argc > 0) { - // post("* OSC-route: invalid list beginning with a number"); - // output on unmatched outlet jdl 20020908 - if (argv[0].a_type == A_FLOAT) { - outlet_float(x->x_outlets[x->x_num], argv[0].a_w.w_float); - } else { - post("* OSC-route: unrecognized atom type!"); - } - } - else { - // output a bang on the rejected outlet if no arguments - outlet_bang(x->x_outlets[x->x_num]); - } - // ExitCallback(); -} - - -void OSCroute_anything(t_OSCroute *x, t_symbol *s, int argc, t_atom *argv) { - // EnterCallback(); - OSCroute_doanything(x, s, argc, argv); - // ExitCallback(); -} - - - - -void OSCroute_doanything(t_OSCroute *x, t_symbol *s, int argc, t_atom *argv) { - char *pattern, *nextSlash; - int i; - int matchedAnything; - // post("*** OSCroute_anything(s %s, argc %ld)", s->s_name, (long) argc); - - pattern = s->s_name; - if (pattern[0] != '/') { - post("* OSC-route: invalid message pattern %s does not begin with /", s->s_name); - outlet_anything(x->x_outlets[x->x_num], s, argc, argv); - return; - } - - matchedAnything = 0; - - nextSlash = NextSlashOrNull(pattern+1); - if (*nextSlash == '\0') { - /* last level of the address, so we'll output the argument list */ - - -#ifdef NULL_IS_DIFFERENT_FROM_BANG - if (argc==0) { - post("* OSC-route: why are you matching one level pattern %s with no args?", - pattern); - return; - } -#endif - - for (i = 0; i < x->x_num; ++i) { - if (MyPatternMatch(pattern+1, x->x_prefixes[i]+1)) { - ++matchedAnything; - - // I hate stupid Max lists with a special first element - if (argc == 0) { - outlet_bang(x->x_outlets[i]); - } else if (argv[0].a_type == A_SYMBOL) { - // Promote the symbol that was argv[0] to the special symbol - outlet_anything(x->x_outlets[i], argv[0].a_w.w_symbol, argc-1, argv+1); - } else if (argc > 1) { - // Multiple arguments starting with a number, so naturally we have - // to use a special function to output this "list", since it's what - // Max originally meant by "list". - outlet_list(x->x_outlets[i], 0L, argc, argv); - } else { - // There was only one argument, and it was a number, so we output it - // not as a list -/* if (argv[0].a_type == A_LONG) { */ - -/* outlet_int(x->x_outlets[i], argv[0].a_w.w_long); */ - // } else - if (argv[0].a_type == A_FLOAT) { - - outlet_float(x->x_outlets[i], argv[0].a_w.w_float); - } else { - post("* OSC-route: unrecognized atom type!"); - } - } - } - } - } else { - /* There's more address after this part, so our output list will begin with - the next slash. */ - t_symbol *restOfPattern = 0; /* avoid the gensym unless we have to output */ - char patternBegin[1000]; - - - /* Get the first level of the incoming pattern to match against all our prefixes */ - StrCopyUntilSlash(patternBegin, pattern+1); - - for (i = 0; i < x->x_num; ++i) { - if (MyPatternMatch(patternBegin, x->x_prefixes[i]+1)) { - ++matchedAnything; - if (restOfPattern == 0) { - restOfPattern = gensym(nextSlash); - } - outlet_anything(x->x_outlets[i], restOfPattern, argc, argv); - } - } - } - - if (x->x_complainmode) { - if (!matchedAnything) { - post("* OSC-route: pattern %s did not match any prefixes", pattern); - } - } - - // output unmatched data on rightmost outlet a la normal 'route' object, jdl 20020908 - if (!matchedAnything) { - outlet_anything(x->x_outlets[x->x_num], s, argc, argv); - } - - -} - -static char *NextSlashOrNull(char *p) { - while (*p != '/' && *p != '\0') { - p++; - } - return p; -} - -static void StrCopyUntilSlash(char *target, const char *source) { - while (*source != '/' && *source != '\0') { - *target = *source; - ++target; - ++source; - } - *target = 0; -} - -static int MyStrCopy(char *target, const char *source) { - int i = 0; - while (*source != '\0') { - *target = *source; - ++target; - ++source; - ++i; - } - *target = 0; - return i; -} - - - -void OSCroute_allmessages(t_OSCroute *x, t_symbol *s, int argc, t_atom *argv) { - int i; - t_symbol *prefixSymbol = 0; - char prefixBuf[1000]; - char *endOfPrefix; - t_atom a[1]; - - if (argc >= 1 && argv[0].a_type == A_SYMBOL) { - prefixSymbol = argv[0].a_w.w_symbol; - endOfPrefix = prefixBuf + MyStrCopy(prefixBuf, - prefixSymbol->s_name); - } else { - prefixSymbol = ps_emptySymbol; - prefixBuf[0] = '\0'; - endOfPrefix = prefixBuf; - } - - - for (i = 0; i < x->x_num; ++i) { - post("OSC: %s%s", prefixSymbol->s_name, x->x_prefixes[i]); - MyStrCopy(endOfPrefix, x->x_prefixes[i]); - SETSYMBOL(a, gensym(prefixBuf)); - outlet_anything(x->x_outlets[i], s, 1, a); - } -} diff --git a/src/TODO.txt b/src/TODO.txt deleted file mode 100644 index 63c2d7b..0000000 --- a/src/TODO.txt +++ /dev/null @@ -1,27 +0,0 @@ - -for win32: port also the command line utilities (send, dump) - --pd object hierarchy extract and automatic address construction - a la [/hostname]/pd/patchname/subpatch/test ? - --dynamic space allocation for message buffers. - --configure proper (autoconf) - - -changelog: - -20020903: refixed MAXPDARG vs. MAX_ARGS bug causind sendOSC to crash - with msgs longer than 5 argmuents. ? - -20020305: -typetags in send and receive - sendOSC by default now send typetagged msgs - and dumOSC properly reads and outputs them. - -prior: - - -added OSCroute with source adapt from max object. - -fixed shared htmsock bug - -added sendtyped separately earlier and lost it again - - diff --git a/src/VERSION b/src/VERSION deleted file mode 100644 index be58634..0000000 --- a/src/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.3 diff --git a/src/dumpOSC.c b/src/dumpOSC.c deleted file mode 100644 index 8d7de18..0000000 --- a/src/dumpOSC.c +++ /dev/null @@ -1,1056 +0,0 @@ -/* -Written by Matt Wright and Adrian Freed, The Center for New Music and -Audio Technologies, University of California, Berkeley. Copyright (c) -1992,93,94,95,96,97,98,99,2000,01,02,03,04 The Regents of the University of -California (Regents). - -Permission to use, copy, modify, distribute, and distribute modified versions -of this software and its documentation without fee and without a signed -licensing agreement, is hereby granted, provided that the above copyright -notice, this paragraph and the following two paragraphs appear in all copies, -modifications, and distributions. - -IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING -OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED -HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE -MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - - -The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl -*/ - - - /* - - dumpOSC.c - server that displays OpenSoundControl messages sent to it - for debugging client udp and UNIX protocol - - by Matt Wright, 6/3/97 - modified from dumpSC.c, by Matt Wright and Adrian Freed - - version 0.2: Added "-silent" option a.k.a. "-quiet" - - version 0.3: Incorporated patches from Nicola Bernardini to make - things Linux-friendly. Also added ntohl() in the right places - to support little-endian architectures. - - - - compile: - cc -o dumpOSC dumpOSC.c - - to-do: - - More robustness in saying exactly what's wrong with ill-formed - messages. (If they don't make sense, show exactly what was - received.) - - Time-based features: print time-received for each packet - - Clean up to separate OSC parsing code from socket/select stuff - - pd: branched from http://www.cnmat.berkeley.edu/OpenSoundControl/src/dumpOSC/dumpOSC.c - ------------- - -- added pd functions - -- socket is made differently than original via pd mechanisms - -- tweaks for Win32 www.zeggz.com/raf 13-April-2002 - -- the OSX changes from cnmat didnt make it here yet but this compiles - on OSX anyway. - -*/ - -#if HAVE_CONFIG_H -#include -#endif - -#include "m_pd.h" -//#include "m_imp.h" -#include "s_stuff.h" - -/* declarations */ - -// typedef void (*t_fdpollfn)(void *ptr, int fd); -//void sys_addpollfn(int fd, t_fdpollfn fn, void *ptr); - - -#if defined(__sgi) || defined(__linux) || defined(_WIN32) || defined(__APPLE__) - -#ifdef _WIN32 - #ifdef _MSC_VER - #include "OSC-common.h" - #endif /* _MSC_VER */ - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -#else - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - //#include - - #ifdef NEED_SCHEDCTL_AND_LOCK - #include - #include - #endif -#endif /* _WIN32 */ - - -char *htm_error_string; -typedef int Boolean; -typedef void *OBJ; - -typedef struct ClientAddressStruct { - struct sockaddr_in cl_addr; - int clilen; - int sockfd; -} *ClientAddr; - - - -Boolean ShowBytes = FALSE; -Boolean Silent = FALSE; - -/* Declarations */ -#ifndef _WIN32 -static int unixinitudp(int chan); -#endif - -#ifdef _WIN32 - typedef unsigned __int64 osc_time_t; -#else - typedef unsigned long long osc_time_t; -#endif - - - -static int initudp(int chan); -static void closeudp(int sockfd); -Boolean ClientReply(int packetsize, void *packet, int socketfd, - void *clientaddresspointer, int clientaddressbufferlength); -void sgi_CleanExit(void); -Boolean sgi_HaveToQuit(void); -int RegisterPollingDevice(int fd, void (*callbackfunction)(int , void *), void *dummy); -static void catch_sigint(); -static int Synthmessage(char *m, int n, void *clientdesc, int clientdesclength, int fd) ; -char *DataAfterAlignedString(char *string, char *boundary) ; -Boolean IsNiceString(char *string, char *boundary) ; -void complain(char *s, ...); -osc_time_t ReadTime(const char* src); - -#define MAXMESG 32768 -static char mbuf[MAXMESG]; - -/* ----------------------------- dumpOSC ------------------------- */ - -#define MAXOUTAT 50 - -static t_class *dumpOSC_class; - -typedef struct _dumpOSC -{ - t_object x_obj; - t_outlet *x_msgout; - t_outlet *x_connectout; - t_atom x_outat[MAXOUTAT]; - int x_outatc; - t_binbuf *x_b; - int x_connectsocket; - int x_nconnections; - int x_udp; - struct sockaddr_in x_server; - int x_clilen; -} t_dumpOSC; - -void dumpOSC_ParsePacket(t_dumpOSC *x, char *buf, int n, ClientAddr returnAddr); -Boolean dumpOSC_SendReply(char *buf, int n, void *clientDesc, int clientDescLenght, int fd); -static void dumpOSC_Smessage(t_dumpOSC *x, char *address, void *v, int n, ClientAddr returnAddr); -static void dumpOSC_PrintTypeTaggedArgs(t_dumpOSC *x, void *v, int n); -static void dumpOSC_PrintHeuristicallyTypeGuessedArgs(t_dumpOSC *x, void *v, int n, int skipComma); - -static void dumpOSC_read(t_dumpOSC *x, int sockfd) { - int clilen = x->x_clilen; - int n; - struct ClientAddressStruct ras; - ClientAddr ra = &ras; - - //catchupflag= FALSE; - -/* if (ShowBytes) { */ -/* int i; */ -/* printf("%d byte message:\n", n); */ -/* for (i = 0; i < n; ++i) { */ -/* printf(" %x (%c)\t", m[i], m[i]); */ -/* if (i%4 == 3) printf("\n"); */ -/* } */ -/* printf("\n"); */ -/* } */ - - // return catchupflag; - //struct sockaddr_in x->x_server; - //while( (n = recvfrom(sockfd, mbuf, MAXMESG, 0, &cl_addr, &clilen)) >0) - // while(( - - #ifdef _WIN32 - if ((n = recvfrom(sockfd, mbuf, MAXMESG, 0, (SOCKADDR*)&x->x_server, &clilen)) >0) - #else - if ((n = recvfrom(sockfd, mbuf, MAXMESG, 0, (struct sockaddr *)&x->x_server, &clilen)) >0) - #endif - { - //int r; - ras.cl_addr = *((struct sockaddr_in *) &x->x_server); - ras.clilen = x->x_clilen; - ras.sockfd = x->x_connectsocket; - - #ifdef DEBUG - printf("dumpOSC_read: received UDP packet of length %d\n", n); - #endif - - //if(!dumpOSC_SendReply(mbuf, n, &x->x_server, clilen, sockfd)) - { - dumpOSC_ParsePacket(x, mbuf, n, ra); - } - //r = Synthmessage(mbuf, n, &x->x_server, clilen, sockfd); - //post ("%d", r); - //outlet_anything(x->x_msgout, at[msg].a_w.w_symbol, - // emsg-msg-1, at + msg + 1); - // outlet_list(x->x_msgout, 0, n, mbuf); - //if( sgi_HaveToQuit()) goto out; - //if(r>0) goto back; - //clilen = maxclilen; - } -} - -static void *dumpOSC_new(t_symbol *compatflag, - int argc, t_atom* argv) { - t_dumpOSC *x; - struct sockaddr_in server; - int clilen=sizeof(server); - int sockfd; - int portno=0; - int udp = 1; - t_symbol *castgroup=NULL; - - - if (argc == 1) { - if (argv[0].a_type==A_FLOAT) - portno = (int)argv[0].a_w.w_float; - else - return NULL; - } - - else if (argc == 2) { - if (argv[0].a_type==A_SYMBOL) - castgroup = argv[0].a_w.w_symbol; - else - return NULL; - - if (argv[1].a_type==A_FLOAT) - portno = (int)argv[1].a_w.w_float; - else - return NULL; - } - - else { - error("[dumpOSC] needs at least one argument (port number) to function"); - return NULL; - } - - - //x->x_b = binbuf_new(); - //x->x_outat = binbuf_getvec(x->x_b); - - //{{raf}} pointer not valid yet...moving this down - //x->x_outatc = 0; {{raf}} - - /* create a socket */ - if ((sockfd = socket(AF_INET, (udp ? SOCK_DGRAM : SOCK_STREAM), 0)) == -1) - { - sys_sockerror("socket"); - return (0); - } - - server.sin_family = AF_INET; - server.sin_addr.s_addr = INADDR_ANY; - /* assign server port number */ - server.sin_port = htons((u_short)portno); - - // ss 2006 - if (castgroup) { - struct ip_mreq mreq; - int t = 1; - mreq.imr_multiaddr.s_addr = inet_addr(castgroup->s_name); - mreq.imr_interface.s_addr = htonl(INADDR_ANY); - if (setsockopt(sockfd,SOL_SOCKET,SO_REUSEADDR,&t,sizeof(t)) < 0) { - sys_sockerror("setsockopt"); - } - if (setsockopt(sockfd,IPPROTO_IP,IP_ADD_MEMBERSHIP,(char*)&mreq,sizeof(mreq)) < 0) { - sys_sockerror("setsockopt"); - } - } - - /* name the socket */ - if (bind(sockfd, (struct sockaddr *)&server, sizeof(server)) < 0) - { - sys_sockerror("bind"); - sys_closesocket(sockfd); - return (0); - } - - x = (t_dumpOSC *)pd_new(dumpOSC_class); - x->x_outatc = 0; // {{raf}} now pointer is valid (less invalid) - - x->x_msgout = outlet_new(&x->x_obj, &s_anything); - - // if (udp) /* datagram protocol */ - { - - sys_addpollfn(sockfd, (t_fdpollfn)dumpOSC_read, x); - x->x_connectout = 0; - } - // else /* streaming protocol */ - /* { */ - /* if (listen(sockfd, 5) < 0) */ - /* { */ - /* sys_sockerror("listen"); */ - /* sys_closesocket(sockfd); */ - /* sockfd = -1; */ - /* } */ - /* else */ - /* { */ - /* sys_addpollfn(sockfd, (t_fdpollfn)dumpOSC_connectpoll, x); */ - /* x->x_connectout = outlet_new(&x->x_obj, &s_float); */ - /* } */ - /* } */ - - x->x_connectsocket = sockfd; - x->x_server = server; - x->x_clilen = clilen; - x->x_nconnections = 0; - x->x_udp = udp; - - return (x); -} - -static void dumpOSC_free(t_dumpOSC *x) -{ - /* LATER make me clean up open connections */ - if (x->x_connectsocket >= 0) - { - sys_rmpollfn(x->x_connectsocket); - sys_closesocket(x->x_connectsocket); - } -} - -#ifdef _MSC_VER -OSC_API void dumpOSC_setup(void) -#else -void dumpOSC_setup(void) -#endif -{ - dumpOSC_class = class_new(gensym("dumpOSC"), - (t_newmethod)dumpOSC_new, (t_method)dumpOSC_free, - sizeof(t_dumpOSC), CLASS_NOINLET, A_GIMME, 0); - class_sethelpsymbol(dumpOSC_class, gensym("dumpOSC-help.pd")); - - error("[dumpOSC]: OSCx is deprecated! \n\tConsider switching to mrpeach's [unpackOSC] and [udpreceive]"); -} - - -#ifndef _WIN32 - #define UNIXDG_PATH "/tmp/htm" - #define UNIXDG_TMP "/tmp/htm.XXXXXX" - static int unixinitudp(int chan) - { - struct sockaddr_un serv_addr; - int sockfd; - - if((sockfd = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0) - return sockfd; - - bzero((char *)&serv_addr, sizeof(serv_addr)); - serv_addr.sun_family = AF_UNIX; - strcpy(serv_addr.sun_path, UNIXDG_PATH); - sprintf(serv_addr.sun_path+strlen(serv_addr.sun_path), "%d", chan); - unlink(serv_addr.sun_path); - if(bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr.sun_family)+strlen(serv_addr.sun_path)) < 0) - { - perror("unable to bind\n"); - return -1; - } - - fcntl(sockfd, F_SETFL, FNDELAY); - return sockfd; - } -#endif // #ifndef _WIN32 - - - -static int initudp(int chan) -{ - -#ifdef _WIN32 - struct sockaddr_in serv_addr; - unsigned int sockfd; - ULONG nonBlocking = (ULONG) TRUE; - - if( (sockfd = socket(AF_INET, SOCK_DGRAM, 0)) != INVALID_SOCKET ) { - ZeroMemory((char *)&serv_addr, sizeof(serv_addr)); - serv_addr.sin_family = AF_INET; - serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); - serv_addr.sin_port = htons(chan); - if(bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) >= 0) { - // set for non-blocking mode - if(ioctlsocket(sockfd, FIONBIO, &nonBlocking) == SOCKET_ERROR) { - perror("unable to set non-blocking\n"); - return -1; - } - } - else { perror("unable to bind\n"); return -1; } - } - return (sockfd == INVALID_SOCKET ? -1 : (int)sockfd); -#else - struct sockaddr_in serv_addr; - int sockfd; - - if((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) - return sockfd; - - bzero((char *)&serv_addr, sizeof(serv_addr)); - serv_addr.sin_family = AF_INET; - serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); - serv_addr.sin_port = htons(chan); - - if(bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) - { - perror("unable to bind\n"); - return -1; - } - - fcntl(sockfd, F_SETFL, FNDELAY); - return sockfd; -#endif -} - -static void closeudp(int sockfd) { - #ifdef _WIN32 - closesocket(sockfd); - #else - close(sockfd); - #endif -} - -static Boolean catchupflag=FALSE; -Boolean ClientReply(int packetsize, void *packet, int socketfd, - void *clientaddresspointer, int clientaddressbufferlength) -{ - if(!clientaddresspointer) return FALSE; - catchupflag= TRUE; - return packetsize==sendto(socketfd, packet, packetsize, 0, clientaddresspointer, clientaddressbufferlength); -} - -static Boolean exitflag= FALSE; -void sgi_CleanExit(void) { - exitflag = TRUE; -} - -Boolean sgi_HaveToQuit(void) { - return exitflag; -} - - -/* file descriptor poll table */ -static int npolldevs =0; -typedef struct polldev -{ - int fd; - void (*callbackfunction)(int , void *); - void *dummy; -} polldev; -#define TABMAX 8 -static polldev polldevs[TABMAX]; - - -/* Register a device (referred to by a file descriptor that the caller - should have already successfully obtained from a system call) to be - polled as real-time constraints allowed. - - When a select(2) call indicates activity on the file descriptor, the - callback function is called with the file descripter as first - argument and the given dummy argument (presumably a pointer to the - instance variables associated with the device). -*/ -int RegisterPollingDevice(int fd, void (*callbackfunction)(int , void *), void *dummy) -{ - if(npolldevscl_addr.sin_addr.s_addr; - printf("Client address %p:\n", CA); - printf(" clilen %d, sockfd %d\n", CA->clilen, CA->sockfd); - printf(" sin_family %d, sin_port %d\n", CA->cl_addr.sin_family, - CA->cl_addr.sin_port); - printf(" address: (%lx) %s\n", addr, inet_ntoa(CA->cl_addr.sin_addr)); - - printf(" sin_zero = \"%c%c%c%c%c%c%c%c\"\n", - CA->cl_addr.sin_zero[0], - CA->cl_addr.sin_zero[1], - CA->cl_addr.sin_zero[2], - CA->cl_addr.sin_zero[3], - CA->cl_addr.sin_zero[4], - CA->cl_addr.sin_zero[5], - CA->cl_addr.sin_zero[6], - CA->cl_addr.sin_zero[7]); - - printf("\n"); -} - -//******************* - -/*void WriteTime(char* dst, osc_time_t osctime) -{ - *(int32_t*)dst = htonl((int32_t)(osctime >> 32)); - *(int32_t*)(dst+4) = htonl((int32_t)osctime); -} - -void WriteMode(char* dst) -{ - *(int32_t*)dst = htonl(0); -} - -osc_time_t ReadTime(const char* src) -{ - osc_time_t osctime = ntohl(*(int32_t*)src); - return (osctime << 32) + ntohl(*(int32_t*)(src+4)); -} - -double TimeToSeconds(osc_time_t osctime) -{ - return (double)osctime * 2.3283064365386962890625e-10 // 1/2^32 ; -// ^^^^^^^^^^^^^^^ isn't working on WIN32 (and on other machines: doesn't make sense!) -} - -int timeRound(double x) -{ - return x >= 0.0 ? x+0.5 : x-0.5; -} -*/ -/* -void WriteLogicalTime(char* dst) -{ - static double startTime = -1.0; - double sTime; - - // Initialisierung der Startzeit. - // Knnte effizienter (ohne 'if') auch irgendwo vorher passieren. - // Knnte wahrscheinlich auch 0.0 sein. - if (startTime < 0.0) { - startTime = clock_getlogicaltime(); - } - - sTime = clock_gettimesince(startTime) * 0.001; - *(int32_t*)dst = hton'K l((int32_t)sTime); - *(int32_t*)(dst+4) = htonl((int32_t)(4294967296.0 * sTime)); -} -*/ - -/*void WriteLogicalTime(char* dst) -{ - double sTime = clock_gettimesince(19230720) / 1000.0; - double tau = sTime - (double)timeRound(sTime); - - //fprintf(stderr, "sSec = %f tau = %f\n", sTime, tau); - - *(int32_t*)dst = htonl((int32_t)(sTime)); - *(int32_t*)(dst+4) = htonl((int32_t)(4294967296 * tau)); -} - -int dumpOSC_SendReply(char *buf, int n, void *clientDesc, int clientDescLenght, int fd) -{ - if((n == 24) && (strcmp(buf, "#time") == 0)) - { - osc_time_t t0, t1, t2; - double dt0, dt1, dt2; - - WriteMode(buf+6); - - t0 = ReadTime(buf+8); - - WriteLogicalTime(buf+16); - t1 = ReadTime(buf+16); // reverse - dt0 = TimeToSeconds(t0); // client time - dt1 = TimeToSeconds(t1); // server time - - // fprintf(stderr, "%f\t%f\t%f\n", dt0, dt1, dt0 - dt1); - - sendto(fd, buf, n, 0, (struct sockaddr *)clientDesc, clientDescLenght); - return TRUE; - } - else - { - return FALSE; - } -}*/ - -//********************** - -void dumpOSC_ParsePacket(t_dumpOSC *x, char *buf, int n, ClientAddr returnAddr) { - // t_dumpOSC *x; - int size, messageLen, i; - char *messageName; - char *args; - - //#ifdef PRINTADDRS - #ifdef DEBUG - //PrintClientAddr(returnAddr); - #endif - - - if ((n%4) != 0) { - complain("SynthControl packet size (%d) not a multiple of 4 bytes: dropping", n); - return; - } - - if ((n >= 8) && (strncmp(buf, "#bundle", 8) == 0)) { - /* This is a bundle message. */ - #ifdef DEBUG - printf("dumpOSC_ParsePacket: bundle msg: bundles not yet supported\n"); - #endif - - if (n < 16) { - complain("Bundle message too small (%d bytes) for time tag", n); - return; - } - - /* Print the time tag */ - #ifdef DEBUG - printf("[ %lx%08lx\n", ntohl(*((unsigned long *)(buf+8))), ntohl(*((unsigned long *)(buf+12)))); - #endif - - /* Note: if we wanted to actually use the time tag as a little-endian - 64-bit int, we'd have to word-swap the two 32-bit halves of it */ - - i = 16; /* Skip "#group\0" and time tag */ - - while(i n) { - complain("Bad size count %d in bundle (only %d bytes left in entire bundle)", - size, n-i-4); - return; - } - - /* Recursively handle element of bundle */ - dumpOSC_ParsePacket(x, buf+i+4, size, returnAddr); - i += 4 + size; - } - - if (i != n) { - complain("This can't happen"); - } - #ifdef DEBUG - printf("]\n"); - #endif - - } - else if ((n == 24) && (strcmp(buf, "#time") == 0)) - { - complain("Time message: %s\n :).\n", htm_error_string); - return; - - } - else - { - /* This is not a bundle message */ - - messageName = buf; - args = DataAfterAlignedString(messageName, buf+n); - if (args == 0) { - complain("Bad message name string: %s\nDropping entire message.\n", - htm_error_string); - return; - } - messageLen = args-messageName; - dumpOSC_Smessage(x, messageName, (void *)args, n-messageLen, returnAddr); - } -} - -#define SMALLEST_POSITIVE_FLOAT 0.000001f - -static void dumpOSC_Smessage(t_dumpOSC *x, char *address, void *v, int n, ClientAddr returnAddr) { - char *chars = v; - //t_atom at; - //t_atom myargv[50]; - - //int myargc = x->x_outatc; - //t_atom* mya = x->x_outat; - //int myi; - -#ifdef DEBUG - printf("%s ", address); -#endif - - // ztoln+cvt from envgen.c, ggee-0.18 .. - // outlet_anything's 'symbol' gets set to address - // so we dont need to append address to the atomlist - /* - SETSYMBOL(mya,gensym(address));myargc++; - x->x_outatc = myargc; - */ - - if (n != 0) { - if (chars[0] == ',') { - if (chars[1] != ',') { - /* This message begins with a type-tag string */ - dumpOSC_PrintTypeTaggedArgs(x, v, n); - } else { - /* Double comma means an escaped real comma, not a type string */ - dumpOSC_PrintHeuristicallyTypeGuessedArgs(x, v, n, 1); - } - } else { - dumpOSC_PrintHeuristicallyTypeGuessedArgs(x, v, n, 0); - } - } - - outlet_anything(x->x_msgout,gensym(address),x->x_outatc,(t_atom*)&x->x_outat); - x->x_outatc = 0; -#ifdef DEBUG - printf("\n"); -#endif - fflush(stdout); /* Added for Sami 5/21/98 */ -} - -static void dumpOSC_PrintTypeTaggedArgs(t_dumpOSC *x, void *v, int n) { - char *typeTags, *thisType; - char *p; - - int myargc = x->x_outatc; - t_atom* mya = x->x_outat; - //int myi; - - typeTags = v; - - if (!IsNiceString(typeTags, typeTags+n)) { - /* No null-termination, so maybe it wasn't a type tag - string after all */ - dumpOSC_PrintHeuristicallyTypeGuessedArgs(x, v, n, 0); - return; - } - - p = DataAfterAlignedString(typeTags, typeTags+n); - - - for (thisType = typeTags + 1; *thisType != 0; ++thisType) { - switch (*thisType) { - case 'i': case 'r': case 'm': case 'c': -#ifdef DEBUG - //post("integer: %d", ntohl(*((int *) p))); -#endif - /* Martin Peach fix for negative floats: - * was: SETFLOAT(mya+myargc,ntohl(*((int *) p))); - * now is: - */ - SETFLOAT(mya+myargc,(signed)ntohl(*((int *) p))); - myargc++; - - p += 4; - break; - - case 'f': { - int i = ntohl(*((int *) p)); - t_float *floatp = ((t_float *) (&i)); -#ifdef DEBUG - post("float: %f", *floatp); -#endif - SETFLOAT(mya+myargc,*floatp); - myargc++; - - p += 4; - } - break; - - case 'h': case 't': -#ifdef DEBUG - printf("[A 64-bit int] "); -#endif - post("[A 64-bit int] not implemented"); - - p += 8; - break; - - case 'd': -#ifdef DEBUG - printf("[A 64-bit float] "); -#endif - post("[A 64-bit float] not implemented"); - - p += 8; - break; - - case 's': case 'S': - if (!IsNiceString(p, typeTags+n)) { - post("Type tag said this arg is a string but it's not!\n"); - return; - } else { -#ifdef DEBUG - post("string: \"%s\"", p); -#endif - SETSYMBOL(mya+myargc,gensym(p)); - myargc++; - //outlet_list(x->x_msgout, 0,sizeof(p), p); - //outlet_anything(x->x_msgout, 0, sizeof(p), p); - p = DataAfterAlignedString(p, typeTags+n); - // append to output vector .. - } - break; - - case 'T': -#ifdef DEBUG - printf("[True] "); -#endif - SETFLOAT(mya+myargc,1.); - myargc++; - break; - case 'F': -#ifdef DEBUG - printf("[False] "); -#endif - SETFLOAT(mya+myargc,0.); - myargc++; - break; - case 'N': -#ifdef DEBUG - printf("[Nil]"); -#endif - post("sendOSC: [Nil] not implemented"); - break; - case 'I': -#ifdef DEBUG - printf("[Infinitum]"); -#endif - post("sendOSC: [Infinitum] not implemented"); - break; - - default: - post("sendOSC: [Unrecognized type tag %c]", *thisType); - // return; - } - } - x->x_outatc = myargc; -} - -static void dumpOSC_PrintHeuristicallyTypeGuessedArgs(t_dumpOSC *x, void *v, int n, int skipComma) { - int i, thisi; - t_float thisf; - int *ints; - char *chars; - char *string, *nextString; - - int myargc= x->x_outatc; - t_atom* mya = x->x_outat; - //int myi; - - union - { - float f; - int32_t i; - }u; - - /* Go through the arguments 32 bits at a time */ - ints = v; - chars = v; - - for (i = 0; i= -1000 && thisi <= 1000000) { -#ifdef DEBUG - printf("%d ", thisi); -#endif - // append to output vector .. - SETFLOAT(mya+myargc,(t_float) (thisi)); - myargc++; - // outlet_float(x->x_msgout, thisi); - i++; - } else if (thisf >= -1000.f && thisf <= 1000000.f && - (thisf <=0.0f || thisf >= SMALLEST_POSITIVE_FLOAT)) { -#ifdef DEBUG - printf("%f ", thisf); -#endif - // append to output vector .. - SETFLOAT(mya+myargc,thisf); - myargc++; - //outlet_float(x->x_msgout, thisf); - i++; - } else if (IsNiceString(string, chars+n)) { - nextString = DataAfterAlignedString(string, chars+n); -#ifdef DEBUG - printf("\"%s\" ", (i == 0 && skipComma) ? string +1 : string); -#endif - // append to output vector .. - SETSYMBOL(mya+myargc,gensym(string)); - myargc++; - //outlet_symbol(x->x_msgout, gensym((i == 0 && skipComma) ? string +1 : string)); - i += (nextString-string) / 4; - } else { - // unhandled .. ;) -#ifdef DEBUG - printf("0x%x xx", ints[i]); -#endif - i++; - } - x->x_outatc = myargc; - } -} - - -#define STRING_ALIGN_PAD 4 - -char *DataAfterAlignedString(char *string, char *boundary) -{ - /* The argument is a block of data beginning with a string. The - string has (presumably) been padded with extra null characters - so that the overall length is a multiple of STRING_ALIGN_PAD - bytes. Return a pointer to the next byte after the null - byte(s). The boundary argument points to the character after - the last valid character in the buffer---if the string hasn't - ended by there, something's wrong. - - If the data looks wrong, return 0, and set htm_error_string */ - - int i; - - if ((boundary - string) %4 != 0) { - fprintf(stderr, "Internal error: DataAfterAlignedString: bad boundary\n"); - return 0; - } - - for (i = 0; string[i] != '\0'; i++) { - if (string + i >= boundary) { - htm_error_string = "DataAfterAlignedString: Unreasonably long string"; - return 0; - } - } - - /* Now string[i] is the first null character */ - i++; - - for (; (i % STRING_ALIGN_PAD) != 0; i++) { - if (string + i >= boundary) { - htm_error_string = "DataAfterAlignedString: Unreasonably long string"; - return 0; - } - if (string[i] != '\0') { - htm_error_string = "DataAfterAlignedString: Incorrectly padded string."; - return 0; - } - } - - return string+i; -} - -Boolean IsNiceString(char *string, char *boundary) -{ - /* Arguments same as DataAfterAlignedString(). Is the given "string" - really a string? I.e., is it a sequence of isprint() characters - terminated with 1-4 null characters to align on a 4-byte boundary? */ - - int i; - - if ((boundary - string) %4 != 0) { - fprintf(stderr, "Internal error: IsNiceString: bad boundary\n"); - return 0; - } - - for (i = 0; string[i] != '\0'; i++) { - if (!isprint(string[i])) return FALSE; - if (string + i >= boundary) return FALSE; - } - - /* If we made it this far, it's a null-terminated sequence of printing characters - in the given boundary. Now we just make sure it's null padded... */ - - /* Now string[i] is the first null character */ - i++; - for (; (i % STRING_ALIGN_PAD) != 0; i++) { - if (string[i] != '\0') return FALSE; - } - - return TRUE; -} - - - - - - - - - -#include -void complain(char *s, ...) { - va_list ap; - va_start(ap, s); - fprintf(stderr, "*** ERROR: "); - vfprintf(stderr, s, ap); - fprintf(stderr, "\n"); - va_end(ap); -} - -#endif /* __sgi or LINUX or _WIN32 */ diff --git a/src/htmsocket.c b/src/htmsocket.c deleted file mode 100644 index 16a1050..0000000 --- a/src/htmsocket.c +++ /dev/null @@ -1,387 +0,0 @@ -/* -Written by Adrian Freed, The Center for New Music and Audio Technologies, -University of California, Berkeley. Copyright (c) 1992,93,94,95,96,97,98,99,2000,01,02,03,04 -The Regents of the University of California (Regents). - -Permission to use, copy, modify, distribute, and distribute modified versions -of this software and its documentation without fee and without a signed -licensing agreement, is hereby granted, provided that the above copyright -notice, this paragraph and the following two paragraphs appear in all copies, -modifications, and distributions. - -IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING -OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED -HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE -MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - - -The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl -*/ - - /* htmsocket.c - - Adrian Freed - send parameters to htm servers by udp or UNIX protocol - - Modified 6/6/96 by Matt Wright to understand symbolic host names - in addition to X.X.X.X addresses. - - pd: branched jdl - -- win additions raf 2002 - -- enabled broadcast jdl 2003 - */ - -#if HAVE_CONFIG_H -#include -#endif - -#ifdef __APPLE__ - #include -#endif - -#ifdef WIN32 - #include - #include - #include - #include - #include - #include - #include - #include "OSC-common.h" - #include - #include - #include -#else - #include - #include - #include - #include - #include - -// #include - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -// #include - - #include -#endif - -#define UNIXDG_PATH "/tmp/htm" -#define UNIXDG_TMP "/tmp/htm.XXXXXX" -#include "htmsocket.h" -typedef struct -{ - float srate; - - struct sockaddr_in serv_addr; /* udp socket */ - #ifndef WIN32 - struct sockaddr_un userv_addr; /* UNIX socket */ - #endif - int sockfd; /* socket file descriptor */ - int index, len,uservlen; - void *addr; - int id; -} desc; - -int IsAddressMulticast(unsigned long address) -{ - unsigned long adr = ntohl(address); - unsigned char A = (unsigned char)((adr & 0xFF000000) >> 24); - unsigned char B = (unsigned char)((adr & 0xFF0000) >> 16); - unsigned char C = (unsigned char)((adr & 0xFF00) >> 8); - - if (A==224 && B==0 && C==0) { - // This multicast group range is reserved for routing - // information and not meant to be used by applications. - return -1; - } - - // This is the multicast group IP range - if (A>=224 && A<=239) - return 1; - - return 0; -} - -/* open a socket for HTM communication to given host on given portnumber */ -/* if host is 0 then UNIX protocol is used (i.e. local communication */ -void *OpenHTMSocket(char *host, int portnumber, short *multicast_TTL) -{ - struct sockaddr_in cl_addr; - #ifndef WIN32 - int sockfd; - struct sockaddr_un ucl_addr; - #else - unsigned int sockfd; - #endif - - char oval = 1; - - desc *o; - o = malloc(sizeof(*o)); - if(!o) - return 0; - - #ifndef WIN32 - - if(!host) - { - char *mktemp(char *); - int clilen; - o->len = sizeof(ucl_addr); - /* - * Fill in the structure "userv_addr" with the address of the - * server that we want to send to. - */ - - bzero((char *) &o->userv_addr, sizeof(o->userv_addr)); - o->userv_addr.sun_family = AF_UNIX; - strcpy(o->userv_addr.sun_path, UNIXDG_PATH); - sprintf(o->userv_addr.sun_path+strlen(o->userv_addr.sun_path), "%d", portnumber); - o->uservlen = sizeof(o->userv_addr.sun_family) + strlen(o->userv_addr.sun_path); - o->addr = &(o->userv_addr); - /* - * Open a socket (a UNIX domain datagram socket). - */ - - if ( (sockfd = socket(AF_UNIX, SOCK_DGRAM, 0)) >= 0) - { - /* - * Bind a local address for us. - * In the UNIX domain we have to choose our own name (that - * should be unique). We'll use mktemp() to create a unique - * pathname, based on our process id. - */ - - bzero((char *) &ucl_addr, sizeof(ucl_addr)); /* zero out */ - ucl_addr.sun_family = AF_UNIX; - strcpy(ucl_addr.sun_path, UNIXDG_TMP); - - mktemp(ucl_addr.sun_path); - clilen = sizeof(ucl_addr.sun_family) + strlen(ucl_addr.sun_path); - - if (bind(sockfd, (struct sockaddr *) &ucl_addr, clilen) < 0) - { - perror("client: can't bind local address"); - close(sockfd); - sockfd = -1; - } - } - else - perror("unable to make socket\n"); - - }else - - #endif - - { - /* - * Fill in the structure "serv_addr" with the address of the - * server that we want to send to. - */ - o->len = sizeof(cl_addr); - - #ifdef WIN32 - ZeroMemory((char *)&o->serv_addr, sizeof(o->serv_addr)); - #else - bzero((char *)&o->serv_addr, sizeof(o->serv_addr)); - #endif - - o->serv_addr.sin_family = AF_INET; - - /* MW 6/6/96: Call gethostbyname() instead of inet_addr(), - so that host can be either an Internet host name (e.g., - "les") or an Internet address in standard dot notation - (e.g., "128.32.122.13") */ - { - struct hostent *hostsEntry; - unsigned long address; - - hostsEntry = gethostbyname(host); - if (hostsEntry == NULL) { - fprintf(stderr, "Couldn't decipher host name \"%s\"\n", host); - #ifndef WIN32 - herror(NULL); - #endif - return 0; - } - - address = *((unsigned long *) hostsEntry->h_addr_list[0]); - o->serv_addr.sin_addr.s_addr = address; - } - - /* was: o->serv_addr.sin_addr.s_addr = inet_addr(host); */ - - /* End MW changes */ - - /* - * Open a socket (a UDP domain datagram socket). - */ - - - #ifdef WIN32 - o->serv_addr.sin_port = htons((USHORT)portnumber); - o->addr = &(o->serv_addr); - if((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) != INVALID_SOCKET) { - ZeroMemory((char *)&cl_addr, sizeof(cl_addr)); - cl_addr.sin_family = AF_INET; - cl_addr.sin_addr.s_addr = htonl(INADDR_ANY); - cl_addr.sin_port = htons(0); - - // enable broadcast: jdl ~2003 - if(setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &oval, sizeof(int)) == -1) { - perror("setsockopt broadcast"); - } - - // check if specified address is a multicast group: ss 2007 - int multicast = IsAddressMulticast(o->serv_addr.sin_addr.s_addr); - - if (multicast == -1) { - perror("Multicast group range 224.0.0.[0-255] is reserved.\n"); - *multicast_TTL = -2; - close(sockfd); - sockfd = -1; - } - else { - // set TTL according to whether we have a multicast group or not - if (multicast) { - if (*multicast_TTL<0) - *multicast_TTL = 1; - } else - *multicast_TTL = -1; - - // set multicast Time-To-Live only if it is a multicast group: ss 2007 - if(*multicast_TTL>=0) { - unsigned char ttl = (unsigned char)*multicast_TTL; - if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, - &ttl, sizeof(ttl)) == -1) - perror("setsockopt TTL"); - } - - if(bind(sockfd, (struct sockaddr *) &cl_addr, sizeof(cl_addr)) < 0) { - perror("could not bind\n"); - closesocket(sockfd); - sockfd = -1; - } - } - } - else { perror("unable to make socket\n");} - #else - o->serv_addr.sin_port = htons(portnumber); - o->addr = &(o->serv_addr); - if((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) >= 0) { - bzero((char *)&cl_addr, sizeof(cl_addr)); - cl_addr.sin_family = AF_INET; - cl_addr.sin_addr.s_addr = htonl(INADDR_ANY); - cl_addr.sin_port = htons(0); - - // enable broadcast: jdl ~2003 - if(setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &oval, sizeof(int)) == -1) { - perror("setsockopt"); - } - - // check if specified address is a multicast group: ss 2007 - int multicast = IsAddressMulticast(o->serv_addr.sin_addr.s_addr); - - if (multicast == -1) { - perror("Multicast group range 224.0.0.[0-255] is reserved.\n"); - *multicast_TTL = -2; - close(sockfd); - sockfd = -1; - } - else { - // check if specified address is a multicast group: ss 2007 - if (multicast) { - if (*multicast_TTL<0) - *multicast_TTL = 1; - } else - *multicast_TTL = -1; - - // set multicast Time-To-Live only if it is a multicast group: ss 2007 - if(*multicast_TTL>=0) { - unsigned char ttl = (unsigned char)*multicast_TTL; - if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, - &ttl, sizeof(ttl)) == -1) - perror("setsockopt TTL"); - } - - if(bind(sockfd, (struct sockaddr *) &cl_addr, sizeof(cl_addr)) < 0) { - perror("could not bind\n"); - close(sockfd); - sockfd = -1; - } - } - } - else { perror("unable to make socket\n");} - #endif - } - #ifdef WIN32 - if(sockfd == INVALID_SOCKET) { - #else - if(sockfd < 0) { - #endif - free(o); - o = 0; - } - else - o->sockfd = sockfd; - return o; -} - - -#include - -static bool sendudp(const struct sockaddr *sp, int sockfd,int length, int count, void *b) -{ - int rcount; - if((rcount=sendto(sockfd, b, count, 0, sp, length)) != count) - { - printf("sockfd %d count %d rcount %dlength %d errno %d\n", sockfd,count,rcount,length, errno); - return FALSE; - } - return TRUE; -} -bool SendHTMSocket(void *htmsendhandle, int length_in_bytes, void *buffer) -{ - desc *o = (desc *)htmsendhandle; - return sendudp(o->addr, o->sockfd, o->len, length_in_bytes, buffer); -} -void CloseHTMSocket(void *htmsendhandle) -{ - desc *o = (desc *)htmsendhandle; - #ifdef WIN32 - if(SOCKET_ERROR == closesocket(o->sockfd)) { - perror("CloseHTMSocket::closesocket failed\n"); - return; - } - #else - if(close(o->sockfd) == -1) - { - perror("CloseHTMSocket::closesocket failed"); - return; - } - #endif - - free(o); -} diff --git a/src/htmsocket.h b/src/htmsocket.h deleted file mode 100644 index 685c1f7..0000000 --- a/src/htmsocket.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -Written by Adrian Freed, The Center for New Music and Audio Technologies, -University of California, Berkeley. Copyright (c) 1992,93,94,95,96,97,98,99,2000,01,02,03,04 -The Regents of the University of California (Regents). - -Permission to use, copy, modify, distribute, and distribute modified versions -of this software and its documentation without fee and without a signed -licensing agreement, is hereby granted, provided that the above copyright -notice, this paragraph and the following two paragraphs appear in all copies, -modifications, and distributions. - -IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING -OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED -HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE -MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - - -The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl -*/ - - - /* htmparam.h - - Adrian Freed - send parameters to htm servers by udp or UNIX protocol - */ -#ifndef TRUE -#define TRUE 1 -#define FALSE 0 -#endif -typedef int bool; - -/* open a socket for HTM communication to given host on given portnumber */ -/* if host is 0 then UNIX protocol is used (i.e. local communication) */ -void *OpenHTMSocket(char *host, int portnumber, short *multicast_TTL); - -/* send a buffer of data over htm socket, returns TRUE on success. - Note that udp sends rarely fail. UNIX sends fail if a kernal buffer overflows */ -bool SendHTMSocket(void *htmsendhandle, int length_in_bytes, void *buffer); - -/* close the socket(2) and release memory associated with it */ -void CloseHTMSocket(void *htmsendhandle); diff --git a/src/sendOSC.c b/src/sendOSC.c deleted file mode 100644 index ffbffab..0000000 --- a/src/sendOSC.c +++ /dev/null @@ -1,585 +0,0 @@ -/* -Written by Matt Wright, The Center for New Music and Audio Technologies, -University of California, Berkeley. Copyright (c) 1996,97,98,99,2000,01,02,03 -The Regents of the University of California (Regents). - -Permission to use, copy, modify, distribute, and distribute modified versions -of this software and its documentation without fee and without a signed -licensing agreement, is hereby granted, provided that the above copyright -notice, this paragraph and the following two paragraphs appear in all copies, -modifications, and distributions. - -IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING -OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED -HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE -MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - - -The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl -*/ - - - -/* sendOSC.c - - Matt Wright, 6/3/97 - based on sendOSC.c, which was based on a version by Adrian Freed - - Text-based OpenSoundControl client. User can enter messages via command - line arguments or standard input. - - Version 0.1: "play" feature - Version 0.2: Message type tags. - - pd version branched from http://www.cnmat.berkeley.edu/OpenSoundControl/src/sendOSC/sendOSC.c - ------------- - -- added bundle stuff to send. jdl 20020416 - -- tweaks for Win32 www.zeggz.com/raf 13-April-2002 - -- ost_at_test.at + i22_at_test.at, 2000-2002 - modified to compile as pd externel - --20060308 MP clear out some unused code and improve conversion from pd types to OSC types -*/ - -#if HAVE_CONFIG_H -#include -#endif - -#define MAX_ARGS 2000 -#define SC_BUFFER_SIZE 64000 - -#include "m_pd.h" - -#include "OSC-common.h" -#include "OSC-client.h" -#include "htmsocket.h" - -#include -#include - -#ifdef WIN32 -#include -#else -#include -#include -#include -#include -#include -#endif - -/////////////////////// -// from sendOSC - -typedef struct -{ - enum {INT_osc, FLOAT_osc, STRING_osc, NOTYPE_osc} type; - union - { - int i; - t_float f; - char *s; - } datum; -} typedArg; - - -//static int exitStatus = 0; -static int useTypeTags = 0; - -static char bufferForOSCbuf[SC_BUFFER_SIZE]; - - -///////// -// end from sendOSC - -static t_class *sendOSC_class; - -typedef struct _sendOSC -{ - t_object x_obj; - int x_protocol; // UDP/TCP (udp only atm) - t_int x_typetags; // typetag flag - void *x_htmsocket; // sending socket - int x_bundle; // bundle open flag - OSCbuf x_oscbuf[1]; // OSCbuffer - t_outlet *x_bdpthout;// bundle-depth floatoutlet -} t_sendOSC; - -static void *sendOSC_new(t_floatarg udpflag); -void sendOSC_openbundle(t_sendOSC *x); -static void sendOSC_closebundle(t_sendOSC *x); -static void sendOSC_settypetags(t_sendOSC *x, t_float *f); -static void sendOSC_connect(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv); -void sendOSC_disconnect(t_sendOSC *x); -static void sendOSC_sendtyped(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv); -void sendOSC_send(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv); -static void sendOSC_free(t_sendOSC *x); -void sendOSC_setup(void); -typedArg ParseAtom(t_atom *a); -int WriteMessage(OSCbuf *buf, char *messageName, int numArgs, typedArg *args); -void SendBuffer(void *htmsocket, OSCbuf *buf); -void SendData(void *htmsocket, int size, char *data); - -static void *sendOSC_new(t_floatarg udpflag) -{ - t_sendOSC *x = (t_sendOSC *)pd_new(sendOSC_class); - - outlet_new(&x->x_obj, &s_float); - x->x_htmsocket = 0; // {{raf}} - // set udp - x->x_protocol = SOCK_DGRAM; ////MP20060308// not SOCK_STREAM but we don't use it anyway... - // set typetags to 1 by default - x->x_typetags = 1; - // bundle is closed - x->x_bundle = 0; - OSC_initBuffer(x->x_oscbuf, SC_BUFFER_SIZE, bufferForOSCbuf); - x->x_bdpthout = outlet_new(&x->x_obj, 0); // outlet_float(); - //x->x_oscbuf = - return (x); -} - - -void sendOSC_openbundle(t_sendOSC *x) -{ - if (x->x_oscbuf->bundleDepth + 1 >= MAX_BUNDLE_NESTING || - OSC_openBundle(x->x_oscbuf, OSCTT_Immediately())) - { - error("Problem opening bundle: %s\n", OSC_errorMessage); - return; - } - x->x_bundle = 1; - outlet_float(x->x_bdpthout, (t_float)x->x_oscbuf->bundleDepth); -} - -static void sendOSC_closebundle(t_sendOSC *x) -{ - if (OSC_closeBundle(x->x_oscbuf)) - { - error("Problem closing bundle: %s\n", OSC_errorMessage); - return; - } - outlet_float(x->x_bdpthout, (t_float)x->x_oscbuf->bundleDepth); - // in bundle mode we send when bundle is closed? - if(!OSC_isBufferEmpty(x->x_oscbuf) > 0 && OSC_isBufferDone(x->x_oscbuf)) - { - // post("x_oscbuf: something inside me?"); - if (x->x_htmsocket) - { - SendBuffer(x->x_htmsocket, x->x_oscbuf); - } - else - { - post("sendOSC: not connected"); - } - OSC_initBuffer(x->x_oscbuf, SC_BUFFER_SIZE, bufferForOSCbuf); - x->x_bundle = 0; - return; - } - // post("x_oscbuf: something went wrong"); -} - -static void sendOSC_settypetags(t_sendOSC *x, t_float *f) - { - x->x_typetags = (int)f; - post("sendOSC.c: setting typetags %d",x->x_typetags); - } - -static void sendOSC_connect(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv) // t_symbol *hostname, t_floatarg fportno, int argc, t_atom *argv) -{ - t_float fportno=0; - t_symbol *hostname; - int portno = fportno; - short ttl=-1; - char *protocolStr; - /* create a socket */ - - if (argc < 2) - return; - - if (argv[0].a_type==A_SYMBOL) - hostname = argv[0].a_w.w_symbol; - else - return; - - if (argv[1].a_type==A_FLOAT) - portno = (int)argv[1].a_w.w_float; - else - return; - - if (argc >= 3) { - if (argv[2].a_type==A_FLOAT) - ttl = (short)(unsigned char)argv[2].a_w.w_float; - else - return; - } - - // make sure handle is available - if(x->x_htmsocket == 0) - { - x->x_htmsocket = OpenHTMSocket(hostname->s_name, portno, &ttl); - if (!x->x_htmsocket) { - post("sendOSC: Couldn't open socket: "); - if (ttl==-2) - post("sendOSC: Multicast group range 224.0.0.[0-255] is reserved.\n"); - } - else - { - switch (x->x_protocol) - { - case SOCK_DGRAM: - protocolStr = "UDP"; - break; - case SOCK_STREAM: - protocolStr = "TCP"; - break; - default: - protocolStr = "unknown"; - break; - } - if (ttl>=0) - post("sendOSC: connected to port %s:%d (hSock=%d) protocol = %s ttl = %d", - hostname->s_name, portno, x->x_htmsocket, protocolStr, ttl); - else - post("sendOSC: connected to port %s:%d (hSock=%d) protocol = %s", - hostname->s_name, portno, x->x_htmsocket, protocolStr); - outlet_float(x->x_obj.ob_outlet, 1); - } - } - else - perror("call to sendOSC_connect() against unavailable socket handle"); -} - -void sendOSC_disconnect(t_sendOSC *x) -{ - if (x->x_htmsocket) - { - post("sendOSC: disconnecting htmsock (hSock=%d)...", x->x_htmsocket); - CloseHTMSocket(x->x_htmsocket); - x->x_htmsocket = 0; // {{raf}} semi-quasi-semaphorize this - outlet_float(x->x_obj.ob_outlet, 0); - } - else - { - perror("call to sendOSC_disconnect() against unused socket handle"); - } -} - - -////////////////////////////////////////////////////////////////////// -// this is the real and only sending routine now, for both typed and -// undtyped mode. - -static void sendOSC_sendtyped(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv) -{ - char messageName[MAXPDSTRING]; - // char *token; - typedArg args[MAX_ARGS]; - int i; - - messageName[0] = '\0'; // empty - - if(argc>MAX_ARGS) - { - post ("sendOSC: too many arguments! (max: %d)", MAX_ARGS); - return; - } - - // this sock needs to be larger than 0, not >= .. - if (x->x_htmsocket > 0) - { -#ifdef DEBUG - post ("sendOSC: type tags? %d", useTypeTags); -#endif - - atom_string(&argv[0], messageName, MAXPDSTRING); -// messageName = strtok(targv[0], ","); - for (i = 0; i < argc-1; i++) - { -// token = strtok(targv[i],","); - - args[i] = ParseAtom(&argv[i+1]); -#ifdef DEBUG - switch (args[i].type) - { - case INT_osc: - printf("cell-cont: %d\n", args[i].datum.i); - break; - case FLOAT_osc: - printf("cell-cont: %f\n", args[i].datum.f); - break; - case STRING_osc: - printf("cell-cont: %s\n", args[i].datum.s); - break; - case NOTYPE_osc: - printf("unknown type\n"); - break; - } - printf(" type-id: %d\n", args[i].type); -#endif - } - - if(WriteMessage(x->x_oscbuf, messageName, i, args)) - { - post("sendOSC: usage error, write-msg failed: %s", OSC_errorMessage); - return; - } - - if(!x->x_bundle) - { - SendBuffer(x->x_htmsocket, x->x_oscbuf); - OSC_initBuffer(x->x_oscbuf, SC_BUFFER_SIZE, bufferForOSCbuf); - } - - } - else post("sendOSC: not connected"); -} - -void sendOSC_send(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv) -{ - if(!argc) - { - post("not sending empty message."); - return; - } - if(x->x_typetags) - { - useTypeTags = 1; - sendOSC_sendtyped(x,s,argc,argv); - useTypeTags = 0; - } - else - { - sendOSC_sendtyped(x,s,argc,argv); - } -} - -static void sendOSC_free(t_sendOSC *x) -{ - sendOSC_disconnect(x); -} - -void sendOSC_setup(void) -{ - sendOSC_class = class_new(gensym("sendOSC"), (t_newmethod)sendOSC_new, - (t_method)sendOSC_free, - sizeof(t_sendOSC), 0, A_DEFFLOAT, 0); - class_addmethod(sendOSC_class, (t_method)sendOSC_connect, - gensym("connect"), A_GIMME, 0); - class_addmethod(sendOSC_class, (t_method)sendOSC_disconnect, - gensym("disconnect"), 0); - class_addmethod(sendOSC_class, (t_method)sendOSC_settypetags, - gensym("typetags"), - A_FLOAT, 0); - class_addmethod(sendOSC_class, (t_method)sendOSC_send, - gensym("send"), - A_GIMME, 0); - class_addmethod(sendOSC_class, (t_method)sendOSC_send, - gensym("senduntyped"), - A_GIMME, 0); - class_addmethod(sendOSC_class, (t_method)sendOSC_send, - gensym("sendtyped"), - A_GIMME, 0); - class_addmethod(sendOSC_class, (t_method)sendOSC_openbundle, - gensym("["), - 0, 0); - class_addmethod(sendOSC_class, (t_method)sendOSC_closebundle, - gensym("]"), - 0, 0); - class_sethelpsymbol(sendOSC_class, gensym("sendOSC-help.pd")); - error("[sendOSC]: OSCx is deprecated! \n\tConsider switching to mrpeach's [packOSC] and [udpsend]"); -} - -/* Exit status codes: - 0: successful - 2: Message(s) dropped because of buffer overflow - 3: Socket error - 4: Usage error - 5: Internal error -*/ - - -typedArg ParseAtom(t_atom *a) -{ - typedArg returnVal; - t_float f; - t_int i; - t_symbol s; - char buf[MAXPDSTRING]; - - atom_string(a, buf, MAXPDSTRING); -#ifdef DEBUG - post("sendOSC: atom type %d (%s)", a->a_type, buf); -#endif - /* It might be an int, a float, or a string */ - switch (a->a_type) - { - - case A_FLOAT: - f = atom_getfloat(a); - i = atom_getint(a); - if (f == (t_float)i) - { // assume that if the int and float are the same, it's an int - returnVal.type = INT_osc; - returnVal.datum.i = i; - } - else - { - returnVal.type = FLOAT_osc; - returnVal.datum.f = f; - } - return returnVal; - case A_SYMBOL: - s = *atom_getsymbol(a); - returnVal.type = STRING_osc; - returnVal.datum.s = s.s_name; - return returnVal; - default: - atom_string(a, buf, MAXPDSTRING); - error("sendOSC: atom type %d not implemented (%s)", a->a_type, buf); - returnVal.type = NOTYPE_osc; - returnVal.datum.s = NULL; - return returnVal; -} -} - -int WriteMessage(OSCbuf *buf, char *messageName, int numArgs, typedArg *args) -{ - int j, returnVal; - - returnVal = 0; - -#ifdef DEBUG - printf("WriteMessage: %s ", messageName); - - for (j = 0; j < numArgs; j++) - { - switch (args[j].type) - { - case INT_osc: - printf("%d ", args[j].datum.i); - break; - - case FLOAT_osc: - printf("%f ", args[j].datum.f); - break; - - case STRING_osc: - printf("%s ", args[j].datum.s); - break; - - default: - error("Unrecognized arg type %d", args[j].type); - break; - } - } - printf("\n"); -#endif - - if (!useTypeTags) - { - returnVal = OSC_writeAddress(buf, messageName); - if (returnVal) - { - error("Problem writing address: %s\n", OSC_errorMessage); - } - } - else - { - /* First figure out the type tags */ - char typeTags[MAX_ARGS+2]; - - typeTags[0] = ','; - - for (j = 0; j < numArgs; ++j) - { - switch (args[j].type) - { - case INT_osc: - typeTags[j+1] = 'i'; - break; - - case FLOAT_osc: - typeTags[j+1] = 'f'; - break; - - case STRING_osc: - typeTags[j+1] = 's'; - break; - - default: - error("sendOSC: arg %d type is unrecognized(%d)", j, args[j].type); - break; - } - } - typeTags[j+1] = '\0'; - - returnVal = OSC_writeAddressAndTypes(buf, messageName, typeTags); - if (returnVal) - { - error("Problem writing address: %s\n", OSC_errorMessage); - } - } - - for (j = 0; j < numArgs; j++) - { - switch (args[j].type) - { - case INT_osc: - if ((returnVal = OSC_writeIntArg(buf, args[j].datum.i)) != 0) - { - return returnVal; - } - break; - - case FLOAT_osc: - if ((returnVal = OSC_writeFloatArg(buf, args[j].datum.f)) != 0) - { - return returnVal; - } - break; - - case STRING_osc: - if ((returnVal = OSC_writeStringArg(buf, args[j].datum.s)) != 0) - { - return returnVal; - } - break; - - default: - break; // just skip bad types (which we won't get anyway unless this code is buggy) - } - } - return returnVal; -} - -void SendBuffer(void *htmsocket, OSCbuf *buf) -{ -#ifdef DEBUG - printf("Sending buffer...\n"); -#endif - if (OSC_isBufferEmpty(buf)) - { - post("SendBuffer() called but buffer empty"); - return; - } - if (!OSC_isBufferDone(buf)) - { - fatal_error("SendBuffer() called but buffer not ready!, not exiting"); - return; //{{raf}} - } - SendData(htmsocket, OSC_packetSize(buf), OSC_getPacket(buf)); -} - -void SendData(void *htmsocket, int size, char *data) -{ - if (!SendHTMSocket(htmsocket, size, data)) - { - post("SendData::SendHTMSocket()failure -- not connected"); - CloseHTMSocket(htmsocket); -} -} - diff --git a/test_OSC.c b/test_OSC.c new file mode 100644 index 0000000..4593ec6 --- /dev/null +++ b/test_OSC.c @@ -0,0 +1,149 @@ +/* + * Copyright (c) 1997 Regents of the University of California. + * All rights reserved. + * + * The name of the University may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE + * IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE. + */ + +/* + test_OSC.c + Trivial program to test OpenSoundControl.[ch] + + Matt Wright 6/2/97 +*/ + +#include +#include +#include "OpenSoundControl.h" + +#define SIZE 10000 + +void PrintBuf(OSCbuf *b) { + printf("Buffer is %sempty.\n", OSC_isBufferEmpty(b) ? "" : "not "); + printf("%d bytes free in buffer\n", OSC_freeSpaceInBuffer(b)); + printf("Buffer is %sready to send\n", OSC_isBufferDone(b) ?"":"not "); + + printf("Buffer: bufptr %p, state %d, thisMsgSize %p, bundleDepth %d\n" + "prevCounts[%d] %p\n", b->bufptr, b->state, b->thisMsgSize, + b->bundleDepth, b->bundleDepth, b->prevCounts[b->bundleDepth]); +} + +void PrintPacket(OSCbuf *b) { + char *p = OSC_getPacket(b); + int size = OSC_packetSize(b); + unsigned int *intp; + int i; + + printf("PrintPacket: packet at %p, size %d\n", p, size); + if (p == 0 || size == 0) return; + + printf("Hex version:"); + for (i = 0, intp = (unsigned int *)p; i < size; i += 4, intp++) { + if (i % 40 == 0) printf("\n"); + printf("%x ", *intp); + } + + printf("\n\nString version:"); + for (i = 0; i < size; i++) { + if (i % 40 == 0) printf("\n"); + if (isprint(p[i])) { + printf("%c", p[i]); + } else { + printf("\\%x", p[i] & 0x000000ff); + } + } + printf("\n"); +} + + +main() { + OSCbuf myBuf; + OSCbuf *b = &myBuf; + char bytes[SIZE]; + OSCTimeTag tt; + + printf("OSC_initBuffer\n"); + OSC_initBuffer(b, SIZE, bytes); + + PrintBuf(b); + + printf("Testing one-message packet\n"); + if (OSC_writeAddress(b, "/blah/bleh/singlemessage")) { + printf("** ERROR: %s\n", OSC_errorMessage); + } + + if (OSC_writeFloatArg(b, 1.23456f)) { + printf("** ERROR: %s\n", OSC_errorMessage); + } + + { + float floatarray[10]; + int i; + for (i = 0; i < 10; ++i) { + floatarray[i] = i * 10.0f; + } + if (OSC_writeFloatArgs(b, 10, floatarray)) { + printf("** ERROR: %s\n", OSC_errorMessage); + } + } + + if (OSC_writeIntArg(b, 123456)) { + printf("** ERROR: %s\n", OSC_errorMessage); + } + + if (OSC_writeStringArg(b, "This is a cool string, dude.")) { + printf("** ERROR: %s\n", OSC_errorMessage); + } + + PrintBuf(b); + PrintPacket(b); + + printf("Resetting\n"); + OSC_resetBuffer(b); + + printf("Testing time tags\n"); + tt = OSCTT_CurrentTime(); + printf("Time now is %llx\n", tt); + + printf("Testing bundles\n"); + if (OSC_openBundle(b, tt)) { + printf("** ERROR: %s\n", OSC_errorMessage); + } + + if (OSC_writeAddress(b, "/a/hello")) { + printf("** ERROR: %s\n", OSC_errorMessage); + } + + if (OSC_writeIntArg(b, 16)) { + printf("** ERROR: %s\n", OSC_errorMessage); + } + + if (OSC_writeIntArg(b, 32)) { + printf("** ERROR: %s\n", OSC_errorMessage); + } + + if (OSC_openBundle(b, OSCTT_PlusSeconds(tt, 1.0f))) { + printf("** ERROR: %s\n", OSC_errorMessage); + } + + if (OSC_writeAddress(b, "/b/hello")) { + printf("** ERROR: %s\n", OSC_errorMessage); + } + + if (OSC_writeAddress(b, "/c/hello")) { + printf("** ERROR: %s\n", OSC_errorMessage); + } + + OSC_closeAllBundles(b); + + PrintBuf(b); + PrintPacket(b); +} + + + diff --git a/test_OSC_timeTag.c b/test_OSC_timeTag.c new file mode 100644 index 0000000..8a1cabf --- /dev/null +++ b/test_OSC_timeTag.c @@ -0,0 +1,36 @@ +/* + * Copyright (c) 1997 Regents of the University of California. + * All rights reserved. + * + * The name of the University may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE + * IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR + * PURPOSE. + */ + +/* + test_OSC_timeTag.c + Matt Wright, 5/30/97 +*/ + +#include +#include "OSC_timeTag.h" + +main() { + OSCTimeTag now, later; + + now = OSCTT_CurrentTime(); + printf("Now it's %llu (0x%llx)\n", now, now); + + printf("Immediately would be %llu (0x%llx)\n", OSCTT_Immediately(), + OSCTT_Immediately()); + + later = OSCTT_PlusSeconds(now, 1.0f); + printf("One second from now would be %llu (0x%llx)\n", later, later); + + now = OSCTT_CurrentTime(); + printf("And *now* it's %llu (0x%llx)\n", now, now); +} + -- cgit v1.2.1