├── AUTHORS ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile.am ├── Makefile.in ├── NEWS ├── README ├── aclocal.m4 ├── config.guess ├── config.h.in ├── config.sub ├── configure ├── configure.in ├── depcomp ├── include ├── Makefile.am ├── Makefile.in ├── pcl.h ├── pcl_config.h └── pcl_private.h ├── install-sh ├── ltmain.sh ├── m4 ├── libtool.m4 ├── ltoptions.m4 ├── ltsugar.m4 ├── ltversion.m4 └── lt~obsolete.m4 ├── makefile.win32 ├── man ├── Makefile.am ├── Makefile.in ├── libpcl.html ├── mkpages.sh ├── pcl.3 ├── pcl.html ├── pcl.ps └── pcl.txt ├── missing ├── mkinstalldirs ├── pcl ├── Makefile.am ├── Makefile.in ├── pcl.c ├── pcl_private.c └── pcl_version.c ├── test ├── Makefile.am ├── Makefile.in ├── cobench.c └── cothread.c └── winconfig.h /AUTHORS: -------------------------------------------------------------------------------- 1 | Davide Libenzi 2 | 3 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | * Thu Apr 10 2003 Davide Libenzi - 1.0 2 | 3 | Added automatic configuration support. 4 | 5 | * Sat Mar 22 2003 Davide Libenzi - 0.99 6 | 7 | Initial release 8 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | Installation Instructions 2 | ************************* 3 | 4 | Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free 5 | Software Foundation, Inc. 6 | 7 | This file is free documentation; the Free Software Foundation gives 8 | unlimited permission to copy, distribute and modify it. 9 | 10 | Basic Installation 11 | ================== 12 | 13 | These are generic installation instructions. 14 | 15 | The `configure' shell script attempts to guess correct values for 16 | various system-dependent variables used during compilation. It uses 17 | those values to create a `Makefile' in each directory of the package. 18 | It may also create one or more `.h' files containing system-dependent 19 | definitions. Finally, it creates a shell script `config.status' that 20 | you can run in the future to recreate the current configuration, and a 21 | file `config.log' containing compiler output (useful mainly for 22 | debugging `configure'). 23 | 24 | It can also use an optional file (typically called `config.cache' 25 | and enabled with `--cache-file=config.cache' or simply `-C') that saves 26 | the results of its tests to speed up reconfiguring. (Caching is 27 | disabled by default to prevent problems with accidental use of stale 28 | cache files.) 29 | 30 | If you need to do unusual things to compile the package, please try 31 | to figure out how `configure' could check whether to do them, and mail 32 | diffs or instructions to the address given in the `README' so they can 33 | be considered for the next release. If you are using the cache, and at 34 | some point `config.cache' contains results you don't want to keep, you 35 | may remove or edit it. 36 | 37 | The file `configure.ac' (or `configure.in') is used to create 38 | `configure' by a program called `autoconf'. You only need 39 | `configure.ac' if you want to change it or regenerate `configure' using 40 | a newer version of `autoconf'. 41 | 42 | The simplest way to compile this package is: 43 | 44 | 1. `cd' to the directory containing the package's source code and type 45 | `./configure' to configure the package for your system. If you're 46 | using `csh' on an old version of System V, you might need to type 47 | `sh ./configure' instead to prevent `csh' from trying to execute 48 | `configure' itself. 49 | 50 | Running `configure' takes awhile. While running, it prints some 51 | messages telling which features it is checking for. 52 | 53 | 2. Type `make' to compile the package. 54 | 55 | 3. Optionally, type `make check' to run any self-tests that come with 56 | the package. 57 | 58 | 4. Type `make install' to install the programs and any data files and 59 | documentation. 60 | 61 | 5. You can remove the program binaries and object files from the 62 | source code directory by typing `make clean'. To also remove the 63 | files that `configure' created (so you can compile the package for 64 | a different kind of computer), type `make distclean'. There is 65 | also a `make maintainer-clean' target, but that is intended mainly 66 | for the package's developers. If you use it, you may have to get 67 | all sorts of other programs in order to regenerate files that came 68 | with the distribution. 69 | 70 | Compilers and Options 71 | ===================== 72 | 73 | Some systems require unusual options for compilation or linking that the 74 | `configure' script does not know about. Run `./configure --help' for 75 | details on some of the pertinent environment variables. 76 | 77 | You can give `configure' initial values for configuration parameters 78 | by setting variables in the command line or in the environment. Here 79 | is an example: 80 | 81 | ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix 82 | 83 | *Note Defining Variables::, for more details. 84 | 85 | Compiling For Multiple Architectures 86 | ==================================== 87 | 88 | You can compile the package for more than one kind of computer at the 89 | same time, by placing the object files for each architecture in their 90 | own directory. To do this, you must use a version of `make' that 91 | supports the `VPATH' variable, such as GNU `make'. `cd' to the 92 | directory where you want the object files and executables to go and run 93 | the `configure' script. `configure' automatically checks for the 94 | source code in the directory that `configure' is in and in `..'. 95 | 96 | If you have to use a `make' that does not support the `VPATH' 97 | variable, you have to compile the package for one architecture at a 98 | time in the source code directory. After you have installed the 99 | package for one architecture, use `make distclean' before reconfiguring 100 | for another architecture. 101 | 102 | Installation Names 103 | ================== 104 | 105 | By default, `make install' installs the package's commands under 106 | `/usr/local/bin', include files under `/usr/local/include', etc. You 107 | can specify an installation prefix other than `/usr/local' by giving 108 | `configure' the option `--prefix=PREFIX'. 109 | 110 | You can specify separate installation prefixes for 111 | architecture-specific files and architecture-independent files. If you 112 | pass the option `--exec-prefix=PREFIX' to `configure', the package uses 113 | PREFIX as the prefix for installing programs and libraries. 114 | Documentation and other data files still use the regular prefix. 115 | 116 | In addition, if you use an unusual directory layout you can give 117 | options like `--bindir=DIR' to specify different values for particular 118 | kinds of files. Run `configure --help' for a list of the directories 119 | you can set and what kinds of files go in them. 120 | 121 | If the package supports it, you can cause programs to be installed 122 | with an extra prefix or suffix on their names by giving `configure' the 123 | option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. 124 | 125 | Optional Features 126 | ================= 127 | 128 | Some packages pay attention to `--enable-FEATURE' options to 129 | `configure', where FEATURE indicates an optional part of the package. 130 | They may also pay attention to `--with-PACKAGE' options, where PACKAGE 131 | is something like `gnu-as' or `x' (for the X Window System). The 132 | `README' should mention any `--enable-' and `--with-' options that the 133 | package recognizes. 134 | 135 | For packages that use the X Window System, `configure' can usually 136 | find the X include and library files automatically, but if it doesn't, 137 | you can use the `configure' options `--x-includes=DIR' and 138 | `--x-libraries=DIR' to specify their locations. 139 | 140 | Specifying the System Type 141 | ========================== 142 | 143 | There may be some features `configure' cannot figure out automatically, 144 | but needs to determine by the type of machine the package will run on. 145 | Usually, assuming the package is built to be run on the _same_ 146 | architectures, `configure' can figure that out, but if it prints a 147 | message saying it cannot guess the machine type, give it the 148 | `--build=TYPE' option. TYPE can either be a short name for the system 149 | type, such as `sun4', or a canonical name which has the form: 150 | 151 | CPU-COMPANY-SYSTEM 152 | 153 | where SYSTEM can have one of these forms: 154 | 155 | OS KERNEL-OS 156 | 157 | See the file `config.sub' for the possible values of each field. If 158 | `config.sub' isn't included in this package, then this package doesn't 159 | need to know the machine type. 160 | 161 | If you are _building_ compiler tools for cross-compiling, you should 162 | use the option `--target=TYPE' to select the type of system they will 163 | produce code for. 164 | 165 | If you want to _use_ a cross compiler, that generates code for a 166 | platform different from the build platform, you should specify the 167 | "host" platform (i.e., that on which the generated programs will 168 | eventually be run) with `--host=TYPE'. 169 | 170 | Sharing Defaults 171 | ================ 172 | 173 | If you want to set default values for `configure' scripts to share, you 174 | can create a site shell script called `config.site' that gives default 175 | values for variables like `CC', `cache_file', and `prefix'. 176 | `configure' looks for `PREFIX/share/config.site' if it exists, then 177 | `PREFIX/etc/config.site' if it exists. Or, you can set the 178 | `CONFIG_SITE' environment variable to the location of the site script. 179 | A warning: not all `configure' scripts look for a site script. 180 | 181 | Defining Variables 182 | ================== 183 | 184 | Variables not defined in a site shell script can be set in the 185 | environment passed to `configure'. However, some packages may run 186 | configure again during the build, and the customized values of these 187 | variables may be lost. In order to avoid this problem, you should set 188 | them in the `configure' command line, using `VAR=value'. For example: 189 | 190 | ./configure CC=/usr/local2/bin/gcc 191 | 192 | causes the specified `gcc' to be used as the C compiler (unless it is 193 | overridden in the site shell script). Here is a another example: 194 | 195 | /bin/bash ./configure CONFIG_SHELL=/bin/bash 196 | 197 | Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent 198 | configuration-related scripts to be executed by `/bin/bash'. 199 | 200 | `configure' Invocation 201 | ====================== 202 | 203 | `configure' recognizes the following options to control how it operates. 204 | 205 | `--help' 206 | `-h' 207 | Print a summary of the options to `configure', and exit. 208 | 209 | `--version' 210 | `-V' 211 | Print the version of Autoconf used to generate the `configure' 212 | script, and exit. 213 | 214 | `--cache-file=FILE' 215 | Enable the cache: use and save the results of the tests in FILE, 216 | traditionally `config.cache'. FILE defaults to `/dev/null' to 217 | disable caching. 218 | 219 | `--config-cache' 220 | `-C' 221 | Alias for `--cache-file=config.cache'. 222 | 223 | `--quiet' 224 | `--silent' 225 | `-q' 226 | Do not print messages saying which checks are being made. To 227 | suppress all normal output, redirect it to `/dev/null' (any error 228 | messages will still be shown). 229 | 230 | `--srcdir=DIR' 231 | Look for the package's source code in directory DIR. Usually 232 | `configure' can determine that directory automatically. 233 | 234 | `configure' also accepts some other, not widely useful, options. Run 235 | `configure --help' for more details. 236 | 237 | Building on Windows 238 | ====================== 239 | The supplied makefile.win32 makefile should be used together with `nmake` 240 | to build PCL for Windows. 241 | Once the MSVC environment is properly set, just run: 242 | 243 | C:> nmake /f makefile.win32 CFG={release, debug} 244 | 245 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | SUBDIRS = . pcl test include man 3 | 4 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knz/pcl/52c71813cec4291d79f5147119623eb6ab33779f/NEWS -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/knz/pcl/52c71813cec4291d79f5147119623eb6ab33779f/README -------------------------------------------------------------------------------- /config.h.in: -------------------------------------------------------------------------------- 1 | /* config.h.in. Generated from configure.in by autoheader. */ 2 | 3 | /* Define if building universal (internal helper macro) */ 4 | #undef AC_APPLE_UNIVERSAL_BUILD 5 | 6 | /* Define to 1 if you have the header file. */ 7 | #undef HAVE_DLFCN_H 8 | 9 | /* Define to 1 if you have the `free' function. */ 10 | #undef HAVE_FREE 11 | 12 | /* Define to 1 if you have the `getcontext' function. */ 13 | #undef HAVE_GETCONTEXT 14 | 15 | /* Define to 1 if you have the header file. */ 16 | #undef HAVE_INTTYPES_H 17 | 18 | /* Define to 1 if you have the `longjmp' function. */ 19 | #undef HAVE_LONGJMP 20 | 21 | /* Define to 1 if you have the `makecontext' function. */ 22 | #undef HAVE_MAKECONTEXT 23 | 24 | /* Define to 1 if you have the `malloc' function. */ 25 | #undef HAVE_MALLOC 26 | 27 | /* Define to 1 if you have the header file. */ 28 | #undef HAVE_MEMORY_H 29 | 30 | /* Define to 1 if you have the `memset' function. */ 31 | #undef HAVE_MEMSET 32 | 33 | /* Define to 1 if you have the `setjmp' function. */ 34 | #undef HAVE_SETJMP 35 | 36 | /* Define to 1 if you have the `sigaction' function. */ 37 | #undef HAVE_SIGACTION 38 | 39 | /* Define to 1 if you have the `sigaltstack' function. */ 40 | #undef HAVE_SIGALTSTACK 41 | 42 | /* Define to 1 if you have the header file. */ 43 | #undef HAVE_STDINT_H 44 | 45 | /* Define to 1 if you have the header file. */ 46 | #undef HAVE_STDLIB_H 47 | 48 | /* Define to 1 if you have the header file. */ 49 | #undef HAVE_STRINGS_H 50 | 51 | /* Define to 1 if you have the header file. */ 52 | #undef HAVE_STRING_H 53 | 54 | /* Define to 1 if you have the `swapcontext' function. */ 55 | #undef HAVE_SWAPCONTEXT 56 | 57 | /* Define to 1 if you have the header file. */ 58 | #undef HAVE_SYS_STAT_H 59 | 60 | /* Define to 1 if you have the header file. */ 61 | #undef HAVE_SYS_TYPES_H 62 | 63 | /* Define to 1 if you have the header file. */ 64 | #undef HAVE_UNISTD_H 65 | 66 | /* Define to the sub-directory in which libtool stores uninstalled libraries. 67 | */ 68 | #undef LT_OBJDIR 69 | 70 | /* Name of package */ 71 | #undef PACKAGE 72 | 73 | /* Define to the address where bug reports for this package should be sent. */ 74 | #undef PACKAGE_BUGREPORT 75 | 76 | /* Define to the full name of this package. */ 77 | #undef PACKAGE_NAME 78 | 79 | /* Define to the full name and version of this package. */ 80 | #undef PACKAGE_STRING 81 | 82 | /* Define to the one symbol short name of this package. */ 83 | #undef PACKAGE_TARNAME 84 | 85 | /* Define to the home page for this package. */ 86 | #undef PACKAGE_URL 87 | 88 | /* Define to the version of this package. */ 89 | #undef PACKAGE_VERSION 90 | 91 | /* Define to 1 if you have the ANSI C header files. */ 92 | #undef STDC_HEADERS 93 | 94 | /* Version number of package */ 95 | #undef VERSION 96 | 97 | /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most 98 | significant byte first (like Motorola and SPARC, unlike Intel). */ 99 | #if defined AC_APPLE_UNIVERSAL_BUILD 100 | # if defined __BIG_ENDIAN__ 101 | # define WORDS_BIGENDIAN 1 102 | # endif 103 | #else 104 | # ifndef WORDS_BIGENDIAN 105 | # undef WORDS_BIGENDIAN 106 | # endif 107 | #endif 108 | 109 | /* Define to empty if `const' does not conform to ANSI C. */ 110 | #undef const 111 | 112 | /* Define to `__inline__' or `__inline' if that's what the C compiler 113 | calls it, or to nothing if 'inline' is not supported under any name. */ 114 | #ifndef __cplusplus 115 | #undef inline 116 | #endif 117 | 118 | /* Define to empty if the keyword `volatile' does not work. Warning: valid 119 | code using `volatile' can become incorrect without. Disable with care. */ 120 | #undef volatile 121 | -------------------------------------------------------------------------------- /configure.in: -------------------------------------------------------------------------------- 1 | dnl Process this file with autoconf to produce a configure script. 2 | AC_INIT(libpcl, 1.12) 3 | AM_INIT_AUTOMAKE(libpcl, 1.12) 4 | AM_CONFIG_HEADER(config.h) 5 | AC_CONFIG_MACRO_DIR([m4]) 6 | 7 | dnl Checks for programs. 8 | AC_PROG_MAKE_SET 9 | AC_PROG_CC 10 | AC_PROG_RANLIB 11 | AC_PROG_INSTALL 12 | AC_PROG_LIBTOOL 13 | 14 | dnl Checks for libraries. 15 | 16 | dnl Checks for header files. 17 | AC_STDC_HEADERS 18 | 19 | dnl Checks for typedefs, structures, and compiler characteristics. 20 | AC_C_INLINE 21 | AC_C_VOLATILE 22 | AC_C_CONST 23 | AC_C_BIGENDIAN 24 | 25 | dnl Checks for library functions. 26 | AC_CHECK_FUNCS(memset malloc free) 27 | AC_CHECK_FUNCS(makecontext getcontext swapcontext) 28 | AC_CHECK_FUNCS(sigaction) 29 | AC_CHECK_FUNCS(longjmp setjmp) 30 | AC_CHECK_FUNCS(sigaltstack) 31 | 32 | 33 | AC_OUTPUT(Makefile pcl/Makefile test/Makefile man/Makefile include/Makefile) 34 | 35 | -------------------------------------------------------------------------------- /depcomp: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # depcomp - compile a program generating dependencies as side-effects 3 | 4 | scriptversion=2005-07-09.11 5 | 6 | # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. 7 | 8 | # This program is free software; you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation; either version 2, or (at your option) 11 | # any later version. 12 | 13 | # This program is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program; if not, write to the Free Software 20 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 21 | # 02110-1301, USA. 22 | 23 | # As a special exception to the GNU General Public License, if you 24 | # distribute this file as part of a program that contains a 25 | # configuration script generated by Autoconf, you may include it under 26 | # the same distribution terms that you use for the rest of that program. 27 | 28 | # Originally written by Alexandre Oliva . 29 | 30 | case $1 in 31 | '') 32 | echo "$0: No command. Try \`$0 --help' for more information." 1>&2 33 | exit 1; 34 | ;; 35 | -h | --h*) 36 | cat <<\EOF 37 | Usage: depcomp [--help] [--version] PROGRAM [ARGS] 38 | 39 | Run PROGRAMS ARGS to compile a file, generating dependencies 40 | as side-effects. 41 | 42 | Environment variables: 43 | depmode Dependency tracking mode. 44 | source Source file read by `PROGRAMS ARGS'. 45 | object Object file output by `PROGRAMS ARGS'. 46 | DEPDIR directory where to store dependencies. 47 | depfile Dependency file to output. 48 | tmpdepfile Temporary file to use when outputing dependencies. 49 | libtool Whether libtool is used (yes/no). 50 | 51 | Report bugs to . 52 | EOF 53 | exit $? 54 | ;; 55 | -v | --v*) 56 | echo "depcomp $scriptversion" 57 | exit $? 58 | ;; 59 | esac 60 | 61 | if test -z "$depmode" || test -z "$source" || test -z "$object"; then 62 | echo "depcomp: Variables source, object and depmode must be set" 1>&2 63 | exit 1 64 | fi 65 | 66 | # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. 67 | depfile=${depfile-`echo "$object" | 68 | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 69 | tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 70 | 71 | rm -f "$tmpdepfile" 72 | 73 | # Some modes work just like other modes, but use different flags. We 74 | # parameterize here, but still list the modes in the big case below, 75 | # to make depend.m4 easier to write. Note that we *cannot* use a case 76 | # here, because this file can only contain one case statement. 77 | if test "$depmode" = hp; then 78 | # HP compiler uses -M and no extra arg. 79 | gccflag=-M 80 | depmode=gcc 81 | fi 82 | 83 | if test "$depmode" = dashXmstdout; then 84 | # This is just like dashmstdout with a different argument. 85 | dashmflag=-xM 86 | depmode=dashmstdout 87 | fi 88 | 89 | case "$depmode" in 90 | gcc3) 91 | ## gcc 3 implements dependency tracking that does exactly what 92 | ## we want. Yay! Note: for some reason libtool 1.4 doesn't like 93 | ## it if -MD -MP comes after the -MF stuff. Hmm. 94 | "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" 95 | stat=$? 96 | if test $stat -eq 0; then : 97 | else 98 | rm -f "$tmpdepfile" 99 | exit $stat 100 | fi 101 | mv "$tmpdepfile" "$depfile" 102 | ;; 103 | 104 | gcc) 105 | ## There are various ways to get dependency output from gcc. Here's 106 | ## why we pick this rather obscure method: 107 | ## - Don't want to use -MD because we'd like the dependencies to end 108 | ## up in a subdir. Having to rename by hand is ugly. 109 | ## (We might end up doing this anyway to support other compilers.) 110 | ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 111 | ## -MM, not -M (despite what the docs say). 112 | ## - Using -M directly means running the compiler twice (even worse 113 | ## than renaming). 114 | if test -z "$gccflag"; then 115 | gccflag=-MD, 116 | fi 117 | "$@" -Wp,"$gccflag$tmpdepfile" 118 | stat=$? 119 | if test $stat -eq 0; then : 120 | else 121 | rm -f "$tmpdepfile" 122 | exit $stat 123 | fi 124 | rm -f "$depfile" 125 | echo "$object : \\" > "$depfile" 126 | alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 127 | ## The second -e expression handles DOS-style file names with drive letters. 128 | sed -e 's/^[^:]*: / /' \ 129 | -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 130 | ## This next piece of magic avoids the `deleted header file' problem. 131 | ## The problem is that when a header file which appears in a .P file 132 | ## is deleted, the dependency causes make to die (because there is 133 | ## typically no way to rebuild the header). We avoid this by adding 134 | ## dummy dependencies for each header file. Too bad gcc doesn't do 135 | ## this for us directly. 136 | tr ' ' ' 137 | ' < "$tmpdepfile" | 138 | ## Some versions of gcc put a space before the `:'. On the theory 139 | ## that the space means something, we add a space to the output as 140 | ## well. 141 | ## Some versions of the HPUX 10.20 sed can't process this invocation 142 | ## correctly. Breaking it into two sed invocations is a workaround. 143 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 144 | rm -f "$tmpdepfile" 145 | ;; 146 | 147 | hp) 148 | # This case exists only to let depend.m4 do its work. It works by 149 | # looking at the text of this script. This case will never be run, 150 | # since it is checked for above. 151 | exit 1 152 | ;; 153 | 154 | sgi) 155 | if test "$libtool" = yes; then 156 | "$@" "-Wp,-MDupdate,$tmpdepfile" 157 | else 158 | "$@" -MDupdate "$tmpdepfile" 159 | fi 160 | stat=$? 161 | if test $stat -eq 0; then : 162 | else 163 | rm -f "$tmpdepfile" 164 | exit $stat 165 | fi 166 | rm -f "$depfile" 167 | 168 | if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 169 | echo "$object : \\" > "$depfile" 170 | 171 | # Clip off the initial element (the dependent). Don't try to be 172 | # clever and replace this with sed code, as IRIX sed won't handle 173 | # lines with more than a fixed number of characters (4096 in 174 | # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 175 | # the IRIX cc adds comments like `#:fec' to the end of the 176 | # dependency line. 177 | tr ' ' ' 178 | ' < "$tmpdepfile" \ 179 | | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 180 | tr ' 181 | ' ' ' >> $depfile 182 | echo >> $depfile 183 | 184 | # The second pass generates a dummy entry for each header file. 185 | tr ' ' ' 186 | ' < "$tmpdepfile" \ 187 | | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 188 | >> $depfile 189 | else 190 | # The sourcefile does not contain any dependencies, so just 191 | # store a dummy comment line, to avoid errors with the Makefile 192 | # "include basename.Plo" scheme. 193 | echo "#dummy" > "$depfile" 194 | fi 195 | rm -f "$tmpdepfile" 196 | ;; 197 | 198 | aix) 199 | # The C for AIX Compiler uses -M and outputs the dependencies 200 | # in a .u file. In older versions, this file always lives in the 201 | # current directory. Also, the AIX compiler puts `$object:' at the 202 | # start of each line; $object doesn't have directory information. 203 | # Version 6 uses the directory in both cases. 204 | stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` 205 | tmpdepfile="$stripped.u" 206 | if test "$libtool" = yes; then 207 | "$@" -Wc,-M 208 | else 209 | "$@" -M 210 | fi 211 | stat=$? 212 | 213 | if test -f "$tmpdepfile"; then : 214 | else 215 | stripped=`echo "$stripped" | sed 's,^.*/,,'` 216 | tmpdepfile="$stripped.u" 217 | fi 218 | 219 | if test $stat -eq 0; then : 220 | else 221 | rm -f "$tmpdepfile" 222 | exit $stat 223 | fi 224 | 225 | if test -f "$tmpdepfile"; then 226 | outname="$stripped.o" 227 | # Each line is of the form `foo.o: dependent.h'. 228 | # Do two passes, one to just change these to 229 | # `$object: dependent.h' and one to simply `dependent.h:'. 230 | sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" 231 | sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" 232 | else 233 | # The sourcefile does not contain any dependencies, so just 234 | # store a dummy comment line, to avoid errors with the Makefile 235 | # "include basename.Plo" scheme. 236 | echo "#dummy" > "$depfile" 237 | fi 238 | rm -f "$tmpdepfile" 239 | ;; 240 | 241 | icc) 242 | # Intel's C compiler understands `-MD -MF file'. However on 243 | # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 244 | # ICC 7.0 will fill foo.d with something like 245 | # foo.o: sub/foo.c 246 | # foo.o: sub/foo.h 247 | # which is wrong. We want: 248 | # sub/foo.o: sub/foo.c 249 | # sub/foo.o: sub/foo.h 250 | # sub/foo.c: 251 | # sub/foo.h: 252 | # ICC 7.1 will output 253 | # foo.o: sub/foo.c sub/foo.h 254 | # and will wrap long lines using \ : 255 | # foo.o: sub/foo.c ... \ 256 | # sub/foo.h ... \ 257 | # ... 258 | 259 | "$@" -MD -MF "$tmpdepfile" 260 | stat=$? 261 | if test $stat -eq 0; then : 262 | else 263 | rm -f "$tmpdepfile" 264 | exit $stat 265 | fi 266 | rm -f "$depfile" 267 | # Each line is of the form `foo.o: dependent.h', 268 | # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 269 | # Do two passes, one to just change these to 270 | # `$object: dependent.h' and one to simply `dependent.h:'. 271 | sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 272 | # Some versions of the HPUX 10.20 sed can't process this invocation 273 | # correctly. Breaking it into two sed invocations is a workaround. 274 | sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 275 | sed -e 's/$/ :/' >> "$depfile" 276 | rm -f "$tmpdepfile" 277 | ;; 278 | 279 | tru64) 280 | # The Tru64 compiler uses -MD to generate dependencies as a side 281 | # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 282 | # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 283 | # dependencies in `foo.d' instead, so we check for that too. 284 | # Subdirectories are respected. 285 | dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 286 | test "x$dir" = "x$object" && dir= 287 | base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 288 | 289 | if test "$libtool" = yes; then 290 | # With Tru64 cc, shared objects can also be used to make a 291 | # static library. This mecanism is used in libtool 1.4 series to 292 | # handle both shared and static libraries in a single compilation. 293 | # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. 294 | # 295 | # With libtool 1.5 this exception was removed, and libtool now 296 | # generates 2 separate objects for the 2 libraries. These two 297 | # compilations output dependencies in in $dir.libs/$base.o.d and 298 | # in $dir$base.o.d. We have to check for both files, because 299 | # one of the two compilations can be disabled. We should prefer 300 | # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 301 | # automatically cleaned when .libs/ is deleted, while ignoring 302 | # the former would cause a distcleancheck panic. 303 | tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 304 | tmpdepfile2=$dir$base.o.d # libtool 1.5 305 | tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 306 | tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 307 | "$@" -Wc,-MD 308 | else 309 | tmpdepfile1=$dir$base.o.d 310 | tmpdepfile2=$dir$base.d 311 | tmpdepfile3=$dir$base.d 312 | tmpdepfile4=$dir$base.d 313 | "$@" -MD 314 | fi 315 | 316 | stat=$? 317 | if test $stat -eq 0; then : 318 | else 319 | rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 320 | exit $stat 321 | fi 322 | 323 | for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 324 | do 325 | test -f "$tmpdepfile" && break 326 | done 327 | if test -f "$tmpdepfile"; then 328 | sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 329 | # That's a tab and a space in the []. 330 | sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 331 | else 332 | echo "#dummy" > "$depfile" 333 | fi 334 | rm -f "$tmpdepfile" 335 | ;; 336 | 337 | #nosideeffect) 338 | # This comment above is used by automake to tell side-effect 339 | # dependency tracking mechanisms from slower ones. 340 | 341 | dashmstdout) 342 | # Important note: in order to support this mode, a compiler *must* 343 | # always write the preprocessed file to stdout, regardless of -o. 344 | "$@" || exit $? 345 | 346 | # Remove the call to Libtool. 347 | if test "$libtool" = yes; then 348 | while test $1 != '--mode=compile'; do 349 | shift 350 | done 351 | shift 352 | fi 353 | 354 | # Remove `-o $object'. 355 | IFS=" " 356 | for arg 357 | do 358 | case $arg in 359 | -o) 360 | shift 361 | ;; 362 | $object) 363 | shift 364 | ;; 365 | *) 366 | set fnord "$@" "$arg" 367 | shift # fnord 368 | shift # $arg 369 | ;; 370 | esac 371 | done 372 | 373 | test -z "$dashmflag" && dashmflag=-M 374 | # Require at least two characters before searching for `:' 375 | # in the target name. This is to cope with DOS-style filenames: 376 | # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 377 | "$@" $dashmflag | 378 | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 379 | rm -f "$depfile" 380 | cat < "$tmpdepfile" > "$depfile" 381 | tr ' ' ' 382 | ' < "$tmpdepfile" | \ 383 | ## Some versions of the HPUX 10.20 sed can't process this invocation 384 | ## correctly. Breaking it into two sed invocations is a workaround. 385 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 386 | rm -f "$tmpdepfile" 387 | ;; 388 | 389 | dashXmstdout) 390 | # This case only exists to satisfy depend.m4. It is never actually 391 | # run, as this mode is specially recognized in the preamble. 392 | exit 1 393 | ;; 394 | 395 | makedepend) 396 | "$@" || exit $? 397 | # Remove any Libtool call 398 | if test "$libtool" = yes; then 399 | while test $1 != '--mode=compile'; do 400 | shift 401 | done 402 | shift 403 | fi 404 | # X makedepend 405 | shift 406 | cleared=no 407 | for arg in "$@"; do 408 | case $cleared in 409 | no) 410 | set ""; shift 411 | cleared=yes ;; 412 | esac 413 | case "$arg" in 414 | -D*|-I*) 415 | set fnord "$@" "$arg"; shift ;; 416 | # Strip any option that makedepend may not understand. Remove 417 | # the object too, otherwise makedepend will parse it as a source file. 418 | -*|$object) 419 | ;; 420 | *) 421 | set fnord "$@" "$arg"; shift ;; 422 | esac 423 | done 424 | obj_suffix="`echo $object | sed 's/^.*\././'`" 425 | touch "$tmpdepfile" 426 | ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 427 | rm -f "$depfile" 428 | cat < "$tmpdepfile" > "$depfile" 429 | sed '1,2d' "$tmpdepfile" | tr ' ' ' 430 | ' | \ 431 | ## Some versions of the HPUX 10.20 sed can't process this invocation 432 | ## correctly. Breaking it into two sed invocations is a workaround. 433 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 434 | rm -f "$tmpdepfile" "$tmpdepfile".bak 435 | ;; 436 | 437 | cpp) 438 | # Important note: in order to support this mode, a compiler *must* 439 | # always write the preprocessed file to stdout. 440 | "$@" || exit $? 441 | 442 | # Remove the call to Libtool. 443 | if test "$libtool" = yes; then 444 | while test $1 != '--mode=compile'; do 445 | shift 446 | done 447 | shift 448 | fi 449 | 450 | # Remove `-o $object'. 451 | IFS=" " 452 | for arg 453 | do 454 | case $arg in 455 | -o) 456 | shift 457 | ;; 458 | $object) 459 | shift 460 | ;; 461 | *) 462 | set fnord "$@" "$arg" 463 | shift # fnord 464 | shift # $arg 465 | ;; 466 | esac 467 | done 468 | 469 | "$@" -E | 470 | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 471 | -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 472 | sed '$ s: \\$::' > "$tmpdepfile" 473 | rm -f "$depfile" 474 | echo "$object : \\" > "$depfile" 475 | cat < "$tmpdepfile" >> "$depfile" 476 | sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 477 | rm -f "$tmpdepfile" 478 | ;; 479 | 480 | msvisualcpp) 481 | # Important note: in order to support this mode, a compiler *must* 482 | # always write the preprocessed file to stdout, regardless of -o, 483 | # because we must use -o when running libtool. 484 | "$@" || exit $? 485 | IFS=" " 486 | for arg 487 | do 488 | case "$arg" in 489 | "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 490 | set fnord "$@" 491 | shift 492 | shift 493 | ;; 494 | *) 495 | set fnord "$@" "$arg" 496 | shift 497 | shift 498 | ;; 499 | esac 500 | done 501 | "$@" -E | 502 | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" 503 | rm -f "$depfile" 504 | echo "$object : \\" > "$depfile" 505 | . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 506 | echo " " >> "$depfile" 507 | . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" 508 | rm -f "$tmpdepfile" 509 | ;; 510 | 511 | none) 512 | exec "$@" 513 | ;; 514 | 515 | *) 516 | echo "Unknown depmode $depmode" 1>&2 517 | exit 1 518 | ;; 519 | esac 520 | 521 | exit 0 522 | 523 | # Local Variables: 524 | # mode: shell-script 525 | # sh-indentation: 2 526 | # eval: (add-hook 'write-file-hooks 'time-stamp) 527 | # time-stamp-start: "scriptversion=" 528 | # time-stamp-format: "%:y-%02m-%02d.%02H" 529 | # time-stamp-end: "$" 530 | # End: 531 | -------------------------------------------------------------------------------- /include/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | include_HEADERS = pcl.h 3 | 4 | -------------------------------------------------------------------------------- /include/Makefile.in: -------------------------------------------------------------------------------- 1 | # Makefile.in generated by automake 1.11.1 from Makefile.am. 2 | # @configure_input@ 3 | 4 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 5 | # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, 6 | # Inc. 7 | # This Makefile.in is free software; the Free Software Foundation 8 | # gives unlimited permission to copy and/or distribute it, 9 | # with or without modifications, as long as this notice is preserved. 10 | 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 13 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 14 | # PARTICULAR PURPOSE. 15 | 16 | @SET_MAKE@ 17 | 18 | VPATH = @srcdir@ 19 | pkgdatadir = $(datadir)/@PACKAGE@ 20 | pkgincludedir = $(includedir)/@PACKAGE@ 21 | pkglibdir = $(libdir)/@PACKAGE@ 22 | pkglibexecdir = $(libexecdir)/@PACKAGE@ 23 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 24 | install_sh_DATA = $(install_sh) -c -m 644 25 | install_sh_PROGRAM = $(install_sh) -c 26 | install_sh_SCRIPT = $(install_sh) -c 27 | INSTALL_HEADER = $(INSTALL_DATA) 28 | transform = $(program_transform_name) 29 | NORMAL_INSTALL = : 30 | PRE_INSTALL = : 31 | POST_INSTALL = : 32 | NORMAL_UNINSTALL = : 33 | PRE_UNINSTALL = : 34 | POST_UNINSTALL = : 35 | build_triplet = @build@ 36 | host_triplet = @host@ 37 | subdir = include 38 | DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \ 39 | $(srcdir)/Makefile.in 40 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 41 | am__aclocal_m4_deps = $(top_srcdir)/configure.in 42 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 43 | $(ACLOCAL_M4) 44 | mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 45 | CONFIG_HEADER = $(top_builddir)/config.h 46 | CONFIG_CLEAN_FILES = 47 | CONFIG_CLEAN_VPATH_FILES = 48 | SOURCES = 49 | DIST_SOURCES = 50 | am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; 51 | am__vpath_adj = case $$p in \ 52 | $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ 53 | *) f=$$p;; \ 54 | esac; 55 | am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; 56 | am__install_max = 40 57 | am__nobase_strip_setup = \ 58 | srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` 59 | am__nobase_strip = \ 60 | for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" 61 | am__nobase_list = $(am__nobase_strip_setup); \ 62 | for p in $$list; do echo "$$p $$p"; done | \ 63 | sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ 64 | $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ 65 | if (++n[$$2] == $(am__install_max)) \ 66 | { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ 67 | END { for (dir in files) print dir, files[dir] }' 68 | am__base_list = \ 69 | sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ 70 | sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' 71 | am__installdirs = "$(DESTDIR)$(includedir)" 72 | HEADERS = $(include_HEADERS) 73 | ETAGS = etags 74 | CTAGS = ctags 75 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 76 | ACLOCAL = @ACLOCAL@ 77 | AMTAR = @AMTAR@ 78 | AR = @AR@ 79 | AUTOCONF = @AUTOCONF@ 80 | AUTOHEADER = @AUTOHEADER@ 81 | AUTOMAKE = @AUTOMAKE@ 82 | AWK = @AWK@ 83 | CC = @CC@ 84 | CCDEPMODE = @CCDEPMODE@ 85 | CFLAGS = @CFLAGS@ 86 | CPP = @CPP@ 87 | CPPFLAGS = @CPPFLAGS@ 88 | CYGPATH_W = @CYGPATH_W@ 89 | DEFS = @DEFS@ 90 | DEPDIR = @DEPDIR@ 91 | DSYMUTIL = @DSYMUTIL@ 92 | DUMPBIN = @DUMPBIN@ 93 | ECHO_C = @ECHO_C@ 94 | ECHO_N = @ECHO_N@ 95 | ECHO_T = @ECHO_T@ 96 | EGREP = @EGREP@ 97 | EXEEXT = @EXEEXT@ 98 | FGREP = @FGREP@ 99 | GREP = @GREP@ 100 | INSTALL = @INSTALL@ 101 | INSTALL_DATA = @INSTALL_DATA@ 102 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ 103 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ 104 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 105 | LD = @LD@ 106 | LDFLAGS = @LDFLAGS@ 107 | LIBOBJS = @LIBOBJS@ 108 | LIBS = @LIBS@ 109 | LIBTOOL = @LIBTOOL@ 110 | LIPO = @LIPO@ 111 | LN_S = @LN_S@ 112 | LTLIBOBJS = @LTLIBOBJS@ 113 | MAKEINFO = @MAKEINFO@ 114 | MKDIR_P = @MKDIR_P@ 115 | NM = @NM@ 116 | NMEDIT = @NMEDIT@ 117 | OBJDUMP = @OBJDUMP@ 118 | OBJEXT = @OBJEXT@ 119 | OTOOL = @OTOOL@ 120 | OTOOL64 = @OTOOL64@ 121 | PACKAGE = @PACKAGE@ 122 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ 123 | PACKAGE_NAME = @PACKAGE_NAME@ 124 | PACKAGE_STRING = @PACKAGE_STRING@ 125 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ 126 | PACKAGE_URL = @PACKAGE_URL@ 127 | PACKAGE_VERSION = @PACKAGE_VERSION@ 128 | PATH_SEPARATOR = @PATH_SEPARATOR@ 129 | RANLIB = @RANLIB@ 130 | SED = @SED@ 131 | SET_MAKE = @SET_MAKE@ 132 | SHELL = @SHELL@ 133 | STRIP = @STRIP@ 134 | VERSION = @VERSION@ 135 | abs_builddir = @abs_builddir@ 136 | abs_srcdir = @abs_srcdir@ 137 | abs_top_builddir = @abs_top_builddir@ 138 | abs_top_srcdir = @abs_top_srcdir@ 139 | ac_ct_CC = @ac_ct_CC@ 140 | ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ 141 | am__include = @am__include@ 142 | am__leading_dot = @am__leading_dot@ 143 | am__quote = @am__quote@ 144 | am__tar = @am__tar@ 145 | am__untar = @am__untar@ 146 | bindir = @bindir@ 147 | build = @build@ 148 | build_alias = @build_alias@ 149 | build_cpu = @build_cpu@ 150 | build_os = @build_os@ 151 | build_vendor = @build_vendor@ 152 | builddir = @builddir@ 153 | datadir = @datadir@ 154 | datarootdir = @datarootdir@ 155 | docdir = @docdir@ 156 | dvidir = @dvidir@ 157 | exec_prefix = @exec_prefix@ 158 | host = @host@ 159 | host_alias = @host_alias@ 160 | host_cpu = @host_cpu@ 161 | host_os = @host_os@ 162 | host_vendor = @host_vendor@ 163 | htmldir = @htmldir@ 164 | includedir = @includedir@ 165 | infodir = @infodir@ 166 | install_sh = @install_sh@ 167 | libdir = @libdir@ 168 | libexecdir = @libexecdir@ 169 | localedir = @localedir@ 170 | localstatedir = @localstatedir@ 171 | lt_ECHO = @lt_ECHO@ 172 | mandir = @mandir@ 173 | mkdir_p = @mkdir_p@ 174 | oldincludedir = @oldincludedir@ 175 | pdfdir = @pdfdir@ 176 | prefix = @prefix@ 177 | program_transform_name = @program_transform_name@ 178 | psdir = @psdir@ 179 | sbindir = @sbindir@ 180 | sharedstatedir = @sharedstatedir@ 181 | srcdir = @srcdir@ 182 | sysconfdir = @sysconfdir@ 183 | target_alias = @target_alias@ 184 | top_build_prefix = @top_build_prefix@ 185 | top_builddir = @top_builddir@ 186 | top_srcdir = @top_srcdir@ 187 | include_HEADERS = pcl.h 188 | all: all-am 189 | 190 | .SUFFIXES: 191 | $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) 192 | @for dep in $?; do \ 193 | case '$(am__configure_deps)' in \ 194 | *$$dep*) \ 195 | ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ 196 | && { if test -f $@; then exit 0; else break; fi; }; \ 197 | exit 1;; \ 198 | esac; \ 199 | done; \ 200 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/Makefile'; \ 201 | $(am__cd) $(top_srcdir) && \ 202 | $(AUTOMAKE) --gnu include/Makefile 203 | .PRECIOUS: Makefile 204 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 205 | @case '$?' in \ 206 | *config.status*) \ 207 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ 208 | *) \ 209 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ 210 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 211 | esac; 212 | 213 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) 214 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 215 | 216 | $(top_srcdir)/configure: $(am__configure_deps) 217 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 218 | $(ACLOCAL_M4): $(am__aclocal_m4_deps) 219 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 220 | $(am__aclocal_m4_deps): 221 | 222 | mostlyclean-libtool: 223 | -rm -f *.lo 224 | 225 | clean-libtool: 226 | -rm -rf .libs _libs 227 | install-includeHEADERS: $(include_HEADERS) 228 | @$(NORMAL_INSTALL) 229 | test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)" 230 | @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ 231 | for p in $$list; do \ 232 | if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ 233 | echo "$$d$$p"; \ 234 | done | $(am__base_list) | \ 235 | while read files; do \ 236 | echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ 237 | $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ 238 | done 239 | 240 | uninstall-includeHEADERS: 241 | @$(NORMAL_UNINSTALL) 242 | @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ 243 | files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ 244 | test -n "$$files" || exit 0; \ 245 | echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \ 246 | cd "$(DESTDIR)$(includedir)" && rm -f $$files 247 | 248 | ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) 249 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 250 | unique=`for i in $$list; do \ 251 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 252 | done | \ 253 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ 254 | END { if (nonempty) { for (i in files) print i; }; }'`; \ 255 | mkid -fID $$unique 256 | tags: TAGS 257 | 258 | TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ 259 | $(TAGS_FILES) $(LISP) 260 | set x; \ 261 | here=`pwd`; \ 262 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 263 | unique=`for i in $$list; do \ 264 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 265 | done | \ 266 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ 267 | END { if (nonempty) { for (i in files) print i; }; }'`; \ 268 | shift; \ 269 | if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ 270 | test -n "$$unique" || unique=$$empty_fix; \ 271 | if test $$# -gt 0; then \ 272 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 273 | "$$@" $$unique; \ 274 | else \ 275 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 276 | $$unique; \ 277 | fi; \ 278 | fi 279 | ctags: CTAGS 280 | CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ 281 | $(TAGS_FILES) $(LISP) 282 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 283 | unique=`for i in $$list; do \ 284 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 285 | done | \ 286 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ 287 | END { if (nonempty) { for (i in files) print i; }; }'`; \ 288 | test -z "$(CTAGS_ARGS)$$unique" \ 289 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ 290 | $$unique 291 | 292 | GTAGS: 293 | here=`$(am__cd) $(top_builddir) && pwd` \ 294 | && $(am__cd) $(top_srcdir) \ 295 | && gtags -i $(GTAGS_ARGS) "$$here" 296 | 297 | distclean-tags: 298 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags 299 | 300 | distdir: $(DISTFILES) 301 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 302 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 303 | list='$(DISTFILES)'; \ 304 | dist_files=`for file in $$list; do echo $$file; done | \ 305 | sed -e "s|^$$srcdirstrip/||;t" \ 306 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ 307 | case $$dist_files in \ 308 | */*) $(MKDIR_P) `echo "$$dist_files" | \ 309 | sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ 310 | sort -u` ;; \ 311 | esac; \ 312 | for file in $$dist_files; do \ 313 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ 314 | if test -d $$d/$$file; then \ 315 | dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ 316 | if test -d "$(distdir)/$$file"; then \ 317 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 318 | fi; \ 319 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ 320 | cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ 321 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 322 | fi; \ 323 | cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ 324 | else \ 325 | test -f "$(distdir)/$$file" \ 326 | || cp -p $$d/$$file "$(distdir)/$$file" \ 327 | || exit 1; \ 328 | fi; \ 329 | done 330 | check-am: all-am 331 | check: check-am 332 | all-am: Makefile $(HEADERS) 333 | installdirs: 334 | for dir in "$(DESTDIR)$(includedir)"; do \ 335 | test -z "$$dir" || $(MKDIR_P) "$$dir"; \ 336 | done 337 | install: install-am 338 | install-exec: install-exec-am 339 | install-data: install-data-am 340 | uninstall: uninstall-am 341 | 342 | install-am: all-am 343 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am 344 | 345 | installcheck: installcheck-am 346 | install-strip: 347 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 348 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 349 | `test -z '$(STRIP)' || \ 350 | echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install 351 | mostlyclean-generic: 352 | 353 | clean-generic: 354 | 355 | distclean-generic: 356 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) 357 | -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) 358 | 359 | maintainer-clean-generic: 360 | @echo "This command is intended for maintainers to use" 361 | @echo "it deletes files that may require special tools to rebuild." 362 | clean: clean-am 363 | 364 | clean-am: clean-generic clean-libtool mostlyclean-am 365 | 366 | distclean: distclean-am 367 | -rm -f Makefile 368 | distclean-am: clean-am distclean-generic distclean-tags 369 | 370 | dvi: dvi-am 371 | 372 | dvi-am: 373 | 374 | html: html-am 375 | 376 | html-am: 377 | 378 | info: info-am 379 | 380 | info-am: 381 | 382 | install-data-am: install-includeHEADERS 383 | 384 | install-dvi: install-dvi-am 385 | 386 | install-dvi-am: 387 | 388 | install-exec-am: 389 | 390 | install-html: install-html-am 391 | 392 | install-html-am: 393 | 394 | install-info: install-info-am 395 | 396 | install-info-am: 397 | 398 | install-man: 399 | 400 | install-pdf: install-pdf-am 401 | 402 | install-pdf-am: 403 | 404 | install-ps: install-ps-am 405 | 406 | install-ps-am: 407 | 408 | installcheck-am: 409 | 410 | maintainer-clean: maintainer-clean-am 411 | -rm -f Makefile 412 | maintainer-clean-am: distclean-am maintainer-clean-generic 413 | 414 | mostlyclean: mostlyclean-am 415 | 416 | mostlyclean-am: mostlyclean-generic mostlyclean-libtool 417 | 418 | pdf: pdf-am 419 | 420 | pdf-am: 421 | 422 | ps: ps-am 423 | 424 | ps-am: 425 | 426 | uninstall-am: uninstall-includeHEADERS 427 | 428 | .MAKE: install-am install-strip 429 | 430 | .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ 431 | clean-libtool ctags distclean distclean-generic \ 432 | distclean-libtool distclean-tags distdir dvi dvi-am html \ 433 | html-am info info-am install install-am install-data \ 434 | install-data-am install-dvi install-dvi-am install-exec \ 435 | install-exec-am install-html install-html-am \ 436 | install-includeHEADERS install-info install-info-am \ 437 | install-man install-pdf install-pdf-am install-ps \ 438 | install-ps-am install-strip installcheck installcheck-am \ 439 | installdirs maintainer-clean maintainer-clean-generic \ 440 | mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ 441 | ps ps-am tags uninstall uninstall-am uninstall-includeHEADERS 442 | 443 | 444 | # Tell versions [3.59,3.63) of GNU make to not export all variables. 445 | # Otherwise a system limit (for SysV at least) may be exceeded. 446 | .NOEXPORT: 447 | -------------------------------------------------------------------------------- /include/pcl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PCL by Davide Libenzi (Portable Coroutine Library) 3 | * Copyright (C) 2003..2010 Davide Libenzi 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | * Davide Libenzi 20 | * 21 | */ 22 | 23 | #if !defined(PCL_H) 24 | #define PCL_H 25 | 26 | #ifdef __cplusplus 27 | #define PCLXC extern "C" 28 | #else 29 | #define PCLXC 30 | #endif 31 | 32 | typedef void *coroutine_t; 33 | 34 | PCLXC int co_thread_init(void); 35 | PCLXC void co_thread_cleanup(void); 36 | 37 | PCLXC coroutine_t co_create(void (*func)(void *), void *data, void *stack, 38 | int size); 39 | PCLXC void co_delete(coroutine_t coro); 40 | PCLXC void co_call(coroutine_t coro); 41 | PCLXC void co_resume(void); 42 | PCLXC void co_exit_to(coroutine_t coro); 43 | PCLXC void co_exit(void); 44 | PCLXC coroutine_t co_current(void); 45 | PCLXC void *co_get_data(coroutine_t coro); 46 | PCLXC void *co_set_data(coroutine_t coro, void *data); 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /include/pcl_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PCL by Davide Libenzi (Portable Coroutine Library) 3 | * Copyright (C) 2003..2010 Davide Libenzi 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | * Davide Libenzi 20 | * 21 | */ 22 | 23 | #if !defined(PCL_CONFIG_H) 24 | #define PCL_CONFIG_H 25 | 26 | #if defined(HAVE_CONFIG_H) 27 | #include "config.h" 28 | #elif defined(HAVE_WINCONFIG_H) 29 | #include "winconfig.h" 30 | #endif /* #if defined(HAVE_CONFIG_H) */ 31 | 32 | #if defined(__APPLE__) 33 | /* 34 | * Need to use setjmp/longjmp on OSX, since the ucontext bits are 35 | * both broken and deprecated. 36 | */ 37 | #define CO_MULTI_THREAD 38 | 39 | #elif defined(HAVE_GETCONTEXT) && defined(HAVE_MAKECONTEXT) && defined(HAVE_SWAPCONTEXT) 40 | 41 | /* 42 | * Use this if the system has a working getcontext/makecontext/swapcontext 43 | * implementation. 44 | */ 45 | #define CO_USE_UCONEXT 46 | /* 47 | * Use threads. 48 | */ 49 | #define CO_MULTI_THREAD 50 | 51 | #elif defined(HAVE_SIGACTION) 52 | 53 | /* 54 | * Use this to have the generic signal implementation (not working on 55 | * Windows). Suggested on generic Unix implementations or on Linux with 56 | * CPU different from x86 family. 57 | */ 58 | #define CO_USE_SIGCONTEXT 59 | 60 | /* 61 | * Use this in conjuction with CO_USE_SIGCONTEXT to use the sigaltstack 62 | * environment (suggested when CO_USE_SIGCONTEXT is defined). 63 | */ 64 | #if defined(HAVE_SIGALTSTACK) 65 | #define CO_HAS_SIGALTSTACK 66 | #endif 67 | 68 | #else 69 | /* 70 | * This will be using setjmp/longjmp 71 | */ 72 | 73 | /* 74 | * Use threads. 75 | */ 76 | #define CO_MULTI_THREAD 77 | 78 | #endif 79 | 80 | #endif 81 | 82 | -------------------------------------------------------------------------------- /include/pcl_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PCL by Davide Libenzi (Portable Coroutine Library) 3 | * Copyright (C) 2003..2010 Davide Libenzi 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | * Davide Libenzi 20 | * 21 | */ 22 | 23 | #if !defined(PCL_PRIVATE_H) 24 | #define PCL_PRIVATE_H 25 | 26 | #include 27 | #include 28 | #include "pcl_config.h" 29 | #include "pcl.h" 30 | 31 | #if defined(CO_USE_UCONEXT) 32 | #include 33 | 34 | typedef ucontext_t co_core_ctx_t; 35 | #else 36 | #include 37 | 38 | typedef jmp_buf co_core_ctx_t; 39 | #endif 40 | 41 | /* 42 | * The following value must be power of two (N^2). 43 | */ 44 | #define CO_STK_ALIGN 256 45 | #define CO_STK_COROSIZE ((sizeof(coroutine) + CO_STK_ALIGN - 1) & ~(CO_STK_ALIGN - 1)) 46 | #define CO_MIN_SIZE (4 * 1024) 47 | 48 | typedef struct s_co_ctx { 49 | co_core_ctx_t cc; 50 | } co_ctx_t; 51 | 52 | typedef struct s_coroutine { 53 | co_ctx_t ctx; 54 | int alloc; 55 | struct s_coroutine *caller; 56 | struct s_coroutine *restarget; 57 | void (*func)(void *); 58 | void *data; 59 | } coroutine; 60 | 61 | typedef struct s_cothread_ctx { 62 | coroutine co_main; 63 | coroutine *co_curr; 64 | coroutine *co_dhelper; 65 | coroutine *dchelper; 66 | char stk[CO_MIN_SIZE]; 67 | } cothread_ctx; 68 | 69 | cothread_ctx *co_get_thread_ctx(void); 70 | 71 | #endif 72 | 73 | -------------------------------------------------------------------------------- /install-sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # install - install a program, script, or datafile 3 | 4 | scriptversion=2005-05-14.22 5 | 6 | # This originates from X11R5 (mit/util/scripts/install.sh), which was 7 | # later released in X11R6 (xc/config/util/install.sh) with the 8 | # following copyright and license. 9 | # 10 | # Copyright (C) 1994 X Consortium 11 | # 12 | # Permission is hereby granted, free of charge, to any person obtaining a copy 13 | # of this software and associated documentation files (the "Software"), to 14 | # deal in the Software without restriction, including without limitation the 15 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 16 | # sell copies of the Software, and to permit persons to whom the Software is 17 | # furnished to do so, subject to the following conditions: 18 | # 19 | # The above copyright notice and this permission notice shall be included in 20 | # all copies or substantial portions of the Software. 21 | # 22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 26 | # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- 27 | # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | # 29 | # Except as contained in this notice, the name of the X Consortium shall not 30 | # be used in advertising or otherwise to promote the sale, use or other deal- 31 | # ings in this Software without prior written authorization from the X Consor- 32 | # tium. 33 | # 34 | # 35 | # FSF changes to this file are in the public domain. 36 | # 37 | # Calling this script install-sh is preferred over install.sh, to prevent 38 | # `make' implicit rules from creating a file called install from it 39 | # when there is no Makefile. 40 | # 41 | # This script is compatible with the BSD install script, but was written 42 | # from scratch. It can only install one file at a time, a restriction 43 | # shared with many OS's install programs. 44 | 45 | # set DOITPROG to echo to test this script 46 | 47 | # Don't use :- since 4.3BSD and earlier shells don't like it. 48 | doit="${DOITPROG-}" 49 | 50 | # put in absolute paths if you don't have them in your path; or use env. vars. 51 | 52 | mvprog="${MVPROG-mv}" 53 | cpprog="${CPPROG-cp}" 54 | chmodprog="${CHMODPROG-chmod}" 55 | chownprog="${CHOWNPROG-chown}" 56 | chgrpprog="${CHGRPPROG-chgrp}" 57 | stripprog="${STRIPPROG-strip}" 58 | rmprog="${RMPROG-rm}" 59 | mkdirprog="${MKDIRPROG-mkdir}" 60 | 61 | chmodcmd="$chmodprog 0755" 62 | chowncmd= 63 | chgrpcmd= 64 | stripcmd= 65 | rmcmd="$rmprog -f" 66 | mvcmd="$mvprog" 67 | src= 68 | dst= 69 | dir_arg= 70 | dstarg= 71 | no_target_directory= 72 | 73 | usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE 74 | or: $0 [OPTION]... SRCFILES... DIRECTORY 75 | or: $0 [OPTION]... -t DIRECTORY SRCFILES... 76 | or: $0 [OPTION]... -d DIRECTORIES... 77 | 78 | In the 1st form, copy SRCFILE to DSTFILE. 79 | In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. 80 | In the 4th, create DIRECTORIES. 81 | 82 | Options: 83 | -c (ignored) 84 | -d create directories instead of installing files. 85 | -g GROUP $chgrpprog installed files to GROUP. 86 | -m MODE $chmodprog installed files to MODE. 87 | -o USER $chownprog installed files to USER. 88 | -s $stripprog installed files. 89 | -t DIRECTORY install into DIRECTORY. 90 | -T report an error if DSTFILE is a directory. 91 | --help display this help and exit. 92 | --version display version info and exit. 93 | 94 | Environment variables override the default commands: 95 | CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG 96 | " 97 | 98 | while test -n "$1"; do 99 | case $1 in 100 | -c) shift 101 | continue;; 102 | 103 | -d) dir_arg=true 104 | shift 105 | continue;; 106 | 107 | -g) chgrpcmd="$chgrpprog $2" 108 | shift 109 | shift 110 | continue;; 111 | 112 | --help) echo "$usage"; exit $?;; 113 | 114 | -m) chmodcmd="$chmodprog $2" 115 | shift 116 | shift 117 | continue;; 118 | 119 | -o) chowncmd="$chownprog $2" 120 | shift 121 | shift 122 | continue;; 123 | 124 | -s) stripcmd=$stripprog 125 | shift 126 | continue;; 127 | 128 | -t) dstarg=$2 129 | shift 130 | shift 131 | continue;; 132 | 133 | -T) no_target_directory=true 134 | shift 135 | continue;; 136 | 137 | --version) echo "$0 $scriptversion"; exit $?;; 138 | 139 | *) # When -d is used, all remaining arguments are directories to create. 140 | # When -t is used, the destination is already specified. 141 | test -n "$dir_arg$dstarg" && break 142 | # Otherwise, the last argument is the destination. Remove it from $@. 143 | for arg 144 | do 145 | if test -n "$dstarg"; then 146 | # $@ is not empty: it contains at least $arg. 147 | set fnord "$@" "$dstarg" 148 | shift # fnord 149 | fi 150 | shift # arg 151 | dstarg=$arg 152 | done 153 | break;; 154 | esac 155 | done 156 | 157 | if test -z "$1"; then 158 | if test -z "$dir_arg"; then 159 | echo "$0: no input file specified." >&2 160 | exit 1 161 | fi 162 | # It's OK to call `install-sh -d' without argument. 163 | # This can happen when creating conditional directories. 164 | exit 0 165 | fi 166 | 167 | for src 168 | do 169 | # Protect names starting with `-'. 170 | case $src in 171 | -*) src=./$src ;; 172 | esac 173 | 174 | if test -n "$dir_arg"; then 175 | dst=$src 176 | src= 177 | 178 | if test -d "$dst"; then 179 | mkdircmd=: 180 | chmodcmd= 181 | else 182 | mkdircmd=$mkdirprog 183 | fi 184 | else 185 | # Waiting for this to be detected by the "$cpprog $src $dsttmp" command 186 | # might cause directories to be created, which would be especially bad 187 | # if $src (and thus $dsttmp) contains '*'. 188 | if test ! -f "$src" && test ! -d "$src"; then 189 | echo "$0: $src does not exist." >&2 190 | exit 1 191 | fi 192 | 193 | if test -z "$dstarg"; then 194 | echo "$0: no destination specified." >&2 195 | exit 1 196 | fi 197 | 198 | dst=$dstarg 199 | # Protect names starting with `-'. 200 | case $dst in 201 | -*) dst=./$dst ;; 202 | esac 203 | 204 | # If destination is a directory, append the input filename; won't work 205 | # if double slashes aren't ignored. 206 | if test -d "$dst"; then 207 | if test -n "$no_target_directory"; then 208 | echo "$0: $dstarg: Is a directory" >&2 209 | exit 1 210 | fi 211 | dst=$dst/`basename "$src"` 212 | fi 213 | fi 214 | 215 | # This sed command emulates the dirname command. 216 | dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` 217 | 218 | # Make sure that the destination directory exists. 219 | 220 | # Skip lots of stat calls in the usual case. 221 | if test ! -d "$dstdir"; then 222 | defaultIFS=' 223 | ' 224 | IFS="${IFS-$defaultIFS}" 225 | 226 | oIFS=$IFS 227 | # Some sh's can't handle IFS=/ for some reason. 228 | IFS='%' 229 | set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` 230 | shift 231 | IFS=$oIFS 232 | 233 | pathcomp= 234 | 235 | while test $# -ne 0 ; do 236 | pathcomp=$pathcomp$1 237 | shift 238 | if test ! -d "$pathcomp"; then 239 | $mkdirprog "$pathcomp" 240 | # mkdir can fail with a `File exist' error in case several 241 | # install-sh are creating the directory concurrently. This 242 | # is OK. 243 | test -d "$pathcomp" || exit 244 | fi 245 | pathcomp=$pathcomp/ 246 | done 247 | fi 248 | 249 | if test -n "$dir_arg"; then 250 | $doit $mkdircmd "$dst" \ 251 | && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ 252 | && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ 253 | && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ 254 | && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } 255 | 256 | else 257 | dstfile=`basename "$dst"` 258 | 259 | # Make a couple of temp file names in the proper directory. 260 | dsttmp=$dstdir/_inst.$$_ 261 | rmtmp=$dstdir/_rm.$$_ 262 | 263 | # Trap to clean up those temp files at exit. 264 | trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 265 | trap '(exit $?); exit' 1 2 13 15 266 | 267 | # Copy the file name to the temp name. 268 | $doit $cpprog "$src" "$dsttmp" && 269 | 270 | # and set any options; do chmod last to preserve setuid bits. 271 | # 272 | # If any of these fail, we abort the whole thing. If we want to 273 | # ignore errors from any of these, just make sure not to ignore 274 | # errors from the above "$doit $cpprog $src $dsttmp" command. 275 | # 276 | { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ 277 | && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ 278 | && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ 279 | && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && 280 | 281 | # Now rename the file to the real destination. 282 | { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ 283 | || { 284 | # The rename failed, perhaps because mv can't rename something else 285 | # to itself, or perhaps because mv is so ancient that it does not 286 | # support -f. 287 | 288 | # Now remove or move aside any old file at destination location. 289 | # We try this two ways since rm can't unlink itself on some 290 | # systems and the destination file might be busy for other 291 | # reasons. In this case, the final cleanup might fail but the new 292 | # file should still install successfully. 293 | { 294 | if test -f "$dstdir/$dstfile"; then 295 | $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ 296 | || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ 297 | || { 298 | echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 299 | (exit 1); exit 1 300 | } 301 | else 302 | : 303 | fi 304 | } && 305 | 306 | # Now rename the file to the real destination. 307 | $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" 308 | } 309 | } 310 | fi || { (exit 1); exit 1; } 311 | done 312 | 313 | # The final little trick to "correctly" pass the exit status to the exit trap. 314 | { 315 | (exit 0); exit 0 316 | } 317 | 318 | # Local variables: 319 | # eval: (add-hook 'write-file-hooks 'time-stamp) 320 | # time-stamp-start: "scriptversion=" 321 | # time-stamp-format: "%:y-%02m-%02d.%02H" 322 | # time-stamp-end: "$" 323 | # End: 324 | -------------------------------------------------------------------------------- /m4/ltoptions.m4: -------------------------------------------------------------------------------- 1 | # Helper functions for option handling. -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. 4 | # Written by Gary V. Vaughan, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # serial 6 ltoptions.m4 11 | 12 | # This is to help aclocal find these macros, as it can't see m4_define. 13 | AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) 14 | 15 | 16 | # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) 17 | # ------------------------------------------ 18 | m4_define([_LT_MANGLE_OPTION], 19 | [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) 20 | 21 | 22 | # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) 23 | # --------------------------------------- 24 | # Set option OPTION-NAME for macro MACRO-NAME, and if there is a 25 | # matching handler defined, dispatch to it. Other OPTION-NAMEs are 26 | # saved as a flag. 27 | m4_define([_LT_SET_OPTION], 28 | [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl 29 | m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), 30 | _LT_MANGLE_DEFUN([$1], [$2]), 31 | [m4_warning([Unknown $1 option `$2'])])[]dnl 32 | ]) 33 | 34 | 35 | # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) 36 | # ------------------------------------------------------------ 37 | # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. 38 | m4_define([_LT_IF_OPTION], 39 | [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) 40 | 41 | 42 | # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) 43 | # ------------------------------------------------------- 44 | # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME 45 | # are set. 46 | m4_define([_LT_UNLESS_OPTIONS], 47 | [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), 48 | [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), 49 | [m4_define([$0_found])])])[]dnl 50 | m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 51 | ])[]dnl 52 | ]) 53 | 54 | 55 | # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) 56 | # ---------------------------------------- 57 | # OPTION-LIST is a space-separated list of Libtool options associated 58 | # with MACRO-NAME. If any OPTION has a matching handler declared with 59 | # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about 60 | # the unknown option and exit. 61 | m4_defun([_LT_SET_OPTIONS], 62 | [# Set options 63 | m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), 64 | [_LT_SET_OPTION([$1], _LT_Option)]) 65 | 66 | m4_if([$1],[LT_INIT],[ 67 | dnl 68 | dnl Simply set some default values (i.e off) if boolean options were not 69 | dnl specified: 70 | _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no 71 | ]) 72 | _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no 73 | ]) 74 | dnl 75 | dnl If no reference was made to various pairs of opposing options, then 76 | dnl we run the default mode handler for the pair. For example, if neither 77 | dnl `shared' nor `disable-shared' was passed, we enable building of shared 78 | dnl archives by default: 79 | _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) 80 | _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) 81 | _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) 82 | _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], 83 | [_LT_ENABLE_FAST_INSTALL]) 84 | ]) 85 | ])# _LT_SET_OPTIONS 86 | 87 | 88 | ## --------------------------------- ## 89 | ## Macros to handle LT_INIT options. ## 90 | ## --------------------------------- ## 91 | 92 | # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) 93 | # ----------------------------------------- 94 | m4_define([_LT_MANGLE_DEFUN], 95 | [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) 96 | 97 | 98 | # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) 99 | # ----------------------------------------------- 100 | m4_define([LT_OPTION_DEFINE], 101 | [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl 102 | ])# LT_OPTION_DEFINE 103 | 104 | 105 | # dlopen 106 | # ------ 107 | LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes 108 | ]) 109 | 110 | AU_DEFUN([AC_LIBTOOL_DLOPEN], 111 | [_LT_SET_OPTION([LT_INIT], [dlopen]) 112 | AC_DIAGNOSE([obsolete], 113 | [$0: Remove this warning and the call to _LT_SET_OPTION when you 114 | put the `dlopen' option into LT_INIT's first parameter.]) 115 | ]) 116 | 117 | dnl aclocal-1.4 backwards compatibility: 118 | dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) 119 | 120 | 121 | # win32-dll 122 | # --------- 123 | # Declare package support for building win32 dll's. 124 | LT_OPTION_DEFINE([LT_INIT], [win32-dll], 125 | [enable_win32_dll=yes 126 | 127 | case $host in 128 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*) 129 | AC_CHECK_TOOL(AS, as, false) 130 | AC_CHECK_TOOL(DLLTOOL, dlltool, false) 131 | AC_CHECK_TOOL(OBJDUMP, objdump, false) 132 | ;; 133 | esac 134 | 135 | test -z "$AS" && AS=as 136 | _LT_DECL([], [AS], [0], [Assembler program])dnl 137 | 138 | test -z "$DLLTOOL" && DLLTOOL=dlltool 139 | _LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl 140 | 141 | test -z "$OBJDUMP" && OBJDUMP=objdump 142 | _LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl 143 | ])# win32-dll 144 | 145 | AU_DEFUN([AC_LIBTOOL_WIN32_DLL], 146 | [AC_REQUIRE([AC_CANONICAL_HOST])dnl 147 | _LT_SET_OPTION([LT_INIT], [win32-dll]) 148 | AC_DIAGNOSE([obsolete], 149 | [$0: Remove this warning and the call to _LT_SET_OPTION when you 150 | put the `win32-dll' option into LT_INIT's first parameter.]) 151 | ]) 152 | 153 | dnl aclocal-1.4 backwards compatibility: 154 | dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) 155 | 156 | 157 | # _LT_ENABLE_SHARED([DEFAULT]) 158 | # ---------------------------- 159 | # implement the --enable-shared flag, and supports the `shared' and 160 | # `disable-shared' LT_INIT options. 161 | # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. 162 | m4_define([_LT_ENABLE_SHARED], 163 | [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl 164 | AC_ARG_ENABLE([shared], 165 | [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], 166 | [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], 167 | [p=${PACKAGE-default} 168 | case $enableval in 169 | yes) enable_shared=yes ;; 170 | no) enable_shared=no ;; 171 | *) 172 | enable_shared=no 173 | # Look at the argument we got. We use all the common list separators. 174 | lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," 175 | for pkg in $enableval; do 176 | IFS="$lt_save_ifs" 177 | if test "X$pkg" = "X$p"; then 178 | enable_shared=yes 179 | fi 180 | done 181 | IFS="$lt_save_ifs" 182 | ;; 183 | esac], 184 | [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) 185 | 186 | _LT_DECL([build_libtool_libs], [enable_shared], [0], 187 | [Whether or not to build shared libraries]) 188 | ])# _LT_ENABLE_SHARED 189 | 190 | LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) 191 | LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) 192 | 193 | # Old names: 194 | AC_DEFUN([AC_ENABLE_SHARED], 195 | [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) 196 | ]) 197 | 198 | AC_DEFUN([AC_DISABLE_SHARED], 199 | [_LT_SET_OPTION([LT_INIT], [disable-shared]) 200 | ]) 201 | 202 | AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) 203 | AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) 204 | 205 | dnl aclocal-1.4 backwards compatibility: 206 | dnl AC_DEFUN([AM_ENABLE_SHARED], []) 207 | dnl AC_DEFUN([AM_DISABLE_SHARED], []) 208 | 209 | 210 | 211 | # _LT_ENABLE_STATIC([DEFAULT]) 212 | # ---------------------------- 213 | # implement the --enable-static flag, and support the `static' and 214 | # `disable-static' LT_INIT options. 215 | # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. 216 | m4_define([_LT_ENABLE_STATIC], 217 | [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl 218 | AC_ARG_ENABLE([static], 219 | [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], 220 | [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], 221 | [p=${PACKAGE-default} 222 | case $enableval in 223 | yes) enable_static=yes ;; 224 | no) enable_static=no ;; 225 | *) 226 | enable_static=no 227 | # Look at the argument we got. We use all the common list separators. 228 | lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," 229 | for pkg in $enableval; do 230 | IFS="$lt_save_ifs" 231 | if test "X$pkg" = "X$p"; then 232 | enable_static=yes 233 | fi 234 | done 235 | IFS="$lt_save_ifs" 236 | ;; 237 | esac], 238 | [enable_static=]_LT_ENABLE_STATIC_DEFAULT) 239 | 240 | _LT_DECL([build_old_libs], [enable_static], [0], 241 | [Whether or not to build static libraries]) 242 | ])# _LT_ENABLE_STATIC 243 | 244 | LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) 245 | LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) 246 | 247 | # Old names: 248 | AC_DEFUN([AC_ENABLE_STATIC], 249 | [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) 250 | ]) 251 | 252 | AC_DEFUN([AC_DISABLE_STATIC], 253 | [_LT_SET_OPTION([LT_INIT], [disable-static]) 254 | ]) 255 | 256 | AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) 257 | AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) 258 | 259 | dnl aclocal-1.4 backwards compatibility: 260 | dnl AC_DEFUN([AM_ENABLE_STATIC], []) 261 | dnl AC_DEFUN([AM_DISABLE_STATIC], []) 262 | 263 | 264 | 265 | # _LT_ENABLE_FAST_INSTALL([DEFAULT]) 266 | # ---------------------------------- 267 | # implement the --enable-fast-install flag, and support the `fast-install' 268 | # and `disable-fast-install' LT_INIT options. 269 | # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. 270 | m4_define([_LT_ENABLE_FAST_INSTALL], 271 | [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl 272 | AC_ARG_ENABLE([fast-install], 273 | [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], 274 | [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], 275 | [p=${PACKAGE-default} 276 | case $enableval in 277 | yes) enable_fast_install=yes ;; 278 | no) enable_fast_install=no ;; 279 | *) 280 | enable_fast_install=no 281 | # Look at the argument we got. We use all the common list separators. 282 | lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," 283 | for pkg in $enableval; do 284 | IFS="$lt_save_ifs" 285 | if test "X$pkg" = "X$p"; then 286 | enable_fast_install=yes 287 | fi 288 | done 289 | IFS="$lt_save_ifs" 290 | ;; 291 | esac], 292 | [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) 293 | 294 | _LT_DECL([fast_install], [enable_fast_install], [0], 295 | [Whether or not to optimize for fast installation])dnl 296 | ])# _LT_ENABLE_FAST_INSTALL 297 | 298 | LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) 299 | LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) 300 | 301 | # Old names: 302 | AU_DEFUN([AC_ENABLE_FAST_INSTALL], 303 | [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) 304 | AC_DIAGNOSE([obsolete], 305 | [$0: Remove this warning and the call to _LT_SET_OPTION when you put 306 | the `fast-install' option into LT_INIT's first parameter.]) 307 | ]) 308 | 309 | AU_DEFUN([AC_DISABLE_FAST_INSTALL], 310 | [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) 311 | AC_DIAGNOSE([obsolete], 312 | [$0: Remove this warning and the call to _LT_SET_OPTION when you put 313 | the `disable-fast-install' option into LT_INIT's first parameter.]) 314 | ]) 315 | 316 | dnl aclocal-1.4 backwards compatibility: 317 | dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) 318 | dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) 319 | 320 | 321 | # _LT_WITH_PIC([MODE]) 322 | # -------------------- 323 | # implement the --with-pic flag, and support the `pic-only' and `no-pic' 324 | # LT_INIT options. 325 | # MODE is either `yes' or `no'. If omitted, it defaults to `both'. 326 | m4_define([_LT_WITH_PIC], 327 | [AC_ARG_WITH([pic], 328 | [AS_HELP_STRING([--with-pic], 329 | [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], 330 | [pic_mode="$withval"], 331 | [pic_mode=default]) 332 | 333 | test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) 334 | 335 | _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl 336 | ])# _LT_WITH_PIC 337 | 338 | LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) 339 | LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) 340 | 341 | # Old name: 342 | AU_DEFUN([AC_LIBTOOL_PICMODE], 343 | [_LT_SET_OPTION([LT_INIT], [pic-only]) 344 | AC_DIAGNOSE([obsolete], 345 | [$0: Remove this warning and the call to _LT_SET_OPTION when you 346 | put the `pic-only' option into LT_INIT's first parameter.]) 347 | ]) 348 | 349 | dnl aclocal-1.4 backwards compatibility: 350 | dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) 351 | 352 | ## ----------------- ## 353 | ## LTDL_INIT Options ## 354 | ## ----------------- ## 355 | 356 | m4_define([_LTDL_MODE], []) 357 | LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], 358 | [m4_define([_LTDL_MODE], [nonrecursive])]) 359 | LT_OPTION_DEFINE([LTDL_INIT], [recursive], 360 | [m4_define([_LTDL_MODE], [recursive])]) 361 | LT_OPTION_DEFINE([LTDL_INIT], [subproject], 362 | [m4_define([_LTDL_MODE], [subproject])]) 363 | 364 | m4_define([_LTDL_TYPE], []) 365 | LT_OPTION_DEFINE([LTDL_INIT], [installable], 366 | [m4_define([_LTDL_TYPE], [installable])]) 367 | LT_OPTION_DEFINE([LTDL_INIT], [convenience], 368 | [m4_define([_LTDL_TYPE], [convenience])]) 369 | -------------------------------------------------------------------------------- /m4/ltsugar.m4: -------------------------------------------------------------------------------- 1 | # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- 2 | # 3 | # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. 4 | # Written by Gary V. Vaughan, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # serial 6 ltsugar.m4 11 | 12 | # This is to help aclocal find these macros, as it can't see m4_define. 13 | AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) 14 | 15 | 16 | # lt_join(SEP, ARG1, [ARG2...]) 17 | # ----------------------------- 18 | # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their 19 | # associated separator. 20 | # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier 21 | # versions in m4sugar had bugs. 22 | m4_define([lt_join], 23 | [m4_if([$#], [1], [], 24 | [$#], [2], [[$2]], 25 | [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) 26 | m4_define([_lt_join], 27 | [m4_if([$#$2], [2], [], 28 | [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) 29 | 30 | 31 | # lt_car(LIST) 32 | # lt_cdr(LIST) 33 | # ------------ 34 | # Manipulate m4 lists. 35 | # These macros are necessary as long as will still need to support 36 | # Autoconf-2.59 which quotes differently. 37 | m4_define([lt_car], [[$1]]) 38 | m4_define([lt_cdr], 39 | [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], 40 | [$#], 1, [], 41 | [m4_dquote(m4_shift($@))])]) 42 | m4_define([lt_unquote], $1) 43 | 44 | 45 | # lt_append(MACRO-NAME, STRING, [SEPARATOR]) 46 | # ------------------------------------------ 47 | # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. 48 | # Note that neither SEPARATOR nor STRING are expanded; they are appended 49 | # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). 50 | # No SEPARATOR is output if MACRO-NAME was previously undefined (different 51 | # than defined and empty). 52 | # 53 | # This macro is needed until we can rely on Autoconf 2.62, since earlier 54 | # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. 55 | m4_define([lt_append], 56 | [m4_define([$1], 57 | m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) 58 | 59 | 60 | 61 | # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) 62 | # ---------------------------------------------------------- 63 | # Produce a SEP delimited list of all paired combinations of elements of 64 | # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list 65 | # has the form PREFIXmINFIXSUFFIXn. 66 | # Needed until we can rely on m4_combine added in Autoconf 2.62. 67 | m4_define([lt_combine], 68 | [m4_if(m4_eval([$# > 3]), [1], 69 | [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl 70 | [[m4_foreach([_Lt_prefix], [$2], 71 | [m4_foreach([_Lt_suffix], 72 | ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, 73 | [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) 74 | 75 | 76 | # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) 77 | # ----------------------------------------------------------------------- 78 | # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited 79 | # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. 80 | m4_define([lt_if_append_uniq], 81 | [m4_ifdef([$1], 82 | [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], 83 | [lt_append([$1], [$2], [$3])$4], 84 | [$5])], 85 | [lt_append([$1], [$2], [$3])$4])]) 86 | 87 | 88 | # lt_dict_add(DICT, KEY, VALUE) 89 | # ----------------------------- 90 | m4_define([lt_dict_add], 91 | [m4_define([$1($2)], [$3])]) 92 | 93 | 94 | # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) 95 | # -------------------------------------------- 96 | m4_define([lt_dict_add_subkey], 97 | [m4_define([$1($2:$3)], [$4])]) 98 | 99 | 100 | # lt_dict_fetch(DICT, KEY, [SUBKEY]) 101 | # ---------------------------------- 102 | m4_define([lt_dict_fetch], 103 | [m4_ifval([$3], 104 | m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), 105 | m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) 106 | 107 | 108 | # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) 109 | # ----------------------------------------------------------------- 110 | m4_define([lt_if_dict_fetch], 111 | [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], 112 | [$5], 113 | [$6])]) 114 | 115 | 116 | # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) 117 | # -------------------------------------------------------------- 118 | m4_define([lt_dict_filter], 119 | [m4_if([$5], [], [], 120 | [lt_join(m4_quote(m4_default([$4], [[, ]])), 121 | lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), 122 | [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl 123 | ]) 124 | -------------------------------------------------------------------------------- /m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # Generated from ltversion.in. 11 | 12 | # serial 3017 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.2.6b]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3017]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.2.6b' 20 | macro_revision='1.3017' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /m4/lt~obsolete.m4: -------------------------------------------------------------------------------- 1 | # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- 2 | # 3 | # Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004. 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # serial 4 lt~obsolete.m4 11 | 12 | # These exist entirely to fool aclocal when bootstrapping libtool. 13 | # 14 | # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) 15 | # which have later been changed to m4_define as they aren't part of the 16 | # exported API, or moved to Autoconf or Automake where they belong. 17 | # 18 | # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN 19 | # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us 20 | # using a macro with the same name in our local m4/libtool.m4 it'll 21 | # pull the old libtool.m4 in (it doesn't see our shiny new m4_define 22 | # and doesn't know about Autoconf macros at all.) 23 | # 24 | # So we provide this file, which has a silly filename so it's always 25 | # included after everything else. This provides aclocal with the 26 | # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything 27 | # because those macros already exist, or will be overwritten later. 28 | # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 29 | # 30 | # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. 31 | # Yes, that means every name once taken will need to remain here until 32 | # we give up compatibility with versions before 1.7, at which point 33 | # we need to keep only those names which we still refer to. 34 | 35 | # This is to help aclocal find these macros, as it can't see m4_define. 36 | AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) 37 | 38 | m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) 39 | m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) 40 | m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) 41 | m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) 42 | m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) 43 | m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) 44 | m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) 45 | m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) 46 | m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) 47 | m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) 48 | m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) 49 | m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) 50 | m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) 51 | m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) 52 | m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) 53 | m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) 54 | m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) 55 | m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) 56 | m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) 57 | m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) 58 | m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) 59 | m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) 60 | m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) 61 | m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) 62 | m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) 63 | m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) 64 | m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) 65 | m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) 66 | m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) 67 | m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) 68 | m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) 69 | m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) 70 | m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) 71 | m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) 72 | m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) 73 | m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) 74 | m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) 75 | m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) 76 | m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) 77 | m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) 78 | m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) 79 | m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) 80 | m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])]) 81 | m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) 82 | m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) 83 | m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) 84 | m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) 85 | m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) 86 | m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) 87 | m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) 88 | m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) 89 | m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) 90 | m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) 91 | m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) 92 | m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) 93 | -------------------------------------------------------------------------------- /makefile.win32: -------------------------------------------------------------------------------- 1 | 2 | !IF "$(CFG)" == "" 3 | CFG=debug 4 | !ENDIF 5 | 6 | PCLLIB=pcl.lib 7 | PCL_SRCDIR=.\pcl 8 | INCL_DIRS=/I"$(PCL_SRCDIR)" /I".\include" /I"." 9 | CFLAGS=/D _WIN32 /D CO_MULTI_THREAD /D HAVE_WINCONFIG_H /D _CRT_SECURE_NO_DEPRECATE \ 10 | /D _CRT_NONSTDC_NO_DEPRECATE $(INCL_DIRS) 11 | 12 | 13 | !IF "$(CFG)" == "release" 14 | 15 | OUTDIR=.\release 16 | CPP_FLAGS=/nologo $(CFLAGS) /Zp1 /MT /W3 /O2 /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fo"$(OUTDIR)\\" /FD /c 17 | 18 | !ELSEIF "$(CFG)" == "debug" 19 | 20 | OUTDIR=.\debug 21 | CPP_FLAGS=/nologo $(CFLAGS) /Zp1 /MTd /Zi /W3 /Gm /Od /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Fo"$(OUTDIR)\\" /FD /c 22 | 23 | !ENDIF 24 | 25 | 26 | CPP=cl.exe 27 | LIB32=lib.exe 28 | LIB32_FLAGS=/nologo 29 | LINK32=link.exe 30 | LINK32_FLAGS="$(OUTDIR)\$(PCLLIB)" kernel32.lib user32.lib /nologo /subsystem:console /incremental:no 31 | PCLLIB_OBJS= \ 32 | "$(OUTDIR)\pcl.obj" \ 33 | "$(OUTDIR)\pcl_version.obj" \ 34 | "$(OUTDIR)\pcl_private.obj" \ 35 | 36 | 37 | ALL : "$(OUTDIR)\$(PCLLIB)" 38 | 39 | CLEAN : 40 | -@erase "$(OUTDIR)\$(PCLLIB)" $(PCLLIB_OBJS) 41 | -@erase *.pdb *.idb *.pch 42 | 43 | "$(OUTDIR)" : 44 | if not exist "$(OUTDIR)\$(NULL)" mkdir "$(OUTDIR)" 45 | 46 | 47 | {$(PCL_SRCDIR)}.c{$(OUTDIR)}.obj : 48 | $(CPP) $(CPP_FLAGS) $< 49 | 50 | "$(OUTDIR)\$(PCLLIB)" : "$(OUTDIR)" $(PCLLIB_OBJS) 51 | $(LIB32) $(LIB32_FLAGS) /out:"$(OUTDIR)\$(PCLLIB)" $(PCLLIB_OBJS) 52 | 53 | -------------------------------------------------------------------------------- /man/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | man3_MANS = pcl.3 3 | 4 | EXTRA_DIST = $(man3_MANS) 5 | 6 | -------------------------------------------------------------------------------- /man/Makefile.in: -------------------------------------------------------------------------------- 1 | # Makefile.in generated by automake 1.11.1 from Makefile.am. 2 | # @configure_input@ 3 | 4 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 5 | # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, 6 | # Inc. 7 | # This Makefile.in is free software; the Free Software Foundation 8 | # gives unlimited permission to copy and/or distribute it, 9 | # with or without modifications, as long as this notice is preserved. 10 | 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 13 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 14 | # PARTICULAR PURPOSE. 15 | 16 | @SET_MAKE@ 17 | VPATH = @srcdir@ 18 | pkgdatadir = $(datadir)/@PACKAGE@ 19 | pkgincludedir = $(includedir)/@PACKAGE@ 20 | pkglibdir = $(libdir)/@PACKAGE@ 21 | pkglibexecdir = $(libexecdir)/@PACKAGE@ 22 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 23 | install_sh_DATA = $(install_sh) -c -m 644 24 | install_sh_PROGRAM = $(install_sh) -c 25 | install_sh_SCRIPT = $(install_sh) -c 26 | INSTALL_HEADER = $(INSTALL_DATA) 27 | transform = $(program_transform_name) 28 | NORMAL_INSTALL = : 29 | PRE_INSTALL = : 30 | POST_INSTALL = : 31 | NORMAL_UNINSTALL = : 32 | PRE_UNINSTALL = : 33 | POST_UNINSTALL = : 34 | build_triplet = @build@ 35 | host_triplet = @host@ 36 | subdir = man 37 | DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 38 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 39 | am__aclocal_m4_deps = $(top_srcdir)/configure.in 40 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 41 | $(ACLOCAL_M4) 42 | mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 43 | CONFIG_HEADER = $(top_builddir)/config.h 44 | CONFIG_CLEAN_FILES = 45 | CONFIG_CLEAN_VPATH_FILES = 46 | SOURCES = 47 | DIST_SOURCES = 48 | am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; 49 | am__vpath_adj = case $$p in \ 50 | $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ 51 | *) f=$$p;; \ 52 | esac; 53 | am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; 54 | am__install_max = 40 55 | am__nobase_strip_setup = \ 56 | srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` 57 | am__nobase_strip = \ 58 | for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" 59 | am__nobase_list = $(am__nobase_strip_setup); \ 60 | for p in $$list; do echo "$$p $$p"; done | \ 61 | sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ 62 | $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ 63 | if (++n[$$2] == $(am__install_max)) \ 64 | { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ 65 | END { for (dir in files) print dir, files[dir] }' 66 | am__base_list = \ 67 | sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ 68 | sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' 69 | man3dir = $(mandir)/man3 70 | am__installdirs = "$(DESTDIR)$(man3dir)" 71 | NROFF = nroff 72 | MANS = $(man3_MANS) 73 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 74 | ACLOCAL = @ACLOCAL@ 75 | AMTAR = @AMTAR@ 76 | AR = @AR@ 77 | AUTOCONF = @AUTOCONF@ 78 | AUTOHEADER = @AUTOHEADER@ 79 | AUTOMAKE = @AUTOMAKE@ 80 | AWK = @AWK@ 81 | CC = @CC@ 82 | CCDEPMODE = @CCDEPMODE@ 83 | CFLAGS = @CFLAGS@ 84 | CPP = @CPP@ 85 | CPPFLAGS = @CPPFLAGS@ 86 | CYGPATH_W = @CYGPATH_W@ 87 | DEFS = @DEFS@ 88 | DEPDIR = @DEPDIR@ 89 | DSYMUTIL = @DSYMUTIL@ 90 | DUMPBIN = @DUMPBIN@ 91 | ECHO_C = @ECHO_C@ 92 | ECHO_N = @ECHO_N@ 93 | ECHO_T = @ECHO_T@ 94 | EGREP = @EGREP@ 95 | EXEEXT = @EXEEXT@ 96 | FGREP = @FGREP@ 97 | GREP = @GREP@ 98 | INSTALL = @INSTALL@ 99 | INSTALL_DATA = @INSTALL_DATA@ 100 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ 101 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ 102 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 103 | LD = @LD@ 104 | LDFLAGS = @LDFLAGS@ 105 | LIBOBJS = @LIBOBJS@ 106 | LIBS = @LIBS@ 107 | LIBTOOL = @LIBTOOL@ 108 | LIPO = @LIPO@ 109 | LN_S = @LN_S@ 110 | LTLIBOBJS = @LTLIBOBJS@ 111 | MAKEINFO = @MAKEINFO@ 112 | MKDIR_P = @MKDIR_P@ 113 | NM = @NM@ 114 | NMEDIT = @NMEDIT@ 115 | OBJDUMP = @OBJDUMP@ 116 | OBJEXT = @OBJEXT@ 117 | OTOOL = @OTOOL@ 118 | OTOOL64 = @OTOOL64@ 119 | PACKAGE = @PACKAGE@ 120 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ 121 | PACKAGE_NAME = @PACKAGE_NAME@ 122 | PACKAGE_STRING = @PACKAGE_STRING@ 123 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ 124 | PACKAGE_URL = @PACKAGE_URL@ 125 | PACKAGE_VERSION = @PACKAGE_VERSION@ 126 | PATH_SEPARATOR = @PATH_SEPARATOR@ 127 | RANLIB = @RANLIB@ 128 | SED = @SED@ 129 | SET_MAKE = @SET_MAKE@ 130 | SHELL = @SHELL@ 131 | STRIP = @STRIP@ 132 | VERSION = @VERSION@ 133 | abs_builddir = @abs_builddir@ 134 | abs_srcdir = @abs_srcdir@ 135 | abs_top_builddir = @abs_top_builddir@ 136 | abs_top_srcdir = @abs_top_srcdir@ 137 | ac_ct_CC = @ac_ct_CC@ 138 | ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ 139 | am__include = @am__include@ 140 | am__leading_dot = @am__leading_dot@ 141 | am__quote = @am__quote@ 142 | am__tar = @am__tar@ 143 | am__untar = @am__untar@ 144 | bindir = @bindir@ 145 | build = @build@ 146 | build_alias = @build_alias@ 147 | build_cpu = @build_cpu@ 148 | build_os = @build_os@ 149 | build_vendor = @build_vendor@ 150 | builddir = @builddir@ 151 | datadir = @datadir@ 152 | datarootdir = @datarootdir@ 153 | docdir = @docdir@ 154 | dvidir = @dvidir@ 155 | exec_prefix = @exec_prefix@ 156 | host = @host@ 157 | host_alias = @host_alias@ 158 | host_cpu = @host_cpu@ 159 | host_os = @host_os@ 160 | host_vendor = @host_vendor@ 161 | htmldir = @htmldir@ 162 | includedir = @includedir@ 163 | infodir = @infodir@ 164 | install_sh = @install_sh@ 165 | libdir = @libdir@ 166 | libexecdir = @libexecdir@ 167 | localedir = @localedir@ 168 | localstatedir = @localstatedir@ 169 | lt_ECHO = @lt_ECHO@ 170 | mandir = @mandir@ 171 | mkdir_p = @mkdir_p@ 172 | oldincludedir = @oldincludedir@ 173 | pdfdir = @pdfdir@ 174 | prefix = @prefix@ 175 | program_transform_name = @program_transform_name@ 176 | psdir = @psdir@ 177 | sbindir = @sbindir@ 178 | sharedstatedir = @sharedstatedir@ 179 | srcdir = @srcdir@ 180 | sysconfdir = @sysconfdir@ 181 | target_alias = @target_alias@ 182 | top_build_prefix = @top_build_prefix@ 183 | top_builddir = @top_builddir@ 184 | top_srcdir = @top_srcdir@ 185 | man3_MANS = pcl.3 186 | EXTRA_DIST = $(man3_MANS) 187 | all: all-am 188 | 189 | .SUFFIXES: 190 | $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) 191 | @for dep in $?; do \ 192 | case '$(am__configure_deps)' in \ 193 | *$$dep*) \ 194 | ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ 195 | && { if test -f $@; then exit 0; else break; fi; }; \ 196 | exit 1;; \ 197 | esac; \ 198 | done; \ 199 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu man/Makefile'; \ 200 | $(am__cd) $(top_srcdir) && \ 201 | $(AUTOMAKE) --gnu man/Makefile 202 | .PRECIOUS: Makefile 203 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 204 | @case '$?' in \ 205 | *config.status*) \ 206 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ 207 | *) \ 208 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ 209 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 210 | esac; 211 | 212 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) 213 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 214 | 215 | $(top_srcdir)/configure: $(am__configure_deps) 216 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 217 | $(ACLOCAL_M4): $(am__aclocal_m4_deps) 218 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 219 | $(am__aclocal_m4_deps): 220 | 221 | mostlyclean-libtool: 222 | -rm -f *.lo 223 | 224 | clean-libtool: 225 | -rm -rf .libs _libs 226 | install-man3: $(man3_MANS) 227 | @$(NORMAL_INSTALL) 228 | test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)" 229 | @list='$(man3_MANS)'; test -n "$(man3dir)" || exit 0; \ 230 | { for i in $$list; do echo "$$i"; done; \ 231 | } | while read p; do \ 232 | if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ 233 | echo "$$d$$p"; echo "$$p"; \ 234 | done | \ 235 | sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ 236 | -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ 237 | sed 'N;N;s,\n, ,g' | { \ 238 | list=; while read file base inst; do \ 239 | if test "$$base" = "$$inst"; then list="$$list $$file"; else \ 240 | echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \ 241 | $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst" || exit $$?; \ 242 | fi; \ 243 | done; \ 244 | for i in $$list; do echo "$$i"; done | $(am__base_list) | \ 245 | while read files; do \ 246 | test -z "$$files" || { \ 247 | echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man3dir)'"; \ 248 | $(INSTALL_DATA) $$files "$(DESTDIR)$(man3dir)" || exit $$?; }; \ 249 | done; } 250 | 251 | uninstall-man3: 252 | @$(NORMAL_UNINSTALL) 253 | @list='$(man3_MANS)'; test -n "$(man3dir)" || exit 0; \ 254 | files=`{ for i in $$list; do echo "$$i"; done; \ 255 | } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ 256 | -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ 257 | test -z "$$files" || { \ 258 | echo " ( cd '$(DESTDIR)$(man3dir)' && rm -f" $$files ")"; \ 259 | cd "$(DESTDIR)$(man3dir)" && rm -f $$files; } 260 | tags: TAGS 261 | TAGS: 262 | 263 | ctags: CTAGS 264 | CTAGS: 265 | 266 | 267 | distdir: $(DISTFILES) 268 | @list='$(MANS)'; if test -n "$$list"; then \ 269 | list=`for p in $$list; do \ 270 | if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ 271 | if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ 272 | if test -n "$$list" && \ 273 | grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ 274 | echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ 275 | grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ 276 | echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ 277 | echo " typically \`make maintainer-clean' will remove them" >&2; \ 278 | exit 1; \ 279 | else :; fi; \ 280 | else :; fi 281 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 282 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 283 | list='$(DISTFILES)'; \ 284 | dist_files=`for file in $$list; do echo $$file; done | \ 285 | sed -e "s|^$$srcdirstrip/||;t" \ 286 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ 287 | case $$dist_files in \ 288 | */*) $(MKDIR_P) `echo "$$dist_files" | \ 289 | sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ 290 | sort -u` ;; \ 291 | esac; \ 292 | for file in $$dist_files; do \ 293 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ 294 | if test -d $$d/$$file; then \ 295 | dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ 296 | if test -d "$(distdir)/$$file"; then \ 297 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 298 | fi; \ 299 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ 300 | cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ 301 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 302 | fi; \ 303 | cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ 304 | else \ 305 | test -f "$(distdir)/$$file" \ 306 | || cp -p $$d/$$file "$(distdir)/$$file" \ 307 | || exit 1; \ 308 | fi; \ 309 | done 310 | check-am: all-am 311 | check: check-am 312 | all-am: Makefile $(MANS) 313 | installdirs: 314 | for dir in "$(DESTDIR)$(man3dir)"; do \ 315 | test -z "$$dir" || $(MKDIR_P) "$$dir"; \ 316 | done 317 | install: install-am 318 | install-exec: install-exec-am 319 | install-data: install-data-am 320 | uninstall: uninstall-am 321 | 322 | install-am: all-am 323 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am 324 | 325 | installcheck: installcheck-am 326 | install-strip: 327 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 328 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 329 | `test -z '$(STRIP)' || \ 330 | echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install 331 | mostlyclean-generic: 332 | 333 | clean-generic: 334 | 335 | distclean-generic: 336 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) 337 | -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) 338 | 339 | maintainer-clean-generic: 340 | @echo "This command is intended for maintainers to use" 341 | @echo "it deletes files that may require special tools to rebuild." 342 | clean: clean-am 343 | 344 | clean-am: clean-generic clean-libtool mostlyclean-am 345 | 346 | distclean: distclean-am 347 | -rm -f Makefile 348 | distclean-am: clean-am distclean-generic 349 | 350 | dvi: dvi-am 351 | 352 | dvi-am: 353 | 354 | html: html-am 355 | 356 | html-am: 357 | 358 | info: info-am 359 | 360 | info-am: 361 | 362 | install-data-am: install-man 363 | 364 | install-dvi: install-dvi-am 365 | 366 | install-dvi-am: 367 | 368 | install-exec-am: 369 | 370 | install-html: install-html-am 371 | 372 | install-html-am: 373 | 374 | install-info: install-info-am 375 | 376 | install-info-am: 377 | 378 | install-man: install-man3 379 | 380 | install-pdf: install-pdf-am 381 | 382 | install-pdf-am: 383 | 384 | install-ps: install-ps-am 385 | 386 | install-ps-am: 387 | 388 | installcheck-am: 389 | 390 | maintainer-clean: maintainer-clean-am 391 | -rm -f Makefile 392 | maintainer-clean-am: distclean-am maintainer-clean-generic 393 | 394 | mostlyclean: mostlyclean-am 395 | 396 | mostlyclean-am: mostlyclean-generic mostlyclean-libtool 397 | 398 | pdf: pdf-am 399 | 400 | pdf-am: 401 | 402 | ps: ps-am 403 | 404 | ps-am: 405 | 406 | uninstall-am: uninstall-man 407 | 408 | uninstall-man: uninstall-man3 409 | 410 | .MAKE: install-am install-strip 411 | 412 | .PHONY: all all-am check check-am clean clean-generic clean-libtool \ 413 | distclean distclean-generic distclean-libtool distdir dvi \ 414 | dvi-am html html-am info info-am install install-am \ 415 | install-data install-data-am install-dvi install-dvi-am \ 416 | install-exec install-exec-am install-html install-html-am \ 417 | install-info install-info-am install-man install-man3 \ 418 | install-pdf install-pdf-am install-ps install-ps-am \ 419 | install-strip installcheck installcheck-am installdirs \ 420 | maintainer-clean maintainer-clean-generic mostlyclean \ 421 | mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ 422 | uninstall uninstall-am uninstall-man uninstall-man3 423 | 424 | 425 | # Tell versions [3.59,3.63) of GNU make to not export all variables. 426 | # Otherwise a system limit (for SysV at least) may be exceeded. 427 | .NOEXPORT: 428 | -------------------------------------------------------------------------------- /man/libpcl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 9 | 10 | 12 | 13 | Portable Coroutine Library Home Page 14 | 15 | 17 |

Portable 18 | Coroutine Library (PCL)
19 |

20 |


21 | The Portable Coroutine Library (PCL) implements the low level 22 | functionality for coroutines. For a definition of the term coroutine 23 | see The 24 | Art of Computer Programming by Donald E. Knuth. Coroutines 25 | are a very simple cooperative multitasking environment where the switch 26 | from one task to another is done explicitly by a function call. 27 | Coroutines are a lot faster than processes or threads switch, since 28 | there is no OS kernel involvement for the operation. Also coroutines 29 | require much less OS resources than processes of threads. The idea of 30 | writing this library started when I was testing Linux epoll 32 | functionality and performance. I initially started using the coro library 34 | by 35 | E. Toernig <froese@gmx.de> and 36 | I found the library very interesting. It was simple and yet powerful. 37 | The limitations of the coro library 39 | were both non portability and crashes when not used together with 40 | certain versions of gcc. So I 41 | decided 42 | to write a new library to address the problems aforementioned by also 43 | taking portable context switching ideas from the GNU Pth library. This 45 | library is easily portable on almost every Unix system and on Windows. 46 | It can use either the ucontext.h functionalities ( 47 | getcontext()/makecontest()/swapcontext() ) or the standard 48 | longjmp()/setjmp().
49 |

50 |


51 | Documentation 52 |

53 |

PCL man 54 | page: HTML 55 | TXT PS
56 |
57 |

58 |

Download

59 |

Latest 60 | version : 1.12

61 |

62 |

Links

63 |

FreshMeat 65 | Home Page
66 | GNU Pth library
67 | Very nice paper about portable multi-threading
68 |

69 |


70 |

71 |


72 | Back Home
73 |

74 |


75 |

76 |

77 | 78 | 79 | -------------------------------------------------------------------------------- /man/mkpages.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | groff -t -e -mandoc -Tascii pcl.3 | col -bx > pcl.txt 4 | groff -t -e -mandoc -Tps pcl.3 > pcl.ps 5 | man2html < pcl.3 | sed 's///' > pcl.html 6 | 7 | -------------------------------------------------------------------------------- /man/pcl.3: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" PCL by Davide Libenzi ( Portable Coroutine Library ) 3 | .\" Copyright (C) 2003 Davide Libenzi 4 | .\" 5 | .\" This program is free software; you can redistribute it and/or modify 6 | .\" it under the terms of the GNU General Public License as published by 7 | .\" the Free Software Foundation; either version 2 of the License, or 8 | .\" (at your option) any later version. 9 | .\" 10 | .\" This program is distributed in the hope that it will be useful, 11 | .\" but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | .\" GNU General Public License for more details. 14 | .\" 15 | .\" You should have received a copy of the GNU General Public License 16 | .\" along with this program; if not, write to the Free Software 17 | .\" Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | .\" 19 | .\" Davide Libenzi 20 | .\" 21 | .\" Original man page source by E.Toernig 22 | .\" 23 | .na 24 | .TH PCL 3 "1.12" "GNU" "Portable Coroutine Library" 25 | .SH NAME 26 | co_thread_init, co_thread_cleanup, co_create, co_call, co_resume, co_delete, 27 | co_exit_to, co_exit, co_current, co_get_data, co_set_data \- C coroutine management 28 | 29 | .SH SYNOPSIS 30 | .nf 31 | .B #include 32 | .sp 33 | .BI "int co_thread_init(void);" 34 | .sp 35 | .BI "void co_thread_cleanup(void);" 36 | .nl 37 | .BI "coroutine_t co_create(void *" func ", void *" data ", void *" stack ", int " stacksize ");" 38 | .nl 39 | .BI "void co_delete(coroutine_t " co ");" 40 | .nl 41 | .BI "void co_call(coroutine_t " co ");" 42 | .nl 43 | .BI "void co_resume(void);" 44 | .nl 45 | .BI "void co_exit_to(coroutine_t " co ");" 46 | .nl 47 | .BI "void co_exit(void);" 48 | .nl 49 | .BI "coroutine_t co_current(void);" 50 | .nl 51 | .BI "void *co_get_data(coroutine_t " co ");" 52 | .nl 53 | .BI "void *co_set_data(coroutine_t " co ", void *" data ");" 54 | .nl 55 | .fi 56 | 57 | Link with 58 | .IR -lpthread 59 | if you are using a multi-thread version of 60 | .BR PCL . 61 | .nl 62 | .SH DESCRIPTION 63 | The 64 | .B Portable Coroutine Library (PCL) 65 | implements the low level functionality for coroutines. For a definition 66 | of the term 67 | .B coroutine 68 | see 69 | .IR "The Art of Computer Programming" " by " "Donald E. Knuth" . 70 | Coroutines are a very simple cooperative multitasking environment 71 | where the switch from one task to another is done explicitly by a function call. 72 | Coroutines are a lot faster than processes or threads switch, since 73 | there is no OS kernel involvement for the operation. This document 74 | defines an API for the low level handling of coroutines 75 | i.e. creating and deleting coroutines and switching between them. 76 | Higher level functionality (scheduler, etc.) is not covered. 77 | 78 | .SS Functions 79 | The following functions are defined: 80 | .TP 81 | .BI "int co_thread_init(void);" 82 | 83 | If the 84 | .B PCL 85 | library is built in multi-thread mode, and if multi threads are actually 86 | used, this function should be called before calling any 87 | .B PCL 88 | function. 89 | If the 90 | .B PCL 91 | library is built in multi-thread mode, but it is used only from one 92 | thread (the main one, likely), then it is possible to avoid to call 93 | .BR co_thread_init (). 94 | Returns 0 in case of success, or an negative error code in case of error. 95 | 96 | .TP 97 | .BI "void co_thread_cleanup(void);" 98 | If the 99 | .B PCL 100 | library is built in multi-thread mode, and if multi threads are actually 101 | used, this function should be called before the thread exits, or whenever 102 | the thread decides it won't call the 103 | .B PCL 104 | functions anymore. 105 | A failure in calling 106 | .BR co_thread_cleanup () 107 | will result in resource leakage by the calling application. 108 | 109 | .TP 110 | .BI "coroutine_t co_create(void *" func ", void *" data ", void *" stack ", int " stacksize ");" 111 | 112 | This function creates a new coroutine. 113 | .I func 114 | is the entry point of the coroutine. It will be called with one 115 | arg, a 116 | .BR "void *" , 117 | which holds the data passed through the 118 | .I data 119 | parameter. If 120 | .I func 121 | terminates, the associated coroutine is deleted. 122 | .I stack 123 | is the base of the stack this coroutine will use and 124 | .I stacksize 125 | its size in bytes. You may pass a 126 | .B NULL 127 | pointer for 128 | .I stack 129 | in which case the memory will be allocated by 130 | .B co_create 131 | itself. Both, 132 | .IR stack " and " stacksize 133 | are aligned to system requirements. 134 | A 135 | .I stacksize 136 | of less then 4096 bytes will be rejected. 137 | You have to make sure, that the stack is large enough for your 138 | coroutine and possible signal handlers (see below). The stack 139 | will not grow! (Exception: the main coroutine uses the standard 140 | system stack which may still grow) On success, a handle 141 | .RB ( "coroutine_t" ) 142 | for a new coroutine is returned, otherwise 143 | .BR NULL . 144 | 145 | .TP 146 | .BI "void co_delete(coroutine_t " co ");" 147 | 148 | This function deletes the given coroutine 149 | .IR co . 150 | If the stack for this coroutine was allocated by 151 | .B co_create 152 | it will be freed. After a coroutine handle was passed to 153 | .B co_delete 154 | it is invalid and may not be used any more. 155 | It is invalid for a coroutine to delete itself with this 156 | function. 157 | 158 | .TP 159 | .BI "void co_call(coroutine_t " co ");" 160 | 161 | This function passes execution to the given coroutine 162 | .IR co . 163 | The first time the coroutine is executed, its entry point 164 | .I func 165 | is called, and the 166 | .I data 167 | parameter used during the call to 168 | .B co_create 169 | is passed to 170 | .IR func . 171 | The current coroutine is suspended until another one restarts it with a 172 | .B co_call 173 | or 174 | .B co_resume 175 | call. Calling oneself returns immediately. 176 | 177 | .TP 178 | .BI "void co_resume(void);" 179 | 180 | This function passes execution back to the coroutine which either 181 | initially started this one or restarted it after a prior 182 | .BR co_resume . 183 | 184 | .TP 185 | .BI "void co_exit_to(coroutine_t " co ");" 186 | 187 | This function does the same a 188 | .B co_delete(co_current()) 189 | followed by a 190 | .B co_call 191 | would do. That is, it deletes itself and then passes execution 192 | to another coroutine 193 | .IR co . 194 | 195 | .TP 196 | .BI "void co_exit(void);" 197 | 198 | This function does the same a 199 | .B co_delete(co_current()) 200 | followed by a 201 | .B co_resume 202 | would do. That is, it deletes itself and then passes execution 203 | back to the coroutine which either initially started this one or 204 | restarted it after a prior 205 | .BR co_resume . 206 | 207 | .TP 208 | .BI "coroutine_t co_current(void);" 209 | 210 | This function returns the currently running coroutine. 211 | 212 | .TP 213 | .BI "void *co_get_data(coroutine_t " co ");" 214 | 215 | This function returns the data associated with the 216 | .I co 217 | coroutine. The data associated with a coroutine is the 218 | .I data 219 | parameter passed to 220 | .BR co_create (). 221 | 222 | .TP 223 | .BI "void *co_set_data(coroutine_t " co ", void *" data ");" 224 | 225 | Sets the 226 | .I data 227 | associated with the 228 | .I co 229 | coroutine, and returns the previously associated data. 230 | 231 | .SS Notes 232 | Some interactions with other parts of the system are covered here. 233 | .TP 234 | .B Threads 235 | If the 236 | .B PCL 237 | library has been built in multi-thread mode, then it is possible to use 238 | it in multi-thread software. 239 | A thread should call 240 | .BR co_thread_init () 241 | before using the 242 | .B PCL 243 | APIs, and call 244 | .BR co_thread_cleanup () 245 | before exiting, or when it has done using the 246 | .B PCL 247 | APIs. 248 | .br 249 | .B WARNING: 250 | For no reason should two different threads run the same coroutine at the 251 | same time. 252 | 253 | .TP 254 | .B Signals 255 | First, a signal handler is not defined to run in any specific 256 | coroutine. The only way to leave the signal handler is 257 | by a return statement. 258 | 259 | Second, the signal handler may run with the stack of any coroutine, 260 | even with the stack of library internal coroutines which have an 261 | undefined stack size (just enough to perform a kernel call). 262 | Using and alternate stack for signal processing (see 263 | .BR sigaltstack (2)) 264 | is recommended! 265 | 266 | Conclusion: avoid signals like a plague. The only thing you may 267 | do reliable is setting some global variables and return. 268 | Simple kernel calls may work too, but nowadays it's pretty hairy 269 | to tell, which function really is a kernel call. 270 | (Btw, all this applies to normal C programs, too. The coroutines 271 | just add one more problem) 272 | .TP 273 | .BR setjmp / longjmp 274 | The use of 275 | .BR setjmp "(2)/" longjmp (2) 276 | is limited to jumping inside one coroutine. Never try to jump from 277 | one coroutine to another with 278 | .BR longjmp (2). 279 | 280 | .SH DIAGNOSTICS 281 | Some fatal errors are caught by the library. If one occurs, 282 | a short message is written to file descriptor 2 (stderr) and 283 | a segmentation violation is generated. 284 | .TP 285 | .B [PCL]: Cannot delete itself 286 | A coroutine has called 287 | .B co_delete 288 | with it's own handle. 289 | .TP 290 | .B [PCL]: Resume to deleted coroutine 291 | A coroutine has deleted itself with 292 | .BR co_exit " or " co_exit_to 293 | and the coroutine that was activated by the exit tried a 294 | .BR co_resume . 295 | .TP 296 | .B [PCL]: Stale coroutine called 297 | Someone tried to active a coroutine that has already been 298 | deleted. This error is only detected, if the stack of the 299 | deleted coroutine is still resident in memory. 300 | .TP 301 | .B [PCL]: Context switch failed 302 | Low level error generated by the library in case a context switch 303 | between two coroutines failes. 304 | 305 | .SH SEE ALSO 306 | Original 307 | .B coroutine 308 | library at 309 | .BR http://www.goron.de/~froese/coro/coro.html " ." 310 | GNU Pth library at 311 | .BR http://www.gnu.org/software/pth/ " ." 312 | 313 | .SH AUTHOR 314 | Developed by Davide Libenzi < 315 | .BR davidel@xmailserver.org " >." 316 | .br 317 | Ideas and man page base source taken by the coroutine library developed by 318 | E. Toernig < 319 | .BR froese@gmx.de " >." 320 | .br 321 | Also some code and ideas comes from the GNU Pth library available at 322 | .BR http://www.gnu.org/software/pth/ " ." 323 | 324 | .SH BUGS 325 | There are no known bugs. But, this library is still 326 | in development even if it results very stable and pretty much ready for 327 | production use. 328 | 329 | Bug reports and comments to Davide Libenzi < 330 | .BR davidel@xmailserver.org " >." 331 | 332 | -------------------------------------------------------------------------------- /man/pcl.html: -------------------------------------------------------------------------------- 1 | 2 | Man page of PCL 3 | 4 |

PCL

5 | Section: Portable Coroutine Library (3)
Updated: 1.12
Index 6 | Return to Main Contents
7 | 8 |   9 |

NAME

10 | 11 | co_thread_init, co_thread_cleanup, co_create, co_call, co_resume, co_delete, 12 | co_exit_to, co_exit, co_current, co_get_data, co_set_data - C coroutine management 13 |

14 |   15 |

SYNOPSIS

16 | 17 |
 18 | #include <pcl.h>
 19 | 
 20 | int co_thread_init(void);
 21 | 
 22 | void co_thread_cleanup(void);
 23 | coroutine_t co_create(void *func, void *data, void *stack, int stacksize);
 24 | void co_delete(coroutine_t co);
 25 | void co_call(coroutine_t co);
 26 | void co_resume(void);
 27 | void co_exit_to(coroutine_t co);
 28 | void co_exit(void);
 29 | coroutine_t co_current(void);
 30 | void *co_get_data(coroutine_t co);
 31 | void *co_set_data(coroutine_t co, void *data);
 32 | 
33 | 34 |

35 | Link with 36 | -lpthread 37 | 38 | if you are using a multi-thread version of 39 | PCL. 40 | 41 | 42 |   43 |

DESCRIPTION

44 | 45 | The 46 | Portable Coroutine Library (PCL) 47 | 48 | implements the low level functionality for coroutines. For a definition 49 | of the term 50 | coroutine 51 | 52 | see 53 | The Art of Computer Programming by Donald E. Knuth. 54 | 55 | Coroutines are a very simple cooperative multitasking environment 56 | where the switch from one task to another is done explicitly by a function call. 57 | Coroutines are a lot faster than processes or threads switch, since 58 | there is no OS kernel involvement for the operation. This document 59 | defines an API for the low level handling of coroutines 60 | i.e. creating and deleting coroutines and switching between them. 61 | Higher level functionality (scheduler, etc.) is not covered. 62 |

63 |   64 |

Functions

65 | 66 | The following functions are defined: 67 |
68 |
int co_thread_init(void); 69 | 70 |
71 |

72 | If the 73 | PCL 74 | 75 | library is built in multi-thread mode, and if multi threads are actually 76 | used, this function should be called before calling any 77 | PCL 78 | 79 | function. 80 | If the 81 | PCL 82 | 83 | library is built in multi-thread mode, but it is used only from one 84 | thread (the main one, likely), then it is possible to avoid to call 85 | co_thread_init(). 86 | 87 | Returns 0 in case of success, or an negative error code in case of error. 88 |

89 |

void co_thread_cleanup(void); 90 | 91 |
92 | If the 93 | PCL 94 | 95 | library is built in multi-thread mode, and if multi threads are actually 96 | used, this function should be called before the thread exits, or whenever 97 | the thread decides it won't call the 98 | PCL 99 | 100 | functions anymore. 101 | A failure in calling 102 | co_thread_cleanup() 103 | 104 | will result in resource leakage by the calling application. 105 |

106 |

coroutine_t co_create(void *func, void *data, void *stack, int stacksize); 107 | 108 |
109 |

110 | This function creates a new coroutine. 111 | func 112 | 113 | is the entry point of the coroutine. It will be called with one 114 | arg, a 115 | void *, 116 | 117 | which holds the data passed through the 118 | data 119 | 120 | parameter. If 121 | func 122 | 123 | terminates, the associated coroutine is deleted. 124 | stack 125 | 126 | is the base of the stack this coroutine will use and 127 | stacksize 128 | 129 | its size in bytes. You may pass a 130 | NULL 131 | 132 | pointer for 133 | stack 134 | 135 | in which case the memory will be allocated by 136 | co_create 137 | 138 | itself. Both, 139 | stack and stacksize 140 | 141 | are aligned to system requirements. 142 | A 143 | stacksize 144 | 145 | of less then 4096 bytes will be rejected. 146 | You have to make sure, that the stack is large enough for your 147 | coroutine and possible signal handlers (see below). The stack 148 | will not grow! (Exception: the main coroutine uses the standard 149 | system stack which may still grow) On success, a handle 150 | (coroutine_t) 151 | 152 | for a new coroutine is returned, otherwise 153 | NULL. 154 | 155 |

156 |

void co_delete(coroutine_t co); 157 | 158 |
159 |

160 | This function deletes the given coroutine 161 | co. 162 | 163 | If the stack for this coroutine was allocated by 164 | co_create 165 | 166 | it will be freed. After a coroutine handle was passed to 167 | co_delete 168 | 169 | it is invalid and may not be used any more. 170 | It is invalid for a coroutine to delete itself with this 171 | function. 172 |

173 |

void co_call(coroutine_t co); 174 | 175 |
176 |

177 | This function passes execution to the given coroutine 178 | co. 179 | 180 | The first time the coroutine is executed, its entry point 181 | func 182 | 183 | is called, and the 184 | data 185 | 186 | parameter used during the call to 187 | co_create 188 | 189 | is passed to 190 | func. 191 | 192 | The current coroutine is suspended until another one restarts it with a 193 | co_call 194 | 195 | or 196 | co_resume 197 | 198 | call. Calling oneself returns immediately. 199 |

200 |

void co_resume(void); 201 | 202 |
203 |

204 | This function passes execution back to the coroutine which either 205 | initially started this one or restarted it after a prior 206 | co_resume. 207 | 208 |

209 |

void co_exit_to(coroutine_t co); 210 | 211 |
212 |

213 | This function does the same a 214 | co_delete(co_current()) 215 | 216 | followed by a 217 | co_call 218 | 219 | would do. That is, it deletes itself and then passes execution 220 | to another coroutine 221 | co. 222 | 223 |

224 |

void co_exit(void); 225 | 226 |
227 |

228 | This function does the same a 229 | co_delete(co_current()) 230 | 231 | followed by a 232 | co_resume 233 | 234 | would do. That is, it deletes itself and then passes execution 235 | back to the coroutine which either initially started this one or 236 | restarted it after a prior 237 | co_resume. 238 | 239 |

240 |

coroutine_t co_current(void); 241 | 242 |
243 |

244 | This function returns the currently running coroutine. 245 |

246 |

void *co_get_data(coroutine_t co); 247 | 248 |
249 |

250 | This function returns the data associated with the 251 | co 252 | 253 |
 coroutine. The data associated with a coroutine is the 254 | data 255 | 256 | parameter passed to 257 | co_create(). 258 | 259 |

260 |

void *co_set_data(coroutine_t co, void *data); 261 | 262 |
263 |

264 | Sets the 265 | data 266 | 267 | associated with the 268 | co 269 | 270 | coroutine, and returns the previously associated data. 271 |

272 |

273 |   274 |

Notes

275 | 276 | Some interactions with other parts of the system are covered here. 277 |
278 |
Threads 279 | 280 |
281 | If the 282 | PCL 283 | 284 | library has been built in multi-thread mode, then it is possible to use 285 | it in multi-thread software. 286 | A thread should call 287 | co_thread_init() 288 | 289 | before using the 290 | PCL 291 | 292 | APIs, and call 293 | co_thread_cleanup() 294 | 295 | before exiting, or when it has done using the 296 | PCL 297 | 298 | APIs. 299 |
300 | 301 | WARNING: 302 | 303 | For no reason should two different threads run the same coroutine at the 304 | same time. 305 |

306 |

Signals 307 | 308 |
309 | First, a signal handler is not defined to run in any specific 310 | coroutine. The only way to leave the signal handler is 311 | by a return statement. 312 |

313 | Second, the signal handler may run with the stack of any coroutine, 314 | even with the stack of library internal coroutines which have an 315 | undefined stack size (just enough to perform a kernel call). 316 | Using and alternate stack for signal processing (see 317 | sigaltstack(2)) 318 | 319 | is recommended! 320 |

321 | Conclusion: avoid signals like a plague. The only thing you may 322 | do reliable is setting some global variables and return. 323 | Simple kernel calls may work too, but nowadays it's pretty hairy 324 | to tell, which function really is a kernel call. 325 | (Btw, all this applies to normal C programs, too. The coroutines 326 | just add one more problem) 327 |

setjmp/longjmp 328 | 329 |
330 | The use of 331 | setjmp(2)/longjmp(2) 332 | 333 | is limited to jumping inside one coroutine. Never try to jump from 334 | one coroutine to another with 335 | longjmp(2). 336 | 337 |

338 |

339 |   340 |

DIAGNOSTICS

341 | 342 | Some fatal errors are caught by the library. If one occurs, 343 | a short message is written to file descriptor 2 (stderr) and 344 | a segmentation violation is generated. 345 |
346 |
[PCL]: Cannot delete itself 347 | 348 |
349 | A coroutine has called 350 | co_delete 351 | 352 | with it's own handle. 353 |
[PCL]: Resume to deleted coroutine 354 | 355 |
356 | A coroutine has deleted itself with 357 | co_exit or co_exit_to 358 | 359 | and the coroutine that was activated by the exit tried a 360 | co_resume. 361 | 362 |
[PCL]: Stale coroutine called 363 | 364 |
365 | Someone tried to active a coroutine that has already been 366 | deleted. This error is only detected, if the stack of the 367 | deleted coroutine is still resident in memory. 368 |
[PCL]: Context switch failed 369 | 370 |
371 | Low level error generated by the library in case a context switch 372 | between two coroutines failes. 373 |

374 |

375 |   376 |

SEE ALSO

377 | 378 | Original 379 | coroutine 380 | 381 | library at 382 | http://www.goron.de/~froese/coro/coro.html . 383 | 384 | GNU Pth library at 385 | http://www.gnu.org/software/pth/ . 386 | 387 |

388 |   389 |

AUTHOR

390 | 391 | Developed by Davide Libenzi < 392 | davidel@xmailserver.org >. 393 | 394 |
395 | 396 | Ideas and man page base source taken by the coroutine library developed by 397 | E. Toernig < 398 | froese@gmx.de >. 399 | 400 |
401 | 402 | Also some code and ideas comes from the GNU Pth library available at 403 | http://www.gnu.org/software/pth/ . 404 | 405 |

406 |   407 |

BUGS

408 | 409 | There are no known bugs. But, this library is still 410 | in development even if it results very stable and pretty much ready for 411 | production use. 412 |

413 | Bug reports and comments to Davide Libenzi < 414 | davidel@xmailserver.org >. 415 | 416 |

417 |

418 | 419 |


420 |  

Index

421 |
422 |
NAME
423 |
SYNOPSIS
424 |
DESCRIPTION
425 |
426 |
Functions
427 |
Notes
428 |
429 |
DIAGNOSTICS
430 |
SEE ALSO
431 |
AUTHOR
432 |
BUGS
433 |
434 |
435 | This document was created by 436 | man2html, 437 | using the manual pages.
438 | Time: 03:12:40 GMT, November 20, 2010 439 | 440 | 441 | -------------------------------------------------------------------------------- /man/pcl.txt: -------------------------------------------------------------------------------- 1 | PCL(3) Portable Coroutine Library PCL(3) 2 | 3 | 4 | 5 | NAME 6 | co_thread_init, co_thread_cleanup, co_create, co_call, co_resume, 7 | co_delete, co_exit_to, co_exit, co_current, co_get_data, co_set_data - 8 | C coroutine management 9 | 10 | 11 | SYNOPSIS 12 | #include 13 | 14 | int co_thread_init(void); 15 | 16 | void co_thread_cleanup(void); 17 | coroutine_t co_create(void *func, void *data, void *stack, int stacksize); 18 | void co_delete(coroutine_t co); 19 | void co_call(coroutine_t co); 20 | void co_resume(void); 21 | void co_exit_to(coroutine_t co); 22 | void co_exit(void); 23 | coroutine_t co_current(void); 24 | void *co_get_data(coroutine_t co); 25 | void *co_set_data(coroutine_t co, void *data); 26 | 27 | Link with -lpthread if you are using a multi-thread version of PCL. 28 | 29 | DESCRIPTION 30 | The Portable Coroutine Library (PCL) implements the low level function- 31 | ality for coroutines. For a definition of the term coroutine see The 32 | Art of Computer Programming by Donald E. Knuth. Coroutines are a very 33 | simple cooperative multitasking environment where the switch from one 34 | task to another is done explicitly by a function call. Coroutines are 35 | a lot faster than processes or threads switch, since there is no OS 36 | kernel involvement for the operation. This document defines an API for 37 | the low level handling of coroutines i.e. creating and deleting corou- 38 | tines and switching between them. Higher level functionality (sched- 39 | uler, etc.) is not covered. 40 | 41 | 42 | Functions 43 | The following functions are defined: 44 | 45 | int co_thread_init(void); 46 | 47 | If the PCL library is built in multi-thread mode, and if multi 48 | threads are actually used, this function should be called before 49 | calling any PCL function. If the PCL library is built in multi- 50 | thread mode, but it is used only from one thread (the main one, 51 | likely), then it is possible to avoid to call co_thread_init(). 52 | Returns 0 in case of success, or an negative error code in case 53 | of error. 54 | 55 | 56 | void co_thread_cleanup(void); 57 | If the PCL library is built in multi-thread mode, and if multi 58 | threads are actually used, this function should be called before 59 | the thread exits, or whenever the thread decides it won't call 60 | the PCL functions anymore. A failure in calling 61 | co_thread_cleanup() will result in resource leakage by the call- 62 | ing application. 63 | 64 | 65 | coroutine_t co_create(void *func, void *data, void *stack, int stack- 66 | size); 67 | 68 | This function creates a new coroutine. func is the entry point 69 | of the coroutine. It will be called with one arg, a void *, 70 | which holds the data passed through the data parameter. If func 71 | terminates, the associated coroutine is deleted. stack is the 72 | base of the stack this coroutine will use and stacksize its size 73 | in bytes. You may pass a NULL pointer for stack in which case 74 | the memory will be allocated by co_create itself. Both, stack 75 | and stacksize are aligned to system requirements. A stacksize 76 | of less then 4096 bytes will be rejected. You have to make 77 | sure, that the stack is large enough for your coroutine and pos- 78 | sible signal handlers (see below). The stack will not grow! 79 | (Exception: the main coroutine uses the standard system stack 80 | which may still grow) On success, a handle (coroutine_t) for a 81 | new coroutine is returned, otherwise NULL. 82 | 83 | 84 | void co_delete(coroutine_t co); 85 | 86 | This function deletes the given coroutine co. If the stack for 87 | this coroutine was allocated by co_create it will be freed. 88 | After a coroutine handle was passed to co_delete it is invalid 89 | and may not be used any more. It is invalid for a coroutine to 90 | delete itself with this function. 91 | 92 | 93 | void co_call(coroutine_t co); 94 | 95 | This function passes execution to the given coroutine co. The 96 | first time the coroutine is executed, its entry point func is 97 | called, and the data parameter used during the call to co_create 98 | is passed to func. The current coroutine is suspended until 99 | another one restarts it with a co_call or co_resume call. Call- 100 | ing oneself returns immediately. 101 | 102 | 103 | void co_resume(void); 104 | 105 | This function passes execution back to the coroutine which 106 | either initially started this one or restarted it after a prior 107 | co_resume. 108 | 109 | 110 | void co_exit_to(coroutine_t co); 111 | 112 | This function does the same a co_delete(co_current()) followed 113 | by a co_call would do. That is, it deletes itself and then 114 | passes execution to another coroutine co. 115 | 116 | 117 | void co_exit(void); 118 | 119 | This function does the same a co_delete(co_current()) followed 120 | by a co_resume would do. That is, it deletes itself and then 121 | passes execution back to the coroutine which either initially 122 | started this one or restarted it after a prior co_resume. 123 | 124 | 125 | coroutine_t co_current(void); 126 | 127 | This function returns the currently running coroutine. 128 | 129 | 130 | void *co_get_data(coroutine_t co); 131 | 132 | This function returns the data associated with the co 133 | coroutine. The data associated with a coroutine is the data 134 | parameter passed to co_create(). 135 | 136 | 137 | void *co_set_data(coroutine_t co, void *data); 138 | 139 | Sets the data associated with the co coroutine, and returns the 140 | previously associated data. 141 | 142 | 143 | Notes 144 | Some interactions with other parts of the system are covered here. 145 | 146 | Threads 147 | If the PCL library has been built in multi-thread mode, then it 148 | is possible to use it in multi-thread software. A thread should 149 | call co_thread_init() before using the PCL APIs, and call 150 | co_thread_cleanup() before exiting, or when it has done using 151 | the PCL APIs. 152 | WARNING: For no reason should two different threads run the same 153 | coroutine at the same time. 154 | 155 | 156 | Signals 157 | First, a signal handler is not defined to run in any specific 158 | coroutine. The only way to leave the signal handler is by a 159 | return statement. 160 | 161 | Second, the signal handler may run with the stack of any corou- 162 | tine, even with the stack of library internal coroutines which 163 | have an undefined stack size (just enough to perform a kernel 164 | call). Using and alternate stack for signal processing (see 165 | sigaltstack(2)) is recommended! 166 | 167 | Conclusion: avoid signals like a plague. The only thing you may 168 | do reliable is setting some global variables and return. Simple 169 | kernel calls may work too, but nowadays it's pretty hairy to 170 | tell, which function really is a kernel call. (Btw, all this 171 | applies to normal C programs, too. The coroutines just add one 172 | more problem) 173 | 174 | setjmp/longjmp 175 | The use of setjmp(2)/longjmp(2) is limited to jumping inside one 176 | coroutine. Never try to jump from one coroutine to another with 177 | longjmp(2). 178 | 179 | 180 | DIAGNOSTICS 181 | Some fatal errors are caught by the library. If one occurs, a short 182 | message is written to file descriptor 2 (stderr) and a segmentation 183 | violation is generated. 184 | 185 | [PCL]: Cannot delete itself 186 | A coroutine has called co_delete with it's own handle. 187 | 188 | [PCL]: Resume to deleted coroutine 189 | A coroutine has deleted itself with co_exit or co_exit_to and 190 | the coroutine that was activated by the exit tried a co_resume. 191 | 192 | [PCL]: Stale coroutine called 193 | Someone tried to active a coroutine that has already been 194 | deleted. This error is only detected, if the stack of the 195 | deleted coroutine is still resident in memory. 196 | 197 | [PCL]: Context switch failed 198 | Low level error generated by the library in case a context 199 | switch between two coroutines failes. 200 | 201 | 202 | SEE ALSO 203 | Original coroutine library at 204 | http://www.goron.de/~froese/coro/coro.html . GNU Pth library at 205 | http://www.gnu.org/software/pth/ . 206 | 207 | 208 | AUTHOR 209 | Developed by Davide Libenzi < davidel@xmailserver.org >. 210 | Ideas and man page base source taken by the coroutine library developed 211 | by E. Toernig < froese@gmx.de >. 212 | Also some code and ideas comes from the GNU Pth library available at 213 | http://www.gnu.org/software/pth/ . 214 | 215 | 216 | BUGS 217 | There are no known bugs. But, this library is still in development 218 | even if it results very stable and pretty much ready for production 219 | use. 220 | 221 | Bug reports and comments to Davide Libenzi < davidel@xmailserver.org >. 222 | 223 | 224 | 225 | 226 | GNU 1.12 PCL(3) 227 | -------------------------------------------------------------------------------- /missing: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Common stub for a few missing GNU programs while installing. 3 | 4 | scriptversion=2005-06-08.21 5 | 6 | # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 7 | # Free Software Foundation, Inc. 8 | # Originally by Fran,cois Pinard , 1996. 9 | 10 | # This program is free software; you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation; either version 2, or (at your option) 13 | # any later version. 14 | 15 | # This program is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | 20 | # You should have received a copy of the GNU General Public License 21 | # along with this program; if not, write to the Free Software 22 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 | # 02110-1301, USA. 24 | 25 | # As a special exception to the GNU General Public License, if you 26 | # distribute this file as part of a program that contains a 27 | # configuration script generated by Autoconf, you may include it under 28 | # the same distribution terms that you use for the rest of that program. 29 | 30 | if test $# -eq 0; then 31 | echo 1>&2 "Try \`$0 --help' for more information" 32 | exit 1 33 | fi 34 | 35 | run=: 36 | 37 | # In the cases where this matters, `missing' is being run in the 38 | # srcdir already. 39 | if test -f configure.ac; then 40 | configure_ac=configure.ac 41 | else 42 | configure_ac=configure.in 43 | fi 44 | 45 | msg="missing on your system" 46 | 47 | case "$1" in 48 | --run) 49 | # Try to run requested program, and just exit if it succeeds. 50 | run= 51 | shift 52 | "$@" && exit 0 53 | # Exit code 63 means version mismatch. This often happens 54 | # when the user try to use an ancient version of a tool on 55 | # a file that requires a minimum version. In this case we 56 | # we should proceed has if the program had been absent, or 57 | # if --run hadn't been passed. 58 | if test $? = 63; then 59 | run=: 60 | msg="probably too old" 61 | fi 62 | ;; 63 | 64 | -h|--h|--he|--hel|--help) 65 | echo "\ 66 | $0 [OPTION]... PROGRAM [ARGUMENT]... 67 | 68 | Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69 | error status if there is no known handling for PROGRAM. 70 | 71 | Options: 72 | -h, --help display this help and exit 73 | -v, --version output version information and exit 74 | --run try to run the given command, and emulate it if it fails 75 | 76 | Supported PROGRAM values: 77 | aclocal touch file \`aclocal.m4' 78 | autoconf touch file \`configure' 79 | autoheader touch file \`config.h.in' 80 | automake touch all \`Makefile.in' files 81 | bison create \`y.tab.[ch]', if possible, from existing .[ch] 82 | flex create \`lex.yy.c', if possible, from existing .c 83 | help2man touch the output file 84 | lex create \`lex.yy.c', if possible, from existing .c 85 | makeinfo touch the output file 86 | tar try tar, gnutar, gtar, then tar without non-portable flags 87 | yacc create \`y.tab.[ch]', if possible, from existing .[ch] 88 | 89 | Send bug reports to ." 90 | exit $? 91 | ;; 92 | 93 | -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 94 | echo "missing $scriptversion (GNU Automake)" 95 | exit $? 96 | ;; 97 | 98 | -*) 99 | echo 1>&2 "$0: Unknown \`$1' option" 100 | echo 1>&2 "Try \`$0 --help' for more information" 101 | exit 1 102 | ;; 103 | 104 | esac 105 | 106 | # Now exit if we have it, but it failed. Also exit now if we 107 | # don't have it and --version was passed (most likely to detect 108 | # the program). 109 | case "$1" in 110 | lex|yacc) 111 | # Not GNU programs, they don't have --version. 112 | ;; 113 | 114 | tar) 115 | if test -n "$run"; then 116 | echo 1>&2 "ERROR: \`tar' requires --run" 117 | exit 1 118 | elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 119 | exit 1 120 | fi 121 | ;; 122 | 123 | *) 124 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 125 | # We have it, but it failed. 126 | exit 1 127 | elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 128 | # Could not run --version or --help. This is probably someone 129 | # running `$TOOL --version' or `$TOOL --help' to check whether 130 | # $TOOL exists and not knowing $TOOL uses missing. 131 | exit 1 132 | fi 133 | ;; 134 | esac 135 | 136 | # If it does not exist, or fails to run (possibly an outdated version), 137 | # try to emulate it. 138 | case "$1" in 139 | aclocal*) 140 | echo 1>&2 "\ 141 | WARNING: \`$1' is $msg. You should only need it if 142 | you modified \`acinclude.m4' or \`${configure_ac}'. You might want 143 | to install the \`Automake' and \`Perl' packages. Grab them from 144 | any GNU archive site." 145 | touch aclocal.m4 146 | ;; 147 | 148 | autoconf) 149 | echo 1>&2 "\ 150 | WARNING: \`$1' is $msg. You should only need it if 151 | you modified \`${configure_ac}'. You might want to install the 152 | \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 153 | archive site." 154 | touch configure 155 | ;; 156 | 157 | autoheader) 158 | echo 1>&2 "\ 159 | WARNING: \`$1' is $msg. You should only need it if 160 | you modified \`acconfig.h' or \`${configure_ac}'. You might want 161 | to install the \`Autoconf' and \`GNU m4' packages. Grab them 162 | from any GNU archive site." 163 | files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 164 | test -z "$files" && files="config.h" 165 | touch_files= 166 | for f in $files; do 167 | case "$f" in 168 | *:*) touch_files="$touch_files "`echo "$f" | 169 | sed -e 's/^[^:]*://' -e 's/:.*//'`;; 170 | *) touch_files="$touch_files $f.in";; 171 | esac 172 | done 173 | touch $touch_files 174 | ;; 175 | 176 | automake*) 177 | echo 1>&2 "\ 178 | WARNING: \`$1' is $msg. You should only need it if 179 | you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 180 | You might want to install the \`Automake' and \`Perl' packages. 181 | Grab them from any GNU archive site." 182 | find . -type f -name Makefile.am -print | 183 | sed 's/\.am$/.in/' | 184 | while read f; do touch "$f"; done 185 | ;; 186 | 187 | autom4te) 188 | echo 1>&2 "\ 189 | WARNING: \`$1' is needed, but is $msg. 190 | You might have modified some files without having the 191 | proper tools for further handling them. 192 | You can get \`$1' as part of \`Autoconf' from any GNU 193 | archive site." 194 | 195 | file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 196 | test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 197 | if test -f "$file"; then 198 | touch $file 199 | else 200 | test -z "$file" || exec >$file 201 | echo "#! /bin/sh" 202 | echo "# Created by GNU Automake missing as a replacement of" 203 | echo "# $ $@" 204 | echo "exit 0" 205 | chmod +x $file 206 | exit 1 207 | fi 208 | ;; 209 | 210 | bison|yacc) 211 | echo 1>&2 "\ 212 | WARNING: \`$1' $msg. You should only need it if 213 | you modified a \`.y' file. You may need the \`Bison' package 214 | in order for those modifications to take effect. You can get 215 | \`Bison' from any GNU archive site." 216 | rm -f y.tab.c y.tab.h 217 | if [ $# -ne 1 ]; then 218 | eval LASTARG="\${$#}" 219 | case "$LASTARG" in 220 | *.y) 221 | SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 222 | if [ -f "$SRCFILE" ]; then 223 | cp "$SRCFILE" y.tab.c 224 | fi 225 | SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 226 | if [ -f "$SRCFILE" ]; then 227 | cp "$SRCFILE" y.tab.h 228 | fi 229 | ;; 230 | esac 231 | fi 232 | if [ ! -f y.tab.h ]; then 233 | echo >y.tab.h 234 | fi 235 | if [ ! -f y.tab.c ]; then 236 | echo 'main() { return 0; }' >y.tab.c 237 | fi 238 | ;; 239 | 240 | lex|flex) 241 | echo 1>&2 "\ 242 | WARNING: \`$1' is $msg. You should only need it if 243 | you modified a \`.l' file. You may need the \`Flex' package 244 | in order for those modifications to take effect. You can get 245 | \`Flex' from any GNU archive site." 246 | rm -f lex.yy.c 247 | if [ $# -ne 1 ]; then 248 | eval LASTARG="\${$#}" 249 | case "$LASTARG" in 250 | *.l) 251 | SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 252 | if [ -f "$SRCFILE" ]; then 253 | cp "$SRCFILE" lex.yy.c 254 | fi 255 | ;; 256 | esac 257 | fi 258 | if [ ! -f lex.yy.c ]; then 259 | echo 'main() { return 0; }' >lex.yy.c 260 | fi 261 | ;; 262 | 263 | help2man) 264 | echo 1>&2 "\ 265 | WARNING: \`$1' is $msg. You should only need it if 266 | you modified a dependency of a manual page. You may need the 267 | \`Help2man' package in order for those modifications to take 268 | effect. You can get \`Help2man' from any GNU archive site." 269 | 270 | file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 271 | if test -z "$file"; then 272 | file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 273 | fi 274 | if [ -f "$file" ]; then 275 | touch $file 276 | else 277 | test -z "$file" || exec >$file 278 | echo ".ab help2man is required to generate this page" 279 | exit 1 280 | fi 281 | ;; 282 | 283 | makeinfo) 284 | echo 1>&2 "\ 285 | WARNING: \`$1' is $msg. You should only need it if 286 | you modified a \`.texi' or \`.texinfo' file, or any other file 287 | indirectly affecting the aspect of the manual. The spurious 288 | call might also be the consequence of using a buggy \`make' (AIX, 289 | DU, IRIX). You might want to install the \`Texinfo' package or 290 | the \`GNU make' package. Grab either from any GNU archive site." 291 | # The file to touch is that specified with -o ... 292 | file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 293 | if test -z "$file"; then 294 | # ... or it is the one specified with @setfilename ... 295 | infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 296 | file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` 297 | # ... or it is derived from the source name (dir/f.texi becomes f.info) 298 | test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 299 | fi 300 | # If the file does not exist, the user really needs makeinfo; 301 | # let's fail without touching anything. 302 | test -f $file || exit 1 303 | touch $file 304 | ;; 305 | 306 | tar) 307 | shift 308 | 309 | # We have already tried tar in the generic part. 310 | # Look for gnutar/gtar before invocation to avoid ugly error 311 | # messages. 312 | if (gnutar --version > /dev/null 2>&1); then 313 | gnutar "$@" && exit 0 314 | fi 315 | if (gtar --version > /dev/null 2>&1); then 316 | gtar "$@" && exit 0 317 | fi 318 | firstarg="$1" 319 | if shift; then 320 | case "$firstarg" in 321 | *o*) 322 | firstarg=`echo "$firstarg" | sed s/o//` 323 | tar "$firstarg" "$@" && exit 0 324 | ;; 325 | esac 326 | case "$firstarg" in 327 | *h*) 328 | firstarg=`echo "$firstarg" | sed s/h//` 329 | tar "$firstarg" "$@" && exit 0 330 | ;; 331 | esac 332 | fi 333 | 334 | echo 1>&2 "\ 335 | WARNING: I can't seem to be able to run \`tar' with the given arguments. 336 | You may want to install GNU tar or Free paxutils, or check the 337 | command line arguments." 338 | exit 1 339 | ;; 340 | 341 | *) 342 | echo 1>&2 "\ 343 | WARNING: \`$1' is needed, and is $msg. 344 | You might have modified some files without having the 345 | proper tools for further handling them. Check the \`README' file, 346 | it often tells you about the needed prerequisites for installing 347 | this package. You may also peek at any GNU archive site, in case 348 | some other package would contain this missing \`$1' program." 349 | exit 1 350 | ;; 351 | esac 352 | 353 | exit 0 354 | 355 | # Local variables: 356 | # eval: (add-hook 'write-file-hooks 'time-stamp) 357 | # time-stamp-start: "scriptversion=" 358 | # time-stamp-format: "%:y-%02m-%02d.%02H" 359 | # time-stamp-end: "$" 360 | # End: 361 | -------------------------------------------------------------------------------- /mkinstalldirs: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # mkinstalldirs --- make directory hierarchy 3 | 4 | scriptversion=2005-06-29.22 5 | 6 | # Original author: Noah Friedman 7 | # Created: 1993-05-16 8 | # Public domain. 9 | # 10 | # This file is maintained in Automake, please report 11 | # bugs to or send patches to 12 | # . 13 | 14 | errstatus=0 15 | dirmode= 16 | 17 | usage="\ 18 | Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... 19 | 20 | Create each directory DIR (with mode MODE, if specified), including all 21 | leading file name components. 22 | 23 | Report bugs to ." 24 | 25 | # process command line arguments 26 | while test $# -gt 0 ; do 27 | case $1 in 28 | -h | --help | --h*) # -h for help 29 | echo "$usage" 30 | exit $? 31 | ;; 32 | -m) # -m PERM arg 33 | shift 34 | test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } 35 | dirmode=$1 36 | shift 37 | ;; 38 | --version) 39 | echo "$0 $scriptversion" 40 | exit $? 41 | ;; 42 | --) # stop option processing 43 | shift 44 | break 45 | ;; 46 | -*) # unknown option 47 | echo "$usage" 1>&2 48 | exit 1 49 | ;; 50 | *) # first non-opt arg 51 | break 52 | ;; 53 | esac 54 | done 55 | 56 | for file 57 | do 58 | if test -d "$file"; then 59 | shift 60 | else 61 | break 62 | fi 63 | done 64 | 65 | case $# in 66 | 0) exit 0 ;; 67 | esac 68 | 69 | # Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and 70 | # mkdir -p a/c at the same time, both will detect that a is missing, 71 | # one will create a, then the other will try to create a and die with 72 | # a "File exists" error. This is a problem when calling mkinstalldirs 73 | # from a parallel make. We use --version in the probe to restrict 74 | # ourselves to GNU mkdir, which is thread-safe. 75 | case $dirmode in 76 | '') 77 | if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then 78 | echo "mkdir -p -- $*" 79 | exec mkdir -p -- "$@" 80 | else 81 | # On NextStep and OpenStep, the `mkdir' command does not 82 | # recognize any option. It will interpret all options as 83 | # directories to create, and then abort because `.' already 84 | # exists. 85 | test -d ./-p && rmdir ./-p 86 | test -d ./--version && rmdir ./--version 87 | fi 88 | ;; 89 | *) 90 | if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && 91 | test ! -d ./--version; then 92 | echo "mkdir -m $dirmode -p -- $*" 93 | exec mkdir -m "$dirmode" -p -- "$@" 94 | else 95 | # Clean up after NextStep and OpenStep mkdir. 96 | for d in ./-m ./-p ./--version "./$dirmode"; 97 | do 98 | test -d $d && rmdir $d 99 | done 100 | fi 101 | ;; 102 | esac 103 | 104 | for file 105 | do 106 | case $file in 107 | /*) pathcomp=/ ;; 108 | *) pathcomp= ;; 109 | esac 110 | oIFS=$IFS 111 | IFS=/ 112 | set fnord $file 113 | shift 114 | IFS=$oIFS 115 | 116 | for d 117 | do 118 | test "x$d" = x && continue 119 | 120 | pathcomp=$pathcomp$d 121 | case $pathcomp in 122 | -*) pathcomp=./$pathcomp ;; 123 | esac 124 | 125 | if test ! -d "$pathcomp"; then 126 | echo "mkdir $pathcomp" 127 | 128 | mkdir "$pathcomp" || lasterr=$? 129 | 130 | if test ! -d "$pathcomp"; then 131 | errstatus=$lasterr 132 | else 133 | if test ! -z "$dirmode"; then 134 | echo "chmod $dirmode $pathcomp" 135 | lasterr= 136 | chmod "$dirmode" "$pathcomp" || lasterr=$? 137 | 138 | if test ! -z "$lasterr"; then 139 | errstatus=$lasterr 140 | fi 141 | fi 142 | fi 143 | fi 144 | 145 | pathcomp=$pathcomp/ 146 | done 147 | done 148 | 149 | exit $errstatus 150 | 151 | # Local Variables: 152 | # mode: shell-script 153 | # sh-indentation: 2 154 | # eval: (add-hook 'write-file-hooks 'time-stamp) 155 | # time-stamp-start: "scriptversion=" 156 | # time-stamp-format: "%:y-%02m-%02d.%02H" 157 | # time-stamp-end: "$" 158 | # End: 159 | -------------------------------------------------------------------------------- /pcl/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | INCLUDES = -I$(srcdir)/../include 3 | 4 | lib_LTLIBRARIES = libpcl.la 5 | libpcl_la_SOURCES = pcl.c pcl_version.c pcl_private.c 6 | libpcl_la_LDFLAGS = -version-info 1:11:0 -lpthread 7 | 8 | -------------------------------------------------------------------------------- /pcl/pcl.c: -------------------------------------------------------------------------------- 1 | /* 2 | * PCL by Davide Libenzi (Portable Coroutine Library) 3 | * Copyright (C) 2003..2010 Davide Libenzi 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | * Davide Libenzi 20 | * 21 | */ 22 | 23 | #include 24 | #include 25 | #include "pcl_config.h" 26 | #include "pcl.h" 27 | #include "pcl_private.h" 28 | 29 | #if defined(CO_USE_SIGCONTEXT) 30 | #include 31 | #endif 32 | 33 | #if defined(CO_USE_SIGCONTEXT) 34 | 35 | /* 36 | * Multi thread and CO_USE_SIGCONTEXT are a NO GO! 37 | */ 38 | #if defined(CO_MULTI_THREAD) 39 | #error "Sorry, it is not possible to use MT libpcl with CO_USE_SIGCONTEXT" 40 | #endif 41 | 42 | static volatile int ctx_called; 43 | static co_ctx_t *ctx_creating; 44 | static void *ctx_creating_func; 45 | static sigset_t ctx_creating_sigs; 46 | static co_ctx_t ctx_trampoline; 47 | static co_ctx_t ctx_caller; 48 | 49 | #endif /* #if defined(CO_USE_SIGCONTEXT) */ 50 | 51 | 52 | static int co_ctx_sdir(unsigned long psp) 53 | { 54 | int nav = 0; 55 | unsigned long csp = (unsigned long) &nav; 56 | 57 | return psp > csp ? -1: +1; 58 | } 59 | 60 | static int co_ctx_stackdir(void) 61 | { 62 | int cav = 0; 63 | 64 | return co_ctx_sdir((unsigned long) &cav); 65 | } 66 | 67 | #if defined(CO_USE_UCONEXT) 68 | 69 | static int co_set_context(co_ctx_t *ctx, void *func, char *stkbase, long stksiz) 70 | { 71 | if (getcontext(&ctx->cc)) 72 | return -1; 73 | 74 | ctx->cc.uc_link = NULL; 75 | 76 | ctx->cc.uc_stack.ss_sp = stkbase; 77 | ctx->cc.uc_stack.ss_size = stksiz - sizeof(long); 78 | ctx->cc.uc_stack.ss_flags = 0; 79 | 80 | makecontext(&ctx->cc, func, 1); 81 | 82 | return 0; 83 | } 84 | 85 | static void co_switch_context(co_ctx_t *octx, co_ctx_t *nctx) 86 | { 87 | cothread_ctx *tctx = co_get_thread_ctx(); 88 | 89 | if (swapcontext(&octx->cc, &nctx->cc) < 0) { 90 | fprintf(stderr, "[PCL] Context switch failed: curr=%p\n", 91 | tctx->co_curr); 92 | exit(1); 93 | } 94 | } 95 | 96 | #else /* #if defined(CO_USE_UCONEXT) */ 97 | 98 | #if defined(CO_USE_SIGCONTEXT) 99 | 100 | /* 101 | * This code comes from the GNU Pth implementation and uses the 102 | * sigstack/sigaltstack() trick. 103 | * 104 | * The ingenious fact is that this variant runs really on _all_ POSIX 105 | * compliant systems without special platform kludges. But be _VERY_ 106 | * carefully when you change something in the following code. The slightest 107 | * change or reordering can lead to horribly broken code. Really every 108 | * function call in the following case is intended to be how it is, doubt 109 | * me... 110 | * 111 | * For more details we strongly recommend you to read the companion 112 | * paper ``Portable Multithreading -- The Signal Stack Trick for 113 | * User-Space Thread Creation'' from Ralf S. Engelschall. 114 | */ 115 | static void co_ctx_bootstrap(void) 116 | { 117 | cothread_ctx *tctx = co_get_thread_ctx(); 118 | co_ctx_t * volatile ctx_starting; 119 | void (* volatile ctx_starting_func)(void); 120 | 121 | /* 122 | * Switch to the final signal mask (inherited from parent) 123 | */ 124 | sigprocmask(SIG_SETMASK, &ctx_creating_sigs, NULL); 125 | 126 | /* 127 | * Move startup details from static storage to local auto 128 | * variables which is necessary because it has to survive in 129 | * a local context until the thread is scheduled for real. 130 | */ 131 | ctx_starting = ctx_creating; 132 | ctx_starting_func = (void (*)(void)) ctx_creating_func; 133 | 134 | /* 135 | * Save current machine state (on new stack) and 136 | * go back to caller until we're scheduled for real... 137 | */ 138 | if (!setjmp(ctx_starting->cc)) 139 | longjmp(ctx_caller.cc, 1); 140 | 141 | /* 142 | * The new thread is now running: GREAT! 143 | * Now we just invoke its init function.... 144 | */ 145 | ctx_starting_func(); 146 | 147 | fprintf(stderr, "[PCL] Hmm, you really shouldn't reach this point: curr=%p\n", 148 | tctx->co_curr); 149 | exit(1); 150 | } 151 | 152 | static void co_ctx_trampoline(int sig) 153 | { 154 | /* 155 | * Save current machine state and _immediately_ go back with 156 | * a standard "return" (to stop the signal handler situation) 157 | * to let him remove the stack again. Notice that we really 158 | * have do a normal "return" here, or the OS would consider 159 | * the thread to be running on a signal stack which isn't 160 | * good (for instance it wouldn't allow us to spawn a thread 161 | * from within a thread, etc.) 162 | */ 163 | if (setjmp(ctx_trampoline.cc) == 0) { 164 | ctx_called = 1; 165 | return; 166 | } 167 | 168 | /* 169 | * Ok, the caller has longjmp'ed back to us, so now prepare 170 | * us for the real machine state switching. We have to jump 171 | * into another function here to get a new stack context for 172 | * the auto variables (which have to be auto-variables 173 | * because the start of the thread happens later). 174 | */ 175 | co_ctx_bootstrap(); 176 | } 177 | 178 | static int co_set_context(co_ctx_t *ctx, void *func, char *stkbase, long stksiz) 179 | { 180 | struct sigaction sa; 181 | struct sigaction osa; 182 | sigset_t osigs; 183 | sigset_t sigs; 184 | #if defined(CO_HAS_SIGSTACK) 185 | struct sigstack ss; 186 | struct sigstack oss; 187 | #elif defined(CO_HAS_SIGALTSTACK) 188 | struct sigaltstack ss; 189 | struct sigaltstack oss; 190 | #else 191 | #error "PCL: Unknown context stack type" 192 | #endif 193 | 194 | /* 195 | * Preserve the SIGUSR1 signal state, block SIGUSR1, 196 | * and establish our signal handler. The signal will 197 | * later transfer control onto the signal stack. 198 | */ 199 | sigemptyset(&sigs); 200 | sigaddset(&sigs, SIGUSR1); 201 | sigprocmask(SIG_BLOCK, &sigs, &osigs); 202 | sa.sa_handler = co_ctx_trampoline; 203 | sigemptyset(&sa.sa_mask); 204 | sa.sa_flags = SA_ONSTACK; 205 | if (sigaction(SIGUSR1, &sa, &osa) != 0) 206 | return -1; 207 | 208 | /* 209 | * Set the new stack. 210 | * 211 | * For sigaltstack we're lucky [from sigaltstack(2) on 212 | * FreeBSD 3.1]: ``Signal stacks are automatically adjusted 213 | * for the direction of stack growth and alignment 214 | * requirements'' 215 | * 216 | * For sigstack we have to decide ourself [from sigstack(2) 217 | * on Solaris 2.6]: ``The direction of stack growth is not 218 | * indicated in the historical definition of struct sigstack. 219 | * The only way to portably establish a stack pointer is for 220 | * the application to determine stack growth direction.'' 221 | */ 222 | #if defined(CO_HAS_SIGALTSTACK) 223 | ss.ss_sp = stkbase; 224 | ss.ss_size = stksiz - sizeof(long); 225 | ss.ss_flags = 0; 226 | if (sigaltstack(&ss, &oss) < 0) 227 | return -1; 228 | #elif defined(CO_HAS_SIGSTACK) 229 | if (co_ctx_stackdir() < 0) 230 | ss.ss_sp = (stkbase + stksiz - sizeof(long)); 231 | else 232 | ss.ss_sp = stkbase; 233 | ss.ss_onstack = 0; 234 | if (sigstack(&ss, &oss) < 0) 235 | return -1; 236 | #else 237 | #error "PCL: Unknown context stack type" 238 | #endif 239 | 240 | /* 241 | * Now transfer control onto the signal stack and set it up. 242 | * It will return immediately via "return" after the setjmp() 243 | * was performed. Be careful here with race conditions. The 244 | * signal can be delivered the first time sigsuspend() is 245 | * called. 246 | */ 247 | ctx_called = 0; 248 | kill(getpid(), SIGUSR1); 249 | sigfillset(&sigs); 250 | sigdelset(&sigs, SIGUSR1); 251 | while (!ctx_called) 252 | sigsuspend(&sigs); 253 | 254 | /* 255 | * Inform the system that we are back off the signal stack by 256 | * removing the alternative signal stack. Be careful here: It 257 | * first has to be disabled, before it can be removed. 258 | */ 259 | #if defined(CO_HAS_SIGALTSTACK) 260 | sigaltstack(NULL, &ss); 261 | ss.ss_flags = SS_DISABLE; 262 | if (sigaltstack(&ss, NULL) < 0) 263 | return -1; 264 | sigaltstack(NULL, &ss); 265 | if (!(ss.ss_flags & SS_DISABLE)) 266 | return -1; 267 | if (!(oss.ss_flags & SS_DISABLE)) 268 | sigaltstack(&oss, NULL); 269 | #elif defined(CO_HAS_SIGSTACK) 270 | if (sigstack(&oss, NULL)) 271 | return -1; 272 | #else 273 | #error "PCL: Unknown context stack type" 274 | #endif 275 | 276 | /* 277 | * Restore the old SIGUSR1 signal handler and mask 278 | */ 279 | sigaction(SIGUSR1, &osa, NULL); 280 | sigprocmask(SIG_SETMASK, &osigs, NULL); 281 | 282 | /* 283 | * Set creation information. 284 | */ 285 | ctx_creating = ctx; 286 | ctx_creating_func = func; 287 | memcpy(&ctx_creating_sigs, &osigs, sizeof(sigset_t)); 288 | 289 | /* 290 | * Now enter the trampoline again, but this time not as a signal 291 | * handler. Instead we jump into it directly. 292 | */ 293 | if (setjmp(ctx_caller.cc) == 0) 294 | longjmp(ctx_trampoline.cc, 1); 295 | 296 | return 0; 297 | } 298 | 299 | #else /* #if defined(CO_USE_SIGCONTEXT) */ 300 | 301 | static int co_set_context(co_ctx_t *ctx, void *func, char *stkbase, long stksiz) 302 | { 303 | char *stack; 304 | 305 | stack = stkbase + stksiz - sizeof(long); 306 | 307 | setjmp(ctx->cc); 308 | 309 | #if defined(__GLIBC__) && defined(__GLIBC_MINOR__) \ 310 | && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 0 && defined(JB_PC) && defined(JB_SP) 311 | ctx->cc[0].__jmpbuf[JB_PC] = (int) func; 312 | ctx->cc[0].__jmpbuf[JB_SP] = (int) stack; 313 | #elif defined(__GLIBC__) && defined(__GLIBC_MINOR__) \ 314 | && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 0 && defined(__mc68000__) 315 | ctx->cc[0].__jmpbuf[0].__aregs[0] = (long) func; 316 | ctx->cc[0].__jmpbuf[0].__sp = (int *) stack; 317 | #elif defined(__GNU_LIBRARY__) && defined(__i386__) 318 | ctx->cc[0].__jmpbuf[0].__pc = func; 319 | ctx->cc[0].__jmpbuf[0].__sp = stack; 320 | #elif defined(__MINGW32__) 321 | ctx->cc[5] = (long) func; 322 | ctx->cc[4] = (long) stack; 323 | #elif defined(__APPLE__) 324 | /* START Apple */ 325 | #if defined(__x86_64__) 326 | *(long *) ((char *) &ctx->cc + 56) = (long) func; 327 | *(long *) ((char *) &ctx->cc + 16) = (long) stack; 328 | #elif defined(__i386__) 329 | *(long *) ((char *) &ctx->cc + 48) = (long) func; 330 | *(long *) ((char *) &ctx->cc + 36) = (long) stack; 331 | #elif defined(__arm__) 332 | *(long *) ((char *) &ctx->cc + 32) = (long) func; 333 | *(long *) ((char *) &ctx->cc + 28) = (long) stack; 334 | #else 335 | #error "PCL: Unsupported setjmp/longjmp OSX CPU. Please report to " 336 | #endif 337 | /* END Apple */ 338 | #elif defined(_WIN32) && defined(_MSC_VER) 339 | /* START Windows */ 340 | #if defined(_M_IX86) 341 | ((_JUMP_BUFFER *) &ctx->cc)->Eip = (long) func; 342 | ((_JUMP_BUFFER *) &ctx->cc)->Esp = (long) stack; 343 | #elif defined(_M_AMD64) 344 | ((_JUMP_BUFFER *) &ctx->cc)->Rip = (long) func; 345 | ((_JUMP_BUFFER *) &ctx->cc)->Rsp = (long) stack; 346 | #else 347 | #error "PCL: Unsupported setjmp/longjmp Windows CPU. Please report to " 348 | #endif 349 | /* END Windows */ 350 | #elif defined(__GLIBC__) && defined(__GLIBC_MINOR__) \ 351 | && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 0 && (defined(__powerpc64__) || defined(__powerpc__)) 352 | ctx->cc[0].__jmpbuf[JB_LR] = (int) func; 353 | ctx->cc[0].__jmpbuf[JB_GPR1] = (int) stack; 354 | #else 355 | #error "PCL: Unsupported setjmp/longjmp platform. Please report to " 356 | #endif 357 | 358 | return 0; 359 | } 360 | 361 | #endif /* #if defined(CO_USE_SIGCONTEXT) */ 362 | 363 | static void co_switch_context(co_ctx_t *octx, co_ctx_t *nctx) 364 | { 365 | if (setjmp(octx->cc) == 0) 366 | longjmp(nctx->cc, 1); 367 | } 368 | 369 | #endif /* #if defined(CO_USE_UCONEXT) */ 370 | 371 | static void co_runner(void) 372 | { 373 | cothread_ctx *tctx = co_get_thread_ctx(); 374 | coroutine *co = tctx->co_curr; 375 | 376 | co->restarget = co->caller; 377 | co->func(co->data); 378 | co_exit(); 379 | } 380 | 381 | coroutine_t co_create(void (*func)(void *), void *data, void *stack, int size) 382 | { 383 | int alloc = 0, r = CO_STK_COROSIZE; 384 | coroutine *co; 385 | 386 | if ((size &= ~(sizeof(long) - 1)) < CO_MIN_SIZE) 387 | return NULL; 388 | if (stack == NULL) { 389 | size = (size + sizeof(coroutine) + CO_STK_ALIGN - 1) & ~(CO_STK_ALIGN - 1); 390 | stack = malloc(size); 391 | if (stack == NULL) 392 | return NULL; 393 | alloc = size; 394 | } 395 | co = stack; 396 | stack = (char *) stack + CO_STK_COROSIZE; 397 | co->alloc = alloc; 398 | co->func = func; 399 | co->data = data; 400 | if (co_set_context(&co->ctx, co_runner, stack, size - CO_STK_COROSIZE) < 0) { 401 | if (alloc) 402 | free(co); 403 | return NULL; 404 | } 405 | 406 | return (coroutine_t) co; 407 | } 408 | 409 | void co_delete(coroutine_t coro) 410 | { 411 | cothread_ctx *tctx = co_get_thread_ctx(); 412 | coroutine *co = (coroutine *) coro; 413 | 414 | if (co == tctx->co_curr) { 415 | fprintf(stderr, "[PCL] Cannot delete itself: curr=%p\n", 416 | tctx->co_curr); 417 | exit(1); 418 | } 419 | if (co->alloc) 420 | free(co); 421 | } 422 | 423 | void co_call(coroutine_t coro) 424 | { 425 | cothread_ctx *tctx = co_get_thread_ctx(); 426 | coroutine *co = (coroutine *) coro, *oldco = tctx->co_curr; 427 | 428 | co->caller = tctx->co_curr; 429 | tctx->co_curr = co; 430 | 431 | co_switch_context(&oldco->ctx, &co->ctx); 432 | } 433 | 434 | void co_resume(void) 435 | { 436 | cothread_ctx *tctx = co_get_thread_ctx(); 437 | 438 | co_call(tctx->co_curr->restarget); 439 | tctx->co_curr->restarget = tctx->co_curr->caller; 440 | } 441 | 442 | static void co_del_helper(void *data) 443 | { 444 | cothread_ctx *tctx; 445 | coroutine *cdh; 446 | 447 | for (;;) { 448 | tctx = co_get_thread_ctx(); 449 | cdh = tctx->co_dhelper; 450 | tctx->co_dhelper = NULL; 451 | co_delete(tctx->co_curr->caller); 452 | co_call((coroutine_t) cdh); 453 | if (tctx->co_dhelper == NULL) { 454 | fprintf(stderr, 455 | "[PCL] Resume to delete helper coroutine: curr=%p caller=%p\n", 456 | tctx->co_curr, tctx->co_curr->caller); 457 | exit(1); 458 | } 459 | } 460 | } 461 | 462 | void co_exit_to(coroutine_t coro) 463 | { 464 | cothread_ctx *tctx = co_get_thread_ctx(); 465 | coroutine *co = (coroutine *) coro; 466 | 467 | if (tctx->dchelper == NULL && 468 | (tctx->dchelper = co_create(co_del_helper, NULL, 469 | tctx->stk, sizeof(tctx->stk))) == NULL) { 470 | fprintf(stderr, "[PCL] Unable to create delete helper coroutine: curr=%p\n", 471 | tctx->co_curr); 472 | exit(1); 473 | } 474 | tctx->co_dhelper = co; 475 | 476 | co_call((coroutine_t) tctx->dchelper); 477 | 478 | fprintf(stderr, "[PCL] Stale coroutine called: curr=%p exitto=%p caller=%p\n", 479 | tctx->co_curr, co, tctx->co_curr->caller); 480 | exit(1); 481 | } 482 | 483 | void co_exit(void) 484 | { 485 | cothread_ctx *tctx = co_get_thread_ctx(); 486 | 487 | co_exit_to((coroutine_t) tctx->co_curr->restarget); 488 | } 489 | 490 | coroutine_t co_current(void) 491 | { 492 | cothread_ctx *tctx = co_get_thread_ctx(); 493 | 494 | return (coroutine_t) tctx->co_curr; 495 | } 496 | 497 | void *co_get_data(coroutine_t coro) 498 | { 499 | coroutine *co = (coroutine *) coro; 500 | 501 | return co->data; 502 | } 503 | 504 | void *co_set_data(coroutine_t coro, void *data) 505 | { 506 | coroutine *co = (coroutine *) coro; 507 | void *odata; 508 | 509 | odata = co->data; 510 | co->data = data; 511 | 512 | return odata; 513 | } 514 | 515 | -------------------------------------------------------------------------------- /pcl/pcl_private.c: -------------------------------------------------------------------------------- 1 | /* 2 | * PCL by Davide Libenzi (Portable Coroutine Library) 3 | * Copyright (C) 2003..2010 Davide Libenzi 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | * Davide Libenzi 20 | * 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | #include "pcl_config.h" 27 | #include "pcl.h" 28 | #include "pcl_private.h" 29 | 30 | static cothread_ctx *co_get_global_ctx(void) 31 | { 32 | static cothread_ctx tctx; 33 | 34 | if (tctx.co_curr == NULL) 35 | tctx.co_curr = &tctx.co_main; 36 | 37 | return &tctx; 38 | } 39 | 40 | #if !defined(CO_MULTI_THREAD) 41 | /* 42 | * Simple case, the single thread one ... 43 | */ 44 | 45 | int co_thread_init(void) 46 | { 47 | return 0; 48 | } 49 | 50 | void co_thread_cleanup(void) 51 | { 52 | 53 | } 54 | 55 | cothread_ctx *co_get_thread_ctx(void) 56 | { 57 | return co_get_global_ctx(); 58 | } 59 | 60 | #else 61 | /* 62 | * MultiThread cases ... 63 | */ 64 | 65 | #if defined(_WIN32) && defined(_MSC_VER) 66 | /* 67 | * On Windows, we can use the native TLS capabilities. Pretty easy ... 68 | */ 69 | static __declspec(thread) cothread_ctx *tctx; 70 | 71 | int co_thread_init(void) 72 | { 73 | if ((tctx = (cothread_ctx *) 74 | malloc(sizeof(cothread_ctx))) == NULL) { 75 | perror("allocating context"); 76 | return -1; 77 | } 78 | memset(tctx, 0, sizeof(*tctx)); 79 | tctx->co_curr = &tctx->co_main; 80 | 81 | return 0; 82 | } 83 | 84 | void co_thread_cleanup(void) 85 | { 86 | free(tctx); 87 | } 88 | 89 | cothread_ctx *co_get_thread_ctx(void) 90 | { 91 | /* 92 | * Even in MT mode, allows for the main thread to not call 93 | * the co_thread_init()/co_thread_cleanup() functions. 94 | */ 95 | return tctx != NULL ? tctx: co_get_global_ctx(); 96 | } 97 | 98 | #else 99 | /* 100 | * On Unix, we use pthread. Sligthly more complicated ... 101 | */ 102 | #include 103 | 104 | static int valid_key; 105 | static pthread_key_t key; 106 | static pthread_once_t once_control = PTHREAD_ONCE_INIT; 107 | 108 | static void co_once_init(void) 109 | { 110 | if (pthread_key_create(&key, free)) 111 | perror("creating TLS key"); 112 | else 113 | valid_key++; 114 | } 115 | 116 | int co_thread_init(void) 117 | { 118 | cothread_ctx *tctx; 119 | 120 | pthread_once(&once_control, co_once_init); 121 | if (!valid_key) 122 | return -1; 123 | 124 | if ((tctx = (cothread_ctx *) 125 | malloc(sizeof(cothread_ctx))) == NULL) { 126 | perror("allocating context"); 127 | return -1; 128 | } 129 | memset(tctx, 0, sizeof(*tctx)); 130 | tctx->co_curr = &tctx->co_main; 131 | if (pthread_setspecific(key, tctx)) { 132 | perror("setting thread context"); 133 | free(tctx); 134 | return -1; 135 | } 136 | 137 | return 0; 138 | } 139 | 140 | void co_thread_cleanup(void) 141 | { 142 | 143 | } 144 | 145 | cothread_ctx *co_get_thread_ctx(void) 146 | { 147 | cothread_ctx *tctx = (cothread_ctx *) 148 | (valid_key ? pthread_getspecific(key): NULL); 149 | 150 | /* 151 | * Even in MT mode, allows for the main thread to not call 152 | * the co_thread_init()/co_thread_cleanup() functions. 153 | */ 154 | return tctx != NULL ? tctx: co_get_global_ctx(); 155 | } 156 | 157 | #endif 158 | #endif 159 | 160 | -------------------------------------------------------------------------------- /pcl/pcl_version.c: -------------------------------------------------------------------------------- 1 | /* 2 | * PCL by Davide Libenzi (Portable Coroutine Library) 3 | * Copyright (C) 2003..2010 Davide Libenzi 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | * Davide Libenzi 20 | * 21 | */ 22 | 23 | #include "pcl_config.h" 24 | 25 | #define PCL_VERSION VERSION 26 | 27 | char const *pcl_version[] = { 28 | "Portable Coroutine Library (PCL) - Version " PCL_VERSION "\n" 29 | "Copyright (C) 2003..2010 Davide Libenzi \n" 30 | }; 31 | 32 | -------------------------------------------------------------------------------- /test/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | INCLUDES = -I$(srcdir)/../include 3 | 4 | check_PROGRAMS = cobench cothread 5 | 6 | cobench_SOURCES = cobench.c 7 | cobench_LDADD = ../pcl/.libs/libpcl.a -lpthread 8 | 9 | cothread_SOURCES = cothread.c 10 | cothread_LDADD = ../pcl/.libs/libpcl.a -lpthread 11 | 12 | -------------------------------------------------------------------------------- /test/Makefile.in: -------------------------------------------------------------------------------- 1 | # Makefile.in generated by automake 1.11.1 from Makefile.am. 2 | # @configure_input@ 3 | 4 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 5 | # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, 6 | # Inc. 7 | # This Makefile.in is free software; the Free Software Foundation 8 | # gives unlimited permission to copy and/or distribute it, 9 | # with or without modifications, as long as this notice is preserved. 10 | 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 13 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 14 | # PARTICULAR PURPOSE. 15 | 16 | @SET_MAKE@ 17 | VPATH = @srcdir@ 18 | pkgdatadir = $(datadir)/@PACKAGE@ 19 | pkgincludedir = $(includedir)/@PACKAGE@ 20 | pkglibdir = $(libdir)/@PACKAGE@ 21 | pkglibexecdir = $(libexecdir)/@PACKAGE@ 22 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 23 | install_sh_DATA = $(install_sh) -c -m 644 24 | install_sh_PROGRAM = $(install_sh) -c 25 | install_sh_SCRIPT = $(install_sh) -c 26 | INSTALL_HEADER = $(INSTALL_DATA) 27 | transform = $(program_transform_name) 28 | NORMAL_INSTALL = : 29 | PRE_INSTALL = : 30 | POST_INSTALL = : 31 | NORMAL_UNINSTALL = : 32 | PRE_UNINSTALL = : 33 | POST_UNINSTALL = : 34 | build_triplet = @build@ 35 | host_triplet = @host@ 36 | check_PROGRAMS = cobench$(EXEEXT) cothread$(EXEEXT) 37 | subdir = test 38 | DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 39 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 40 | am__aclocal_m4_deps = $(top_srcdir)/configure.in 41 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 42 | $(ACLOCAL_M4) 43 | mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 44 | CONFIG_HEADER = $(top_builddir)/config.h 45 | CONFIG_CLEAN_FILES = 46 | CONFIG_CLEAN_VPATH_FILES = 47 | am_cobench_OBJECTS = cobench.$(OBJEXT) 48 | cobench_OBJECTS = $(am_cobench_OBJECTS) 49 | cobench_DEPENDENCIES = ../pcl/.libs/libpcl.a 50 | am_cothread_OBJECTS = cothread.$(OBJEXT) 51 | cothread_OBJECTS = $(am_cothread_OBJECTS) 52 | cothread_DEPENDENCIES = ../pcl/.libs/libpcl.a 53 | DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) 54 | depcomp = $(SHELL) $(top_srcdir)/depcomp 55 | am__depfiles_maybe = depfiles 56 | am__mv = mv -f 57 | COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ 58 | $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) 59 | LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ 60 | --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ 61 | $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) 62 | CCLD = $(CC) 63 | LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ 64 | --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ 65 | $(LDFLAGS) -o $@ 66 | SOURCES = $(cobench_SOURCES) $(cothread_SOURCES) 67 | DIST_SOURCES = $(cobench_SOURCES) $(cothread_SOURCES) 68 | ETAGS = etags 69 | CTAGS = ctags 70 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 71 | ACLOCAL = @ACLOCAL@ 72 | AMTAR = @AMTAR@ 73 | AR = @AR@ 74 | AUTOCONF = @AUTOCONF@ 75 | AUTOHEADER = @AUTOHEADER@ 76 | AUTOMAKE = @AUTOMAKE@ 77 | AWK = @AWK@ 78 | CC = @CC@ 79 | CCDEPMODE = @CCDEPMODE@ 80 | CFLAGS = @CFLAGS@ 81 | CPP = @CPP@ 82 | CPPFLAGS = @CPPFLAGS@ 83 | CYGPATH_W = @CYGPATH_W@ 84 | DEFS = @DEFS@ 85 | DEPDIR = @DEPDIR@ 86 | DSYMUTIL = @DSYMUTIL@ 87 | DUMPBIN = @DUMPBIN@ 88 | ECHO_C = @ECHO_C@ 89 | ECHO_N = @ECHO_N@ 90 | ECHO_T = @ECHO_T@ 91 | EGREP = @EGREP@ 92 | EXEEXT = @EXEEXT@ 93 | FGREP = @FGREP@ 94 | GREP = @GREP@ 95 | INSTALL = @INSTALL@ 96 | INSTALL_DATA = @INSTALL_DATA@ 97 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ 98 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ 99 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 100 | LD = @LD@ 101 | LDFLAGS = @LDFLAGS@ 102 | LIBOBJS = @LIBOBJS@ 103 | LIBS = @LIBS@ 104 | LIBTOOL = @LIBTOOL@ 105 | LIPO = @LIPO@ 106 | LN_S = @LN_S@ 107 | LTLIBOBJS = @LTLIBOBJS@ 108 | MAKEINFO = @MAKEINFO@ 109 | MKDIR_P = @MKDIR_P@ 110 | NM = @NM@ 111 | NMEDIT = @NMEDIT@ 112 | OBJDUMP = @OBJDUMP@ 113 | OBJEXT = @OBJEXT@ 114 | OTOOL = @OTOOL@ 115 | OTOOL64 = @OTOOL64@ 116 | PACKAGE = @PACKAGE@ 117 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ 118 | PACKAGE_NAME = @PACKAGE_NAME@ 119 | PACKAGE_STRING = @PACKAGE_STRING@ 120 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ 121 | PACKAGE_URL = @PACKAGE_URL@ 122 | PACKAGE_VERSION = @PACKAGE_VERSION@ 123 | PATH_SEPARATOR = @PATH_SEPARATOR@ 124 | RANLIB = @RANLIB@ 125 | SED = @SED@ 126 | SET_MAKE = @SET_MAKE@ 127 | SHELL = @SHELL@ 128 | STRIP = @STRIP@ 129 | VERSION = @VERSION@ 130 | abs_builddir = @abs_builddir@ 131 | abs_srcdir = @abs_srcdir@ 132 | abs_top_builddir = @abs_top_builddir@ 133 | abs_top_srcdir = @abs_top_srcdir@ 134 | ac_ct_CC = @ac_ct_CC@ 135 | ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ 136 | am__include = @am__include@ 137 | am__leading_dot = @am__leading_dot@ 138 | am__quote = @am__quote@ 139 | am__tar = @am__tar@ 140 | am__untar = @am__untar@ 141 | bindir = @bindir@ 142 | build = @build@ 143 | build_alias = @build_alias@ 144 | build_cpu = @build_cpu@ 145 | build_os = @build_os@ 146 | build_vendor = @build_vendor@ 147 | builddir = @builddir@ 148 | datadir = @datadir@ 149 | datarootdir = @datarootdir@ 150 | docdir = @docdir@ 151 | dvidir = @dvidir@ 152 | exec_prefix = @exec_prefix@ 153 | host = @host@ 154 | host_alias = @host_alias@ 155 | host_cpu = @host_cpu@ 156 | host_os = @host_os@ 157 | host_vendor = @host_vendor@ 158 | htmldir = @htmldir@ 159 | includedir = @includedir@ 160 | infodir = @infodir@ 161 | install_sh = @install_sh@ 162 | libdir = @libdir@ 163 | libexecdir = @libexecdir@ 164 | localedir = @localedir@ 165 | localstatedir = @localstatedir@ 166 | lt_ECHO = @lt_ECHO@ 167 | mandir = @mandir@ 168 | mkdir_p = @mkdir_p@ 169 | oldincludedir = @oldincludedir@ 170 | pdfdir = @pdfdir@ 171 | prefix = @prefix@ 172 | program_transform_name = @program_transform_name@ 173 | psdir = @psdir@ 174 | sbindir = @sbindir@ 175 | sharedstatedir = @sharedstatedir@ 176 | srcdir = @srcdir@ 177 | sysconfdir = @sysconfdir@ 178 | target_alias = @target_alias@ 179 | top_build_prefix = @top_build_prefix@ 180 | top_builddir = @top_builddir@ 181 | top_srcdir = @top_srcdir@ 182 | INCLUDES = -I$(srcdir)/../include 183 | cobench_SOURCES = cobench.c 184 | cobench_LDADD = ../pcl/.libs/libpcl.a -lpthread 185 | cothread_SOURCES = cothread.c 186 | cothread_LDADD = ../pcl/.libs/libpcl.a -lpthread 187 | all: all-am 188 | 189 | .SUFFIXES: 190 | .SUFFIXES: .c .lo .o .obj 191 | $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) 192 | @for dep in $?; do \ 193 | case '$(am__configure_deps)' in \ 194 | *$$dep*) \ 195 | ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ 196 | && { if test -f $@; then exit 0; else break; fi; }; \ 197 | exit 1;; \ 198 | esac; \ 199 | done; \ 200 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/Makefile'; \ 201 | $(am__cd) $(top_srcdir) && \ 202 | $(AUTOMAKE) --gnu test/Makefile 203 | .PRECIOUS: Makefile 204 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 205 | @case '$?' in \ 206 | *config.status*) \ 207 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ 208 | *) \ 209 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ 210 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 211 | esac; 212 | 213 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) 214 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 215 | 216 | $(top_srcdir)/configure: $(am__configure_deps) 217 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 218 | $(ACLOCAL_M4): $(am__aclocal_m4_deps) 219 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 220 | $(am__aclocal_m4_deps): 221 | 222 | clean-checkPROGRAMS: 223 | @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ 224 | echo " rm -f" $$list; \ 225 | rm -f $$list || exit $$?; \ 226 | test -n "$(EXEEXT)" || exit 0; \ 227 | list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ 228 | echo " rm -f" $$list; \ 229 | rm -f $$list 230 | cobench$(EXEEXT): $(cobench_OBJECTS) $(cobench_DEPENDENCIES) 231 | @rm -f cobench$(EXEEXT) 232 | $(LINK) $(cobench_OBJECTS) $(cobench_LDADD) $(LIBS) 233 | cothread$(EXEEXT): $(cothread_OBJECTS) $(cothread_DEPENDENCIES) 234 | @rm -f cothread$(EXEEXT) 235 | $(LINK) $(cothread_OBJECTS) $(cothread_LDADD) $(LIBS) 236 | 237 | mostlyclean-compile: 238 | -rm -f *.$(OBJEXT) 239 | 240 | distclean-compile: 241 | -rm -f *.tab.c 242 | 243 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cobench.Po@am__quote@ 244 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cothread.Po@am__quote@ 245 | 246 | .c.o: 247 | @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< 248 | @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po 249 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ 250 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 251 | @am__fastdepCC_FALSE@ $(COMPILE) -c $< 252 | 253 | .c.obj: 254 | @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` 255 | @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po 256 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ 257 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 258 | @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` 259 | 260 | .c.lo: 261 | @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< 262 | @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo 263 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ 264 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 265 | @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< 266 | 267 | mostlyclean-libtool: 268 | -rm -f *.lo 269 | 270 | clean-libtool: 271 | -rm -rf .libs _libs 272 | 273 | ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) 274 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 275 | unique=`for i in $$list; do \ 276 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 277 | done | \ 278 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ 279 | END { if (nonempty) { for (i in files) print i; }; }'`; \ 280 | mkid -fID $$unique 281 | tags: TAGS 282 | 283 | TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ 284 | $(TAGS_FILES) $(LISP) 285 | set x; \ 286 | here=`pwd`; \ 287 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 288 | unique=`for i in $$list; do \ 289 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 290 | done | \ 291 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ 292 | END { if (nonempty) { for (i in files) print i; }; }'`; \ 293 | shift; \ 294 | if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ 295 | test -n "$$unique" || unique=$$empty_fix; \ 296 | if test $$# -gt 0; then \ 297 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 298 | "$$@" $$unique; \ 299 | else \ 300 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 301 | $$unique; \ 302 | fi; \ 303 | fi 304 | ctags: CTAGS 305 | CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ 306 | $(TAGS_FILES) $(LISP) 307 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 308 | unique=`for i in $$list; do \ 309 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 310 | done | \ 311 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ 312 | END { if (nonempty) { for (i in files) print i; }; }'`; \ 313 | test -z "$(CTAGS_ARGS)$$unique" \ 314 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ 315 | $$unique 316 | 317 | GTAGS: 318 | here=`$(am__cd) $(top_builddir) && pwd` \ 319 | && $(am__cd) $(top_srcdir) \ 320 | && gtags -i $(GTAGS_ARGS) "$$here" 321 | 322 | distclean-tags: 323 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags 324 | 325 | distdir: $(DISTFILES) 326 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 327 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 328 | list='$(DISTFILES)'; \ 329 | dist_files=`for file in $$list; do echo $$file; done | \ 330 | sed -e "s|^$$srcdirstrip/||;t" \ 331 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ 332 | case $$dist_files in \ 333 | */*) $(MKDIR_P) `echo "$$dist_files" | \ 334 | sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ 335 | sort -u` ;; \ 336 | esac; \ 337 | for file in $$dist_files; do \ 338 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ 339 | if test -d $$d/$$file; then \ 340 | dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ 341 | if test -d "$(distdir)/$$file"; then \ 342 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 343 | fi; \ 344 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ 345 | cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ 346 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 347 | fi; \ 348 | cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ 349 | else \ 350 | test -f "$(distdir)/$$file" \ 351 | || cp -p $$d/$$file "$(distdir)/$$file" \ 352 | || exit 1; \ 353 | fi; \ 354 | done 355 | check-am: all-am 356 | $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) 357 | check: check-am 358 | all-am: Makefile 359 | installdirs: 360 | install: install-am 361 | install-exec: install-exec-am 362 | install-data: install-data-am 363 | uninstall: uninstall-am 364 | 365 | install-am: all-am 366 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am 367 | 368 | installcheck: installcheck-am 369 | install-strip: 370 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 371 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 372 | `test -z '$(STRIP)' || \ 373 | echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install 374 | mostlyclean-generic: 375 | 376 | clean-generic: 377 | 378 | distclean-generic: 379 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) 380 | -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) 381 | 382 | maintainer-clean-generic: 383 | @echo "This command is intended for maintainers to use" 384 | @echo "it deletes files that may require special tools to rebuild." 385 | clean: clean-am 386 | 387 | clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ 388 | mostlyclean-am 389 | 390 | distclean: distclean-am 391 | -rm -rf ./$(DEPDIR) 392 | -rm -f Makefile 393 | distclean-am: clean-am distclean-compile distclean-generic \ 394 | distclean-tags 395 | 396 | dvi: dvi-am 397 | 398 | dvi-am: 399 | 400 | html: html-am 401 | 402 | html-am: 403 | 404 | info: info-am 405 | 406 | info-am: 407 | 408 | install-data-am: 409 | 410 | install-dvi: install-dvi-am 411 | 412 | install-dvi-am: 413 | 414 | install-exec-am: 415 | 416 | install-html: install-html-am 417 | 418 | install-html-am: 419 | 420 | install-info: install-info-am 421 | 422 | install-info-am: 423 | 424 | install-man: 425 | 426 | install-pdf: install-pdf-am 427 | 428 | install-pdf-am: 429 | 430 | install-ps: install-ps-am 431 | 432 | install-ps-am: 433 | 434 | installcheck-am: 435 | 436 | maintainer-clean: maintainer-clean-am 437 | -rm -rf ./$(DEPDIR) 438 | -rm -f Makefile 439 | maintainer-clean-am: distclean-am maintainer-clean-generic 440 | 441 | mostlyclean: mostlyclean-am 442 | 443 | mostlyclean-am: mostlyclean-compile mostlyclean-generic \ 444 | mostlyclean-libtool 445 | 446 | pdf: pdf-am 447 | 448 | pdf-am: 449 | 450 | ps: ps-am 451 | 452 | ps-am: 453 | 454 | uninstall-am: 455 | 456 | .MAKE: check-am install-am install-strip 457 | 458 | .PHONY: CTAGS GTAGS all all-am check check-am clean \ 459 | clean-checkPROGRAMS clean-generic clean-libtool ctags \ 460 | distclean distclean-compile distclean-generic \ 461 | distclean-libtool distclean-tags distdir dvi dvi-am html \ 462 | html-am info info-am install install-am install-data \ 463 | install-data-am install-dvi install-dvi-am install-exec \ 464 | install-exec-am install-html install-html-am install-info \ 465 | install-info-am install-man install-pdf install-pdf-am \ 466 | install-ps install-ps-am install-strip installcheck \ 467 | installcheck-am installdirs maintainer-clean \ 468 | maintainer-clean-generic mostlyclean mostlyclean-compile \ 469 | mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ 470 | tags uninstall uninstall-am 471 | 472 | 473 | # Tell versions [3.59,3.63) of GNU make to not export all variables. 474 | # Otherwise a system limit (for SysV at least) may be exceeded. 475 | .NOEXPORT: 476 | -------------------------------------------------------------------------------- /test/cobench.c: -------------------------------------------------------------------------------- 1 | /* 2 | * CoBench by Davide Libenzi (Portable Coroutine Library bench tester) 3 | * Copyright (C) 2003..2010 Davide Libenzi 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | * Davide Libenzi 20 | * 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | 32 | #define MIN_MEASURE_TIME 2000000ULL 33 | #define CO_STACK_SIZE (8 * 1024) 34 | 35 | 36 | static unsigned long long getustime(void) 37 | { 38 | struct timeval tm; 39 | 40 | gettimeofday(&tm, NULL); 41 | 42 | return tm.tv_sec * 1000000ULL + tm.tv_usec; 43 | } 44 | 45 | static void switch_bench(void *data) 46 | { 47 | volatile unsigned long *sw_counter = (unsigned long *) data; 48 | 49 | for (;;) { 50 | (*sw_counter)--; 51 | co_resume(); 52 | } 53 | } 54 | 55 | static void *run_test(void *data) 56 | { 57 | int i, ntimes; 58 | coroutine_t coro; 59 | unsigned long nswitches, sw_counter; 60 | unsigned long long ts, te; 61 | 62 | fprintf(stdout, "[%p] measuring co_create+co_delete performance ...\n", 63 | pthread_self()); 64 | fflush(stdout); 65 | 66 | ntimes = 10000; 67 | do { 68 | ts = getustime(); 69 | for (i = 0; i < ntimes; i++) { 70 | if ((coro = co_create(switch_bench, &sw_counter, NULL, 71 | CO_STACK_SIZE)) != NULL) 72 | co_delete(coro); 73 | } 74 | te = getustime(); 75 | ntimes *= 4; 76 | } while ((te - ts) < MIN_MEASURE_TIME); 77 | 78 | fprintf(stdout, "[%p] %g usec\n", pthread_self(), 79 | (double) (te - ts) / (double) ntimes); 80 | 81 | if ((coro = co_create(switch_bench, &sw_counter, NULL, 82 | CO_STACK_SIZE)) != NULL) { 83 | fprintf(stdout, "[%p] measuring switch performance ...\n", 84 | pthread_self()); 85 | fflush(stdout); 86 | 87 | sw_counter = nswitches = 10000; 88 | do { 89 | ts = getustime(); 90 | while (sw_counter) 91 | co_call(coro); 92 | te = getustime(); 93 | sw_counter = (nswitches *= 4); 94 | } while ((te - ts) < MIN_MEASURE_TIME); 95 | 96 | fprintf(stdout, "[%p] %g usec\n", pthread_self(), 97 | (double) (te - ts) / (double) (2 * nswitches)); 98 | 99 | co_delete(coro); 100 | } 101 | 102 | return NULL; 103 | } 104 | 105 | static void *thread_proc(void *data) 106 | { 107 | void *result; 108 | 109 | co_thread_init(); 110 | result = run_test(data); 111 | co_thread_cleanup(); 112 | 113 | return result; 114 | } 115 | 116 | int main(int argc, char **argv) 117 | { 118 | int i, nthreads; 119 | pthread_t *thids; 120 | 121 | nthreads = 1; 122 | for (i = 1; i < argc; i++) { 123 | if (strcmp(argv[i], "-n") == 0) { 124 | if (++i < argc) 125 | nthreads = atoi(argv[i]); 126 | } 127 | } 128 | if (nthreads == 1) 129 | run_test(NULL); 130 | else { 131 | thids = (pthread_t *) malloc(nthreads * sizeof(pthread_t)); 132 | for (i = 0; i < nthreads; i++) { 133 | if (pthread_create(&thids[i], NULL, thread_proc, 134 | NULL)) { 135 | perror("creating worker threads"); 136 | return 1; 137 | } 138 | } 139 | for (i = 0; i < nthreads; i++) 140 | pthread_join(thids[i], NULL); 141 | } 142 | 143 | return 0; 144 | } 145 | 146 | -------------------------------------------------------------------------------- /test/cothread.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | /* 11 | Implements a simple cooperative multi-threading environment. 12 | 13 | Copyright 2000 by E. Toernig . 14 | 15 | The API is made out of four functions: 16 | 17 | void cothread_init(void) 18 | Initializes the data structures. Has to be called once 19 | at program start. 20 | 21 | coroutine_t cothread_new(void (*func)(), ...) 22 | Creates a new coroutine. func is called as it's startup 23 | function and the additional arguments are passed as a va_list. 24 | Returns 0 on success and -1 on failure. 25 | 26 | int cothread_wait(int mode [, int fd] [, int timeout]) 27 | mode is the bitwise OR of IOREAD, IOWRITE, and IOEXCEPT which 28 | require the fd, and IOTIMEOUT which requires the timeout. 29 | If any of the conditions become true, the function returns 30 | with the mode-bits that became ready. 31 | 32 | There are some special combinations: 33 | cothread_wait(0) 34 | Waits forever. Coroutine is deleted. This is the 35 | standard method to delete a coroutine. 36 | cothread_wait(IOTIMEOUT, ms) 37 | Sleeps for ms milliseconds. 38 | cothread_wait(IOTIMEOUT, 0) 39 | Return immediately. Side effect: all other coroutines 40 | waiting for an event get a chance to run. 41 | 42 | int cothread_schedule(void) 43 | Give up processing and let other coroutines run. To restart 44 | this one, another coroutine has to co_call back. 45 | 46 | The cothread routines only manage coroutines that are currently 47 | executing cothread_wait. You are not required to create them via 48 | cothread_new. Any coroutine may use these functions. cothread_new 49 | just makes sure, that execution comes back to the creating coroutine. 50 | 51 | [[xref: co_create, co_delete, co_call, co_current]] 52 | [[xref: select, gettimeofday, memset]] 53 | */ 54 | 55 | 56 | 57 | #define IOREAD 1 // wait for fd to become readable 58 | #define IOWRITE 2 // wait for fd to become writeable 59 | #define IOEXCEPT 4 // wait for an exception condition on fd 60 | #define IOTIMEOUT 8 // time out of specified time 61 | 62 | struct ioreq { 63 | struct ioreq *next; 64 | coroutine_t coro; // coroutine that is waiting 65 | int mode; // the events it is waiting for 66 | int fd; // optional file descriptor 67 | struct timeval timeout[1]; // optional time out 68 | }; 69 | 70 | struct ioqueue { 71 | struct ioreq *req; // first request in this queue 72 | int maxfd; // highest fd used in the requests 73 | struct timeval *mintime; // earliest timeout in the requests 74 | fd_set *rp, *wp, *ep; // pointers to the fd_sets below. 75 | fd_set rfds[1], wfds[1], efds[1]; // fd_sets for the select 76 | }; 77 | 78 | struct iosched { 79 | struct timeval ctime[1]; // system time after last select 80 | struct ioqueue *active; // requests processed by the last poll 81 | struct ioqueue *wait; // requests for the next poll 82 | struct ioqueue queues[2]; // data area of the queues. 83 | }; 84 | 85 | 86 | static struct timeval *tvadd(struct timeval *dst, struct timeval *a, 87 | struct timeval *b) 88 | { 89 | dst->tv_sec = a->tv_sec + b->tv_sec; 90 | dst->tv_usec = a->tv_usec + b->tv_usec; 91 | if (dst->tv_usec >= 1000000) 92 | dst->tv_sec++, dst->tv_usec -= 1000000; 93 | 94 | return dst; 95 | } 96 | 97 | static struct timeval *tvsub(struct timeval *dst, struct timeval *a, 98 | struct timeval *b) 99 | { 100 | dst->tv_sec = a->tv_sec - b->tv_sec; 101 | dst->tv_usec = a->tv_usec - b->tv_usec; 102 | if (dst->tv_usec < 0) 103 | dst->tv_sec--, dst->tv_usec += 1000000; 104 | 105 | return dst; 106 | } 107 | 108 | static long tvcmp(struct timeval *a, struct timeval *b) 109 | { 110 | if (a->tv_sec - b->tv_sec) 111 | return a->tv_sec - b->tv_sec; 112 | 113 | return a->tv_usec - b->tv_usec; 114 | } 115 | 116 | static struct timeval *to2tv(struct timeval *dst, int timeout) 117 | { 118 | dst->tv_sec = timeout / 1000; 119 | dst->tv_usec = timeout % 1000 * 1000; 120 | 121 | return dst; 122 | } 123 | 124 | static void set_fds(struct ioreq *r, int mode, fd_set *fds, fd_set **fp) 125 | { 126 | if (r->mode & mode) { 127 | FD_SET(r->fd, fds); 128 | *fp = fds; 129 | } 130 | } 131 | 132 | static int tst_fds(struct ioreq *r, int mode, fd_set *fds) 133 | { 134 | if (r->mode & mode) 135 | if (FD_ISSET(r->fd, fds)) { 136 | FD_CLR(r->fd, fds); 137 | return mode; 138 | } 139 | 140 | return 0; 141 | } 142 | 143 | static int check(struct ioqueue *q, struct ioreq *r, struct timeval *ctime) 144 | { 145 | int res = 0; 146 | 147 | if (r->mode & (IOREAD|IOWRITE|IOEXCEPT)) { 148 | res |= tst_fds(r, IOREAD, q->rp); 149 | res |= tst_fds(r, IOWRITE, q->wp); 150 | res |= tst_fds(r, IOEXCEPT, q->ep); 151 | } 152 | if (res == 0) // IOTIMEOUT has lower precedence 153 | if (r->mode & IOTIMEOUT) 154 | if (tvcmp(r->timeout, ctime) <= 0) 155 | res |= IOTIMEOUT; 156 | return res; 157 | } 158 | 159 | static void enqueue(struct ioqueue *q, struct ioreq *r) 160 | { 161 | if (r->mode & (IOREAD|IOWRITE|IOEXCEPT)) { 162 | set_fds(r, IOREAD, q->rfds, &q->rp); 163 | set_fds(r, IOWRITE, q->wfds, &q->wp); 164 | set_fds(r, IOEXCEPT, q->efds, &q->ep); 165 | if (r->fd >= q->maxfd) 166 | q->maxfd = r->fd + 1; 167 | } 168 | if (r->mode & IOTIMEOUT) 169 | if (!q->mintime || tvcmp(q->mintime, r->timeout) > 0) 170 | q->mintime = r->timeout; 171 | r->next = q->req; 172 | q->req = r; 173 | } 174 | 175 | static void vadd_req(struct iosched *glbl, struct ioreq *r, int mode, 176 | va_list args) 177 | { 178 | r->coro = co_current(); 179 | r->mode = mode; 180 | if (mode & (IOREAD|IOWRITE|IOEXCEPT)) 181 | r->fd = va_arg(args, int); 182 | if (mode & IOTIMEOUT) 183 | tvadd(r->timeout, to2tv(r->timeout, va_arg(args, int)), 184 | glbl->ctime); 185 | 186 | enqueue(glbl->wait, r); 187 | } 188 | 189 | static void add_req(struct iosched *glbl, struct ioreq *r, int mode, ...) 190 | { 191 | va_list args; 192 | 193 | va_start(args, mode); 194 | vadd_req(glbl, r, mode, args); 195 | va_end(args); 196 | } 197 | 198 | static int cothread_schedule(struct iosched *glbl) 199 | { 200 | struct ioqueue *q; 201 | struct ioreq *r; 202 | struct timeval tv[1]; 203 | int res; 204 | 205 | for (;;) { 206 | q = glbl->active; 207 | while ((r = q->req) != NULL) { 208 | q->req = r->next; 209 | if ((res = check(q, r, glbl->ctime)) != 0) { 210 | co_call(r->coro); 211 | return -1; 212 | } 213 | if (r->mode == 0 && r->coro != co_current()) 214 | co_delete(r->coro); 215 | else 216 | enqueue(glbl->wait, r); 217 | } 218 | q->rp = q->wp = q->ep = 0; 219 | q->mintime = 0; 220 | q->maxfd = 0; 221 | glbl->active = glbl->wait; 222 | glbl->wait = q; 223 | 224 | q = glbl->active; 225 | if (q->mintime) 226 | q->mintime = tvsub(tv, q->mintime, glbl->ctime); 227 | 228 | while (select(q->maxfd, q->rp, q->wp, q->ep, q->mintime) == -1) 229 | ; 230 | gettimeofday(glbl->ctime, 0); 231 | } 232 | 233 | return 0; 234 | } 235 | 236 | static int cothread_wait(struct iosched *glbl, int mode, ...) 237 | { 238 | va_list args; 239 | struct ioreq req[1]; 240 | 241 | va_start(args, mode); 242 | vadd_req(glbl, req, mode, args); 243 | va_end(args); 244 | 245 | return cothread_schedule(glbl); 246 | } 247 | 248 | static coroutine_t cothread_new(void (*func)(), ...) 249 | { 250 | coroutine_t co; 251 | va_list args; 252 | struct iosched *glbl; 253 | struct ioreq req[1]; 254 | 255 | va_start(args, func); 256 | glbl = va_arg(args, struct iosched *); 257 | va_end(args); 258 | 259 | add_req(glbl, req, IOTIMEOUT, 0); 260 | va_start(args, func); 261 | if ((co = co_create(func, &args, 0, 32768))) 262 | co_call(co); 263 | 264 | va_end(args); 265 | return co; 266 | } 267 | 268 | static void cothread_init(struct iosched *glbl) 269 | { 270 | memset(glbl, 0, sizeof(*glbl)); 271 | gettimeofday(glbl->ctime, 0); 272 | glbl->active = glbl->queues; 273 | glbl->wait = glbl->queues + 1; 274 | memset(glbl->queues, 0, sizeof(glbl->queues)); 275 | } 276 | 277 | static void test1(va_list *args) 278 | { 279 | struct iosched *glbl = va_arg(*args, struct iosched *); 280 | char *str = va_arg(*args, char *); 281 | int limit = va_arg(*args, int); 282 | int i = 0; 283 | 284 | printf("%s started\n", str); 285 | while (i < limit) { 286 | cothread_wait(glbl, IOTIMEOUT, 1000); 287 | printf("%s: %d\n", str, i++); 288 | } 289 | printf("%s: dying\n", str); 290 | cothread_wait(glbl, 0); 291 | } 292 | 293 | static void test2(va_list *args) 294 | { 295 | struct iosched *glbl = va_arg(*args, struct iosched *); 296 | char *str = va_arg(*args, char *); 297 | int in = va_arg(*args, int); 298 | int out = va_arg(*args, int); 299 | char buf[256]; 300 | int n; 301 | 302 | printf("%s started\n", str); 303 | for (;;) { 304 | cothread_wait(glbl, IOREAD, in); 305 | if ((n = read(in, buf, sizeof(buf))) <= 0) 306 | break; 307 | cothread_wait(glbl, IOWRITE, out); 308 | write(out, buf, n); 309 | } 310 | printf("%s: dying\n", str); 311 | cothread_wait(glbl, 0); 312 | } 313 | 314 | static void *run_test(void *data) 315 | { 316 | struct iosched glbl[1]; 317 | 318 | cothread_init(glbl); 319 | 320 | cothread_new(test1, glbl, "test1a", 10); 321 | cothread_new(test1, glbl, "test1b", 12); 322 | cothread_new(test1, glbl, "test1c", 14); 323 | cothread_new(test2, glbl, "test2", 0, 2); 324 | 325 | for (;;) { 326 | printf("main: waiting ...\n"); 327 | cothread_wait(glbl, IOTIMEOUT, 3000); 328 | } 329 | 330 | return NULL; 331 | } 332 | 333 | static void *thread_proc(void *data) 334 | { 335 | void *result; 336 | 337 | co_thread_init(); 338 | result = run_test(data); 339 | co_thread_cleanup(); 340 | 341 | return result; 342 | } 343 | 344 | int main(int argc, char **argv) 345 | { 346 | int i, nthreads; 347 | pthread_t *thids; 348 | 349 | nthreads = 1; 350 | for (i = 1; i < argc; i++) { 351 | if (strcmp(argv[i], "-n") == 0) { 352 | if (++i < argc) 353 | nthreads = atoi(argv[i]); 354 | } 355 | } 356 | if (nthreads == 1) 357 | run_test(NULL); 358 | else { 359 | thids = (pthread_t *) malloc(nthreads * sizeof(pthread_t)); 360 | for (i = 0; i < nthreads; i++) { 361 | if (pthread_create(&thids[i], NULL, thread_proc, 362 | NULL)) { 363 | perror("creating worker threads"); 364 | return 1; 365 | } 366 | } 367 | for (i = 0; i < nthreads; i++) 368 | pthread_join(thids[i], NULL); 369 | } 370 | 371 | return 0; 372 | } 373 | 374 | -------------------------------------------------------------------------------- /winconfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PCL by Davide Libenzi (Portable Coroutine Library) 3 | * Copyright (C) 2003..2010 Davide Libenzi 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | * 19 | * Davide Libenzi 20 | * 21 | */ 22 | 23 | #if !defined(WINCONFIG_H) 24 | #define WINCONFIG_H 25 | 26 | #if !defined(VERSION) 27 | #define VERSION "1.12" 28 | #endif 29 | 30 | #endif 31 | 32 | --------------------------------------------------------------------------------