From: <ai...@us...> - 2010-10-11 22:34:27
|
Revision: 11257 http://plplot.svn.sourceforge.net/plplot/?rev=11257&view=rev Author: airwin Date: 2010-10-11 22:34:18 +0000 (Mon, 11 Oct 2010) Log Message: ----------- Change from traditional /* ... */ style of commentary to c99 // style of commentary for our core library code. Results tested well with "cmake", "make test_noninteractive", and "make test_interactive" in the build tree. ToDo: extend this style change to further chunks of our C code. Modified Paths: -------------- trunk/config.h.cmake trunk/src/ltdl_win32.c trunk/src/mt19937ar.c trunk/src/mt19937ar.h trunk/src/pdfutils.c trunk/src/plaffine.c trunk/src/plarc.c trunk/src/plargs.c trunk/src/plbox.c trunk/src/plbuf.c trunk/src/plcont.c trunk/src/plcore.c trunk/src/plctrl.c trunk/src/plcvt.c trunk/src/pldeprecated.c trunk/src/pldtik.c trunk/src/plf2ops.c trunk/src/plfill.c trunk/src/plfreetype.c trunk/src/plgradient.c trunk/src/plgridd.c trunk/src/plgset.c trunk/src/plhist.c trunk/src/plimage.c trunk/src/plline.c trunk/src/plmap.c trunk/src/plot3d.c trunk/src/plsdef.c trunk/src/plshade.c trunk/src/plstdio.c trunk/src/plstripc.c trunk/src/plsym.c trunk/src/pltick.c trunk/src/pltime.c trunk/src/plvect.c trunk/src/plvpor.c trunk/src/plwind.c Modified: trunk/config.h.cmake =================================================================== --- trunk/config.h.cmake 2010-10-11 21:41:06 UTC (rev 11256) +++ trunk/config.h.cmake 2010-10-11 22:34:18 UTC (rev 11257) @@ -1,303 +1,303 @@ -/* Configured (by CMake) macros for PLplot that are required for the - * core build but _not_ required for the build of the installed - * examples (and presumably any user applications). Therefore, the - * configured config.h should not be installed. In contrast, - * include/plConfig.h.cmake (note, plConfig.h #includes config.h for - * the core build because HAVE_CONFIG_H is #defined in that case) - * contains configured macros that are required for the core build, - * installed examples build, and build of user applications. - * Therefore, in contrast to config.h, plConfig.h should be installed. - * - * Maintenance issue: in makes no sense to configure duplicate macros - * for both config.h and plConfig.h. Therefore, when adding a macro - * decide which file to put it in depending on whether the result is - * needed for the installed examples build or not. Furthermore, move - * configured macros from one file to the other as needed depending on - * that criterion, but do not copy them. - * - */ +// Configured (by CMake) macros for PLplot that are required for the +// core build but _not_ required for the build of the installed +// examples (and presumably any user applications). Therefore, the +// configured config.h should not be installed. In contrast, +// include/plConfig.h.cmake (note, plConfig.h #includes config.h for +// the core build because HAVE_CONFIG_H is #defined in that case) +// contains configured macros that are required for the core build, +// installed examples build, and build of user applications. +// Therefore, in contrast to config.h, plConfig.h should be installed. +// +// Maintenance issue: in makes no sense to configure duplicate macros +// for both config.h and plConfig.h. Therefore, when adding a macro +// decide which file to put it in depending on whether the result is +// needed for the installed examples build or not. Furthermore, move +// configured macros from one file to the other as needed depending on +// that criterion, but do not copy them. +// +// -/* Location of executables */ +// Location of executables #define BIN_DIR "@BIN_DIR@" -/* Location of Build tree */ +// Location of Build tree #define BUILD_DIR "@BUILD_DIR@" -/* Location of package data files */ +// Location of package data files #define DATA_DIR "@DATA_DIR@" -/* Location of dynamically loaded drivers */ +// Location of dynamically loaded drivers #define DRV_DIR "@DRV_DIR@" -/* Name of the default cmap0 palette to use */ +// Name of the default cmap0 palette to use #define PL_DEFAULT_CMAP0_FILE "@DEFAULT_CMAP0_FILE@" -/* Name of the default cmap1 palette to use */ +// Name of the default cmap1 palette to use #define PL_DEFAULT_CMAP1_FILE "@DEFAULT_CMAP1_FILE@" -/* Define if there is support for dynamically loaded drivers */ +// Define if there is support for dynamically loaded drivers #cmakedefine ENABLE_DYNDRIVERS -/* Define to 1 if you have the <cmath> header file. */ +// Define to 1 if you have the <cmath> header file. #cmakedefine HAVE_CMATH 1 -/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. - */ +// Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. +// #cmakedefine HAVE_DIRENT_H 1 -/* Define to 1 if you have the <dlfcn.h> header file. */ +// Define to 1 if you have the <dlfcn.h> header file. #cmakedefine HAVE_DLFCN_H 1 -/* Define if finite is available */ +// Define if finite is available #cmakedefine PL_HAVE_FINITE -/* Define if _finite is available */ +// Define if _finite is available #cmakedefine PL__HAVE_FINITE -/* Define if [freetype] is available */ +// Define if [freetype] is available #cmakedefine HAVE_FREETYPE -/* Define if [agg] is available */ +// Define if [agg] is available #cmakedefine HAVE_AGG -/* Define to 1 if you have the <glib.h> header file. */ +// Define to 1 if you have the <glib.h> header file. #cmakedefine HAVE_GLIB_H 1 -/* Define to 1 if you have the <glib-object.h> header file. */ +// Define to 1 if you have the <glib-object.h> header file. #cmakedefine HAVE_GLIB_OBJECT_H 1 -/* Define to 1 if you have the <gtk/gtk.h> header file. */ +// Define to 1 if you have the <gtk/gtk.h> header file. #cmakedefine HAVE_GTK_GTK_H 1 -/* Define to 1 if you have the <inttypes.h> header file. */ +// Define to 1 if you have the <inttypes.h> header file. #cmakedefine HAVE_INTTYPES_H 1 -/* Define if [incr], [Tcl] is available */ +// Define if [incr], [Tcl] is available #cmakedefine HAVE_ITCL -/* Define to 1 if you have the <itclDecls.h> header file. */ +// Define to 1 if you have the <itclDecls.h> header file. #cmakedefine HAVE_ITCLDECLS_H 1 -/* Define if Tk is available */ +// Define if Tk is available #cmakedefine ENABLE_tk -/* Define if [incr], [Tk] is available */ +// Define if [incr], [Tk] is available #cmakedefine HAVE_ITK -/* Define to 1 if you have the <jni.h> header file. */ +// Define to 1 if you have the <jni.h> header file. #cmakedefine HAVE_JNI_H 1 -/* Define to 1 if you have the <libart_lgpl/libart.h> header file. */ +// Define to 1 if you have the <libart_lgpl/libart.h> header file. #cmakedefine HAVE_LIBART_LGPL_LIBART_H 1 -/* Define to 1 if you have the <libgnomecanvas/libgnomecanvas.h> header file. - */ +// Define to 1 if you have the <libgnomecanvas/libgnomecanvas.h> header file. +// #cmakedefine HAVE_LIBGNOMECANVAS_LIBGNOMECANVAS_H 1 -/* Define to 1 if you have the <libgnomeprint/gnome-print.h> header file. */ +// Define to 1 if you have the <libgnomeprint/gnome-print.h> header file. #cmakedefine HAVE_LIBGNOMEPRINT_GNOME_PRINT_H 1 -/* Define if libunicode is available */ +// Define if libunicode is available #cmakedefine HAVE_LIBUNICODE -/* Define to 1 if you have the <math.h> header file. */ +// Define to 1 if you have the <math.h> header file. #cmakedefine HAVE_MATH_H 1 -/* Define to 1 if you have the <memory.h> header file. */ +// Define to 1 if you have the <memory.h> header file. #cmakedefine HAVE_MEMORY_H 1 -/* Define to 1 if the function mkstemp is available. */ +// Define to 1 if the function mkstemp is available. #cmakedefine PL_HAVE_MKSTEMP 1 -/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ +// Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. #cmakedefine HAVE_NDIR_H 1 -/* Define if python numpy is available */ +// Define if python numpy is available #cmakedefine HAVE_NUMPY -/* Define if libpango is available */ +// Define if libpango is available #cmakedefine HAVE_PANGO -/* Define if popen is available */ +// Define if popen is available #cmakedefine HAVE_POPEN -/* Define if _NSGetArgc is available */ +// Define if _NSGetArgc is available #cmakedefine HAVE_NSGETARGC -/* Define if pthreads is available */ +// Define if pthreads is available #cmakedefine HAVE_PTHREAD -/* Define if Qhull is available */ +// Define if Qhull is available #cmakedefine HAVE_QHULL -/* Define to 1 if you have the <stdlib.h> header file. */ +// Define to 1 if you have the <stdlib.h> header file. #cmakedefine HAVE_STDLIB_H 1 -/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'. - */ +// Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'. +// #cmakedefine HAVE_SYS_DIR_H 1 -/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'. - */ +// Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'. +// #cmakedefine HAVE_SYS_NDIR_H 1 -/* Define to 1 if you have the <sys/stat.h> header file. */ +// Define to 1 if you have the <sys/stat.h> header file. #cmakedefine HAVE_SYS_STAT_H 1 -/* Define to 1 if you have the <sys/types.h> header file. */ +// Define to 1 if you have the <sys/types.h> header file. #cmakedefine HAVE_SYS_TYPES_H 1 -/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */ +// Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. #cmakedefine HAVE_SYS_WAIT_H 1 -/* Define to 1 if you have the <termios.h> header file. */ +// Define to 1 if you have the <termios.h> header file. #cmakedefine HAVE_TERMIOS_H 1 -/* Define to 1 if you have the <crt_externs.h> header file. */ +// Define to 1 if you have the <crt_externs.h> header file. #cmakedefine HAVE_CRT_EXTERNS_H 1 -/* Define to 1 if the function unlink is available */ +// Define to 1 if the function unlink is available #cmakedefine PL_HAVE_UNLINK 1 -/* Define to 1 if you have the `vfork' function. */ +// Define to 1 if you have the `vfork' function. #cmakedefine HAVE_VFORK 1 -/* Define to 1 if you have the <vfork.h> header file. */ +// Define to 1 if you have the <vfork.h> header file. #cmakedefine HAVE_VFORK_H 1 -/* Include sys/type.h if needed */ +// Include sys/type.h if needed #cmakedefine NEED_SYS_TYPE_H -/* Name of package */ +// Name of package #define PACKAGE "@PACKAGE@" -/* Define if the win32 ltdl implementation should be used */ +// Define if the win32 ltdl implementation should be used #cmakedefine LTDL_WIN32 -/* Portable definition for PTHREAD_MUTEX_RECURSIVE */ +// Portable definition for PTHREAD_MUTEX_RECURSIVE #define PLPLOT_MUTEX_RECURSIVE @PLPLOT_MUTEX_RECURSIVE@ -/* Directory containing fonts that are accessible from freetype */ +// Directory containing fonts that are accessible from freetype #define PL_FREETYPE_FONT_DIR "@PL_FREETYPE_FONT_DIR@" -/* MONO font accessible from freetype */ +// MONO font accessible from freetype #define PL_FREETYPE_MONO "@PL_FREETYPE_MONO@" -/* MONO_BOLD font accessible from freetype */ +// MONO_BOLD font accessible from freetype #define PL_FREETYPE_MONO_BOLD "@PL_FREETYPE_MONO_BOLD@" -/* MONO_BOLD_ITALIC font accessible from freetype */ +// MONO_BOLD_ITALIC font accessible from freetype #define PL_FREETYPE_MONO_BOLD_ITALIC "@PL_FREETYPE_MONO_BOLD_ITALIC@" -/* MONO_BOLD_OBLIQUE font accessible from freetype */ +// MONO_BOLD_OBLIQUE font accessible from freetype #define PL_FREETYPE_MONO_BOLD_OBLIQUE "@PL_FREETYPE_MONO_BOLD_OBLIQUE@" -/* MONO_ITALIC font accessible from freetype */ +// MONO_ITALIC font accessible from freetype #define PL_FREETYPE_MONO_ITALIC "@PL_FREETYPE_MONO_ITALIC@" -/* MONO_OBLIQUE font accessible from freetype */ +// MONO_OBLIQUE font accessible from freetype #define PL_FREETYPE_MONO_OBLIQUE "@PL_FREETYPE_MONO_OBLIQUE@" -/* SANS font accessible from freetype */ +// SANS font accessible from freetype #define PL_FREETYPE_SANS "@PL_FREETYPE_SANS@" -/* SANS_BOLD font accessible from freetype */ +// SANS_BOLD font accessible from freetype #define PL_FREETYPE_SANS_BOLD "@PL_FREETYPE_SANS_BOLD@" -/* SANS_BOLD_ITALIC font accessible from freetype */ +// SANS_BOLD_ITALIC font accessible from freetype #define PL_FREETYPE_SANS_BOLD_ITALIC "@PL_FREETYPE_SANS_BOLD_ITALIC@" -/* SANS_BOLD_OBLIQUE font accessible from freetype */ +// SANS_BOLD_OBLIQUE font accessible from freetype #define PL_FREETYPE_SANS_BOLD_OBLIQUE "@PL_FREETYPE_SANS_BOLD_OBLIQUE@" -/* SANS_ITALIC font accessible from freetype */ +// SANS_ITALIC font accessible from freetype #define PL_FREETYPE_SANS_ITALIC "@PL_FREETYPE_SANS_ITALIC@" -/* SANS_OBLIQUE font accessible from freetype */ +// SANS_OBLIQUE font accessible from freetype #define PL_FREETYPE_SANS_OBLIQUE "@PL_FREETYPE_SANS_OBLIQUE@" -/* SCRIPT font accessible from freetype */ +// SCRIPT font accessible from freetype #define PL_FREETYPE_SCRIPT "@PL_FREETYPE_SCRIPT@" -/* SCRIPT_BOLD font accessible from freetype */ +// SCRIPT_BOLD font accessible from freetype #define PL_FREETYPE_SCRIPT_BOLD "@PL_FREETYPE_SCRIPT_BOLD@" -/* SCRIPT_BOLD_ITALIC font accessible from freetype */ +// SCRIPT_BOLD_ITALIC font accessible from freetype #define PL_FREETYPE_SCRIPT_BOLD_ITALIC "@PL_FREETYPE_SCRIPT_BOLD_ITALIC@" -/* SCRIPT_BOLD_OBLIQUE font accessible from freetype */ +// SCRIPT_BOLD_OBLIQUE font accessible from freetype #define PL_FREETYPE_SCRIPT_BOLD_OBLIQUE "@PL_FREETYPE_SCRIPT_BOLD_OBLIQUE@" -/* SCRIPT_ITALIC font accessible from freetype */ +// SCRIPT_ITALIC font accessible from freetype #define PL_FREETYPE_SCRIPT_ITALIC "@PL_FREETYPE_SCRIPT_ITALIC@" -/* SCRIPT_OBLIQUE font accessible from freetype */ +// SCRIPT_OBLIQUE font accessible from freetype #define PL_FREETYPE_SCRIPT_OBLIQUE "@PL_FREETYPE_SCRIPT_OBLIQUE@" -/* SERIF font accessible from freetype */ +// SERIF font accessible from freetype #define PL_FREETYPE_SERIF "@PL_FREETYPE_SERIF@" -/* SERIF_BOLD font accessible from freetype */ +// SERIF_BOLD font accessible from freetype #define PL_FREETYPE_SERIF_BOLD "@PL_FREETYPE_SERIF_BOLD@" -/* SERIF_BOLD_ITALIC font accessible from freetype */ +// SERIF_BOLD_ITALIC font accessible from freetype #define PL_FREETYPE_SERIF_BOLD_ITALIC "@PL_FREETYPE_SERIF_BOLD_ITALIC@" -/* SERIF_BOLD_OBLIQUE font accessible from freetype */ +// SERIF_BOLD_OBLIQUE font accessible from freetype #define PL_FREETYPE_SERIF_BOLD_OBLIQUE "@PL_FREETYPE_SERIF_BOLD_OBLIQUE@" -/* SERIF_ITALIC font accessible from freetype */ +// SERIF_ITALIC font accessible from freetype #define PL_FREETYPE_SERIF_ITALIC "@PL_FREETYPE_SERIF_ITALIC@" -/* SERIF_OBLIQUE font accessible from freetype */ +// SERIF_OBLIQUE font accessible from freetype #define PL_FREETYPE_SERIF_OBLIQUE "@PL_FREETYPE_SERIF_OBLIQUE@" -/* Symbol font accessible from freetype */ +// Symbol font accessible from freetype #define PL_FREETYPE_SYMBOL "@PL_FREETYPE_SYMBOL@" -/* SYMBOL_BOLD font accessible from freetype */ +// SYMBOL_BOLD font accessible from freetype #define PL_FREETYPE_SYMBOL_BOLD "@PL_FREETYPE_SYMBOL_BOLD@" -/* SYMBOL_BOLD_ITALIC font accessible from freetype */ +// SYMBOL_BOLD_ITALIC font accessible from freetype #define PL_FREETYPE_SYMBOL_BOLD_ITALIC "@PL_FREETYPE_SYMBOL_BOLD_ITALIC@" -/* SYMBOL_BOLD_OBLIQUE font accessible from freetype */ +// SYMBOL_BOLD_OBLIQUE font accessible from freetype #define PL_FREETYPE_SYMBOL_BOLD_OBLIQUE "@PL_FREETYPE_SYMBOL_BOLD_OBLIQUE@" -/* SYMBOL_ITALIC font accessible from freetype */ +// SYMBOL_ITALIC font accessible from freetype #define PL_FREETYPE_SYMBOL_ITALIC "@PL_FREETYPE_SYMBOL_ITALIC@" -/* SYMBOL_OBLIQUE font accessible from freetype */ +// SYMBOL_OBLIQUE font accessible from freetype #define PL_FREETYPE_SYMBOL_OBLIQUE "@PL_FREETYPE_SYMBOL_OBLIQUE@" -/* Define as the return type of signal handlers (`int' or `void'). */ +// Define as the return type of signal handlers (`int' or `void'). #define RETSIGTYPE @RETSIGTYPE@ -/* Location of Source tree */ +// Location of Source tree #define SOURCE_DIR "@SOURCE_DIR@" -/* Define to 1 if you have the ANSI C header files. */ +// Define to 1 if you have the ANSI C header files. #cmakedefine STDC_HEADERS 1 -/* Location of Tcl stuff */ +// Location of Tcl stuff #define TCL_DIR "@TCL_DIR@" -/* Version number of package */ +// Version number of package #define VERSION "@VERSION@" -/* Define if csa is desired */ +// Define if csa is desired #cmakedefine WITH_CSA -/* Define if want to use general fill_intersection_polygon approach - * rather than the traditional code to fill the intersection of a polygon with - * the clipping limits. */ +// Define if want to use general fill_intersection_polygon approach +// rather than the traditional code to fill the intersection of a polygon with +// the clipping limits. #cmakedefine USE_FILL_INTERSECTION_POLYGON -/* Define to `char *' if <sys/types.h> does not define. */ +// Define to `char *' if <sys/types.h> does not define. #cmakedefine caddr_t -/* Define to `int' if <sys/types.h> does not define. */ +// Define to `int' if <sys/types.h> does not define. #cmakedefine pid_t -/* Define as `fork' if `vfork' does not work. */ +// Define as `fork' if `vfork' does not work. #cmakedefine vfork Modified: trunk/src/ltdl_win32.c =================================================================== --- trunk/src/ltdl_win32.c 2010-10-11 21:41:06 UTC (rev 11256) +++ trunk/src/ltdl_win32.c 2010-10-11 22:34:18 UTC (rev 11257) @@ -1,47 +1,47 @@ -/* $Id$ - * - * Contains all prototypes for driver functions. - * - * Copyright (C) 2008 Werner Smekal - * - * This file is part of PLplot. - * - * PLplot is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * PLplot is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with PLplot; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ +// $Id$ +// +// Contains all prototypes for driver functions. +// +// Copyright (C) 2008 Werner Smekal +// +// This file is part of PLplot. +// +// PLplot is free software; you can redistribute it and/or modify +// it under the terms of the GNU Library General Public License as published +// by the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// PLplot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with PLplot; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +// +// #include <windows.h> #include <stdlib.h> #include "ltdl_win32.h" -/* (static) pointer to the last handle, which contains a pointer - * to a possible previous handle */ +// (static) pointer to the last handle, which contains a pointer +// to a possible previous handle lt_dlhandle lastHandle = NULL; -/* buffer for error messages */ +// buffer for error messages char errortext[512]; -/* initialise variables */ +// initialise variables void lt_dlinit( void ) { lastHandle = NULL; } -/* on exit free library handles and release allocate memory */ +// on exit free library handles and release allocate memory void lt_dlexit( void ) { lt_dlhandle prev; @@ -57,9 +57,9 @@ } -/* try to open shared library with given dllname. If there is - * no extension given LoadLibrary() assumes .dll. The library - * must be somewhere in the path or in the current directory. */ +// try to open shared library with given dllname. If there is +// no extension given LoadLibrary() assumes .dll. The library +// must be somewhere in the path or in the current directory. lt_dlhandle lt_dlopenext( char* dllname ) { lt_dlhandle dlhandle = malloc( sizeof ( struct __dlhandle ) ); @@ -79,7 +79,7 @@ } -/* return last error occured. Needs some work :). */ +// return last error occured. Needs some work :). const char* lt_dlerror() { strncpy( errortext, "No error information", 512 ); @@ -88,7 +88,7 @@ } -/* load symbol from library */ +// load symbol from library void* lt_dlsym( lt_dlhandle dlhandle, const char* symbol ) { if ( dlhandle->hinstLib ) Modified: trunk/src/mt19937ar.c =================================================================== --- trunk/src/mt19937ar.c 2010-10-11 21:41:06 UTC (rev 11256) +++ trunk/src/mt19937ar.c 2010-10-11 22:34:18 UTC (rev 11257) @@ -1,62 +1,62 @@ -/* - * A C-program for MT19937, with initialization improved 2002/1/26. - * Coded by Takuji Nishimura and Makoto Matsumoto. - * - * Before using, initialize the state by using init_genrand(seed) - * or init_by_array(init_key, key_length). - * - * Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - * All rights reserved. - * Copyright (C) 2005, Mutsuo Saito, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. The names of its contributors may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * Any feedback is very welcome. - * http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html - * email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space) - */ +// +// A C-program for MT19937, with initialization improved 2002/1/26. +// Coded by Takuji Nishimura and Makoto Matsumoto. +// +// Before using, initialize the state by using init_genrand(seed) +// or init_by_array(init_key, key_length). +// +// Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, +// All rights reserved. +// Copyright (C) 2005, Mutsuo Saito, +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. The names of its contributors may not be used to endorse or promote +// products derived from this software without specific prior written +// permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// +// Any feedback is very welcome. +// http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html +// email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space) +// #include <stdio.h> #include "mt19937ar.h" -/* Period parameters */ +// Period parameters #define N 624 #define M 397 -#define MATRIX_A 0x9908b0dfUL /* constant vector a */ -#define UPPER_MASK 0x80000000UL /* most significant w-r bits */ -#define LOWER_MASK 0x7fffffffUL /* least significant r bits */ +#define MATRIX_A 0x9908b0dfUL // constant vector a +#define UPPER_MASK 0x80000000UL // most significant w-r bits +#define LOWER_MASK 0x7fffffffUL // least significant r bits -static unsigned long mt[N]; /* the array for the state vector */ -static int mti = N + 1; /* mti==N+1 means mt[N] is not initialized */ +static unsigned long mt[N]; // the array for the state vector +static int mti = N + 1; // mti==N+1 means mt[N] is not initialized -/* initializes mt[N] with a seed */ +// initializes mt[N] with a seed void init_genrand( unsigned long s ) { mt[0] = s & 0xffffffffUL; @@ -64,19 +64,19 @@ { mt[mti] = ( 1812433253UL * ( mt[mti - 1] ^ ( mt[mti - 1] >> 30 ) ) + mti ); - /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */ - /* In the previous versions, MSBs of the seed affect */ - /* only MSBs of the array mt[]. */ - /* 2002/01/09 modified by Makoto Matsumoto */ + // See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. + // In the previous versions, MSBs of the seed affect + // only MSBs of the array mt[]. + // 2002/01/09 modified by Makoto Matsumoto mt[mti] &= 0xffffffffUL; - /* for >32 bit machines */ + // for >32 bit machines } } -/* initialize by an array with array-length */ -/* init_key is the array for initializing keys */ -/* key_length is its length */ -/* slight change for C++, 2004/2/26 */ +// initialize by an array with array-length +// init_key is the array for initializing keys +// key_length is its length +// slight change for C++, 2004/2/26 void init_by_array( unsigned long init_key[], int key_length ) { int i, j, k; @@ -86,8 +86,8 @@ for (; k; k-- ) { mt[i] = ( mt[i] ^ ( ( mt[i - 1] ^ ( mt[i - 1] >> 30 ) ) * 1664525UL ) ) - + init_key[j] + j; /* non linear */ - mt[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */ + + init_key[j] + j; // non linear + mt[i] &= 0xffffffffUL; // for WORDSIZE > 32 machines i++; j++; if ( i >= N ) { @@ -99,8 +99,8 @@ for ( k = N - 1; k; k-- ) { mt[i] = ( mt[i] ^ ( ( mt[i - 1] ^ ( mt[i - 1] >> 30 ) ) * 1566083941UL ) ) - - i; /* non linear */ - mt[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */ + - i; // non linear + mt[i] &= 0xffffffffUL; // for WORDSIZE > 32 machines i++; if ( i >= N ) { @@ -108,22 +108,22 @@ } } - mt[0] = 0x80000000UL; /* MSB is 1; assuring non-zero initial array */ + mt[0] = 0x80000000UL; // MSB is 1; assuring non-zero initial array } -/* generates a random number on [0,0xffffffff]-interval */ +// generates a random number on [0,0xffffffff]-interval unsigned long genrand_int32( void ) { unsigned long y; static unsigned long mag01[2] = { 0x0UL, MATRIX_A }; - /* mag01[x] = x * MATRIX_A for x=0,1 */ + // mag01[x] = x * MATRIX_A for x=0,1 - if ( mti >= N ) /* generate N words at one time */ + if ( mti >= N ) // generate N words at one time { int kk; - if ( mti == N + 1 ) /* if init_genrand() has not been called, */ - init_genrand( 5489UL ); /* a default initial seed is used */ + if ( mti == N + 1 ) // if init_genrand() has not been called, + init_genrand( 5489UL ); // a default initial seed is used for ( kk = 0; kk < N - M; kk++ ) { @@ -143,7 +143,7 @@ y = mt[mti++]; - /* Tempering */ + // Tempering y ^= ( y >> 11 ); y ^= ( y << 7 ) & 0x9d2c5680UL; y ^= ( y << 15 ) & 0xefc60000UL; @@ -152,37 +152,37 @@ return y; } -/* generates a random number on [0,0x7fffffff]-interval */ +// generates a random number on [0,0x7fffffff]-interval long genrand_int31( void ) { return (long) ( genrand_int32() >> 1 ); } -/* generates a random number on [0,1]-real-interval */ +// generates a random number on [0,1]-real-interval double genrand_real1( void ) { return genrand_int32() * ( 1.0 / 4294967295.0 ); - /* divided by 2^32-1 */ + // divided by 2^32-1 } -/* generates a random number on [0,1)-real-interval */ +// generates a random number on [0,1)-real-interval double genrand_real2( void ) { return genrand_int32() * ( 1.0 / 4294967296.0 ); - /* divided by 2^32 */ + // divided by 2^32 } -/* generates a random number on (0,1)-real-interval */ +// generates a random number on (0,1)-real-interval double genrand_real3( void ) { return ( ( (double) genrand_int32() ) + 0.5 ) * ( 1.0 / 4294967296.0 ); - /* divided by 2^32 */ + // divided by 2^32 } -/* generates a random number on [0,1) with 53-bit resolution*/ +// generates a random number on [0,1) with 53-bit resolution double genrand_res53( void ) { unsigned long a = genrand_int32() >> 5, b = genrand_int32() >> 6; return ( a * 67108864.0 + b ) * ( 1.0 / 9007199254740992.0 ); } -/* These real versions are due to Isaku Wada, 2002/01/09 added */ +// These real versions are due to Isaku Wada, 2002/01/09 added Modified: trunk/src/mt19937ar.h =================================================================== --- trunk/src/mt19937ar.h 2010-10-11 21:41:06 UTC (rev 11256) +++ trunk/src/mt19937ar.h 2010-10-11 22:34:18 UTC (rev 11257) @@ -1,72 +1,72 @@ -/* - * A C-program for MT19937, with initialization improved 2002/1/26. - * Coded by Takuji Nishimura and Makoto Matsumoto. - * - * Before using, initialize the state by using init_genrand(seed) - * or init_by_array(init_key, key_length). - * - * Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - * All rights reserved. - * Copyright (C) 2005, Mutsuo Saito - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. The names of its contributors may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * Any feedback is very welcome. - * http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html - * email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space) - */ +// +// A C-program for MT19937, with initialization improved 2002/1/26. +// Coded by Takuji Nishimura and Makoto Matsumoto. +// +// Before using, initialize the state by using init_genrand(seed) +// or init_by_array(init_key, key_length). +// +// Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, +// All rights reserved. +// Copyright (C) 2005, Mutsuo Saito +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. The names of its contributors may not be used to endorse or promote +// products derived from this software without specific prior written +// permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// +// Any feedback is very welcome. +// http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html +// email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space) +// -/* initializes mt[N] with a seed */ +// initializes mt[N] with a seed void init_genrand( unsigned long s ); -/* initialize by an array with array-length */ -/* init_key is the array for initializing keys */ -/* key_length is its length */ -/* slight change for C++, 2004/2/26 */ +// initialize by an array with array-length +// init_key is the array for initializing keys +// key_length is its length +// slight change for C++, 2004/2/26 void init_by_array( unsigned long init_key[], int key_length ); -/* generates a random number on [0,0xffffffff]-interval */ +// generates a random number on [0,0xffffffff]-interval unsigned long genrand_int32( void ); -/* generates a random number on [0,0x7fffffff]-interval */ +// generates a random number on [0,0x7fffffff]-interval long genrand_int31( void ); -/* These real versions are due to Isaku Wada, 2002/01/09 added */ -/* generates a random number on [0,1]-real-interval */ +// These real versions are due to Isaku Wada, 2002/01/09 added +// generates a random number on [0,1]-real-interval double genrand_real1( void ); -/* generates a random number on [0,1)-real-interval */ +// generates a random number on [0,1)-real-interval double genrand_real2( void ); -/* generates a random number on (0,1)-real-interval */ +// generates a random number on (0,1)-real-interval double genrand_real3( void ); -/* generates a random number on [0,1) with 53-bit resolution*/ +// generates a random number on [0,1) with 53-bit resolution double genrand_res53( void ); Modified: trunk/src/pdfutils.c =================================================================== --- trunk/src/pdfutils.c 2010-10-11 21:41:06 UTC (rev 11256) +++ trunk/src/pdfutils.c 2010-10-11 22:34:18 UTC (rev 11257) @@ -1,36 +1,36 @@ -/* $Id$ - * - * pdf_utils.c - * - * Copyright (C) 1992, 1993, 1994, 1995 - * Maurice LeBrun mj...@di... - * Institute for Fusion Studies University of Texas at Austin - * - * Copyright (C) 2004 Joao Cardoso - * Copyright (C) 2004 Alan W. Irwin - * Copyright (C) 2004 Andrew Ross - * - * This file is part of PLplot. - * - * PLplot is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Library Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * PLplot is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with PLplot; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * - * These functions do the low-level reading/writing of portable data files. - * Data can be written to/read from either a file handle or memory buffer. - */ +// $Id$ +// +// pdf_utils.c +// +// Copyright (C) 1992, 1993, 1994, 1995 +// Maurice LeBrun mj...@di... +// Institute for Fusion Studies University of Texas at Austin +// +// Copyright (C) 2004 Joao Cardoso +// Copyright (C) 2004 Alan W. Irwin +// Copyright (C) 2004 Andrew Ross +// +// This file is part of PLplot. +// +// PLplot is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Library Public License as published +// by the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// PLplot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with PLplot; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +// +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +// +// These functions do the low-level reading/writing of portable data files. +// Data can be written to/read from either a file handle or memory buffer. +// #define NEED_PLDEBUG #include "plplotP.h" @@ -40,11 +40,11 @@ static int debug = 0; -/*--------------------------------------------------------------------------*\ - * void pdf_set (string, value) - * - * Set an option. Pretty sparse right now but you never know. - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// void pdf_set (string, value) +// +// Set an option. Pretty sparse right now but you never know. +//-------------------------------------------------------------------------- void pdf_set( char *option, int value ) @@ -53,12 +53,12 @@ debug = value; } -/*--------------------------------------------------------------------------*\ - * pdf_fopen() - * - * Initializes a PDFstrm for a file oriented device. - * Used exactly like fopen(). - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// pdf_fopen() +// +// Initializes a PDFstrm for a file oriented device. +// Used exactly like fopen(). +//-------------------------------------------------------------------------- PDFstrm * pdf_fopen( const char *filename, const char *mode ) @@ -82,7 +82,7 @@ int binary = 0; char *m, *p; - /* Copy over the mode, removing 'b' if needed */ + // Copy over the mode, removing 'b' if needed for ( m = mode, p = new_mode; *m != 0; m++ ) { if ( *m == 'b' ) @@ -125,12 +125,12 @@ return pdfs; } -/*--------------------------------------------------------------------------*\ - * pdf_bopen() - * - * Initializes a PDFstrm for reading/writing to a memory buffer. - * If buffer is NULL, a standard buffer is allocated. - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// pdf_bopen() +// +// Initializes a PDFstrm for reading/writing to a memory buffer. +// If buffer is NULL, a standard buffer is allocated. +//-------------------------------------------------------------------------- PDFstrm * pdf_bopen( U_CHAR *buffer, long bufmax ) @@ -173,12 +173,12 @@ return pdfs; } -/*--------------------------------------------------------------------------*\ - * pdf_finit() - * - * Initializes a PDFstrm for a file oriented device. - * Like pdf_fopen() but an existing file handle is specified. - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// pdf_finit() +// +// Initializes a PDFstrm for a file oriented device. +// Like pdf_fopen() but an existing file handle is specified. +//-------------------------------------------------------------------------- PDFstrm * pdf_finit( FILE *file ) @@ -202,12 +202,12 @@ return pdfs; } -/*--------------------------------------------------------------------------*\ - * pdf_close() - * - * Closes a PDFstrm. - * Used exactly like fclose(). - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// pdf_close() +// +// Closes a PDFstrm. +// Used exactly like fclose(). +//-------------------------------------------------------------------------- int pdf_close( PDFstrm *pdfs ) @@ -235,11 +235,11 @@ return 0; } -/*--------------------------------------------------------------------------*\ - * int pdf_putc() - * - * Writes a single character. - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// int pdf_putc() +// +// Writes a single character. +//-------------------------------------------------------------------------- int pdf_putc( int c, PDFstrm *pdfs ) @@ -279,11 +279,11 @@ return result; } -/*--------------------------------------------------------------------------*\ - * int pdf_getc() - * - * Reads a single character. - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// int pdf_getc() +// +// Reads a single character. +//-------------------------------------------------------------------------- int pdf_getc( PDFstrm *pdfs ) @@ -313,11 +313,11 @@ return result; } -/*--------------------------------------------------------------------------*\ - * int pdf_ungetc() - * - * Push back the last command read. - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// int pdf_ungetc() +// +// Push back the last command read. +//-------------------------------------------------------------------------- int pdf_ungetc( int c, PDFstrm *pdfs ) @@ -352,11 +352,11 @@ return result; } -/*--------------------------------------------------------------------------*\ - * int pdf_wrx() - * - * Writes a record. - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// int pdf_wrx() +// +// Writes a record. +//-------------------------------------------------------------------------- static int pdf_wrx( const U_CHAR *x, long nitems, PDFstrm *pdfs ) @@ -398,11 +398,11 @@ return result; } -/*--------------------------------------------------------------------------*\ - * int pdf_rdx() - * - * Reads a record. - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// int pdf_rdx() +// +// Reads a record. +//-------------------------------------------------------------------------- int pdf_rdx( U_CHAR *x, long nitems, PDFstrm *pdfs ) @@ -435,13 +435,13 @@ return result; } -/*--------------------------------------------------------------------------*\ - * pdf_wr_header() - * - * Writes a header string. Input string must be NULL-terminated. The - * written string is terminated by a new-line, not a NULL. This is done - * so you can type e.g. "% strings <file> | head" and get sensible output. - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// pdf_wr_header() +// +// Writes a header string. Input string must be NULL-terminated. The +// written string is terminated by a new-line, not a NULL. This is done +// so you can type e.g. "% strings <file> | head" and get sensible output. +//-------------------------------------------------------------------------- int pdf_wr_header( PDFstrm *pdfs, char *header ) @@ -463,12 +463,12 @@ return 0; } -/*--------------------------------------------------------------------------*\ - * int pdf_rd_header - * - * Reads a newline-terminated header string from PDFstrm *pdfs, and - * converts to a usual NULL-terminated string. 80 chars maximum assumed. - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// int pdf_rd_header +// +// Reads a newline-terminated header string from PDFstrm *pdfs, and +// converts to a usual NULL-terminated string. 80 chars maximum assumed. +//-------------------------------------------------------------------------- int pdf_rd_header( PDFstrm *pdfs, char *header ) @@ -486,15 +486,15 @@ if ( header[i] == '\n' ) break; } - header[i] = '\0'; /* NULL terminate */ + header[i] = '\0'; // NULL terminate return 0; } -/*--------------------------------------------------------------------------*\ - * pdf_wr_string() - * - * Writes a null-terminated string. - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// pdf_wr_string() +// +// Writes a null-terminated string. +//-------------------------------------------------------------------------- int pdf_wr_string( PDFstrm *pdfs, const char *string ) @@ -512,12 +512,12 @@ return 0; } -/*--------------------------------------------------------------------------*\ - * int pdf_rd_string - * - * Reads a null-terminated string from PDFstrm *pdfs. - * A max of nmax chars are read. - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// int pdf_rd_string +// +// Reads a null-terminated string from PDFstrm *pdfs. +// A max of nmax chars are read. +//-------------------------------------------------------------------------- int pdf_rd_string( PDFstrm *pdfs, char *string, int nmax ) @@ -535,15 +535,15 @@ if ( c == '\0' ) break; } - string[i] = '\0'; /* handle boundary case */ + string[i] = '\0'; // handle boundary case return 0; } -/*--------------------------------------------------------------------------*\ - * int pdf_wr_1byte() - * - * Writes a U_CHAR as a single byte. - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// int pdf_wr_1byte() +// +// Writes a U_CHAR as a single byte. +//-------------------------------------------------------------------------- int pdf_wr_1byte( PDFstrm *pdfs, U_CHAR s ) @@ -557,11 +557,11 @@ return 0; } -/*--------------------------------------------------------------------------*\ - * int pdf_rd_1byte() - * - * Reads a single byte, storing into a U_CHAR. - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// int pdf_rd_1byte() +// +// Reads a single byte, storing into a U_CHAR. +//-------------------------------------------------------------------------- int pdf_rd_1byte( PDFstrm *pdfs, U_CHAR *ps ) @@ -575,11 +575,11 @@ return 0; } -/*--------------------------------------------------------------------------*\ - * pdf_wr_2bytes() - * - * Writes a U_SHORT as two single bytes, low end first. - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// pdf_wr_2bytes() +// +// Writes a U_SHORT as two single bytes, low end first. +//-------------------------------------------------------------------------- int pdf_wr_2bytes( PDFstrm *pdfs, U_SHORT s ) @@ -595,11 +595,11 @@ return 0; } -/*--------------------------------------------------------------------------*\ - * pdf_rd_2bytes() - * - * Reads a U_SHORT from two single bytes, low end first. - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// pdf_rd_2bytes() +// +// Reads a U_SHORT from two single bytes, low end first. +//-------------------------------------------------------------------------- int pdf_rd_2bytes( PDFstrm *pdfs, U_SHORT *ps ) @@ -616,11 +616,11 @@ return 0; } -/*--------------------------------------------------------------------------*\ - * pdf_wr_2nbytes() - * - * Writes n U_SHORT's as 2n single bytes, low end first. - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// pdf_wr_2nbytes() +// +// Writes n U_SHORT's as 2n single bytes, low end first. +//-------------------------------------------------------------------------- int pdf_wr_2nbytes( PDFstrm *pdfs, U_SHORT *s, PLINT n ) @@ -639,11 +639,11 @@ return 0; } -/*--------------------------------------------------------------------------*\ - * pdf_rd_2nbytes() - * - * Reads n U_SHORT's from 2n single bytes, low end first. - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// pdf_rd_2nbytes() +// +// Reads n U_SHORT's from 2n single bytes, low end first. +//-------------------------------------------------------------------------- int pdf_rd_2nbytes( PDFstrm *pdfs, U_SHORT *s, PLINT n ) @@ -663,11 +663,11 @@ return 0; } -/*--------------------------------------------------------------------------*\ - * pdf_wr_4bytes() - * - * Writes an unsigned long as four single bytes, low end first. - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// pdf_wr_4bytes() +// +// Writes an unsigned long as four single bytes, low end first. +//-------------------------------------------------------------------------- int pdf_wr_4bytes( PDFstrm *pdfs, U_LONG s ) @@ -685,11 +685,11 @@ return 0; } -/*--------------------------------------------------------------------------*\ - * pdf_rd_4bytes() - * - * Reads an unsigned long from 4 single bytes, low end first. - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// pdf_rd_4bytes() +// +// Reads an unsigned long from 4 single bytes, low end first. +//-------------------------------------------------------------------------- int pdf_rd_4bytes( PDFstrm *pdfs, U_LONG *ps ) @@ -708,66 +708,66 @@ return 0; } -/*--------------------------------------------------------------------------*\ - * Here is the IEEE floating point specification in both 32 bit and 64 bit - * precisions, from page 9 of "IEEE Standard for Binary Floating-Point - * Arithmetic", copyright 1985, IEEE Std 754-1985: - * - * - * Single Format - * - * msb means most significant bit - * lsb means least significant bit - * - * 1 8 23 - * _____________________________________________________________________ - * | | | | - * | s | e | f | - * |___|________________|______________________________________________| - * msb lsb msb lsb - * - * - * - * Double Format - * - * msb means most significant bit - * lsb means least significant bit - * - * 1 11 52 - * _____________________________________________________________________ - * | | | | - * | s | e | f | - * |___|________________|______________________________________________| - * msb lsb msb lsb - * - * - * (Thanks to: Andy Mai (ma...@nc...)) - * - * - * According to "inmos: Transputer instruction set" the IEEE standard - * specifies the floating format as: - * - * s exp frac - * - * Where: s = sign bit (1 bit) - * exp = exponent (8 bits for 32 bit float / 11 bits for 64 bit float) - * frac = fraction (23 bits for 32 bit float / 52 bits for 64 bit float) - * - * value of (s exp frac) = (-1)^s * 1.frac * 2^(exp-bias) ; if exp not 0 - * (-1)^s * 0.frac * 2^(1-bias) ; if exp = 0 - * - * where bias = 127 for 32 bit float - * bias = 1023 for 64 bit float - * - * (Thanks to: Tom Bjorkholm(TBJ...@ab...)) - * - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// Here is the IEEE floating point specification in both 32 bit and 64 bit +// precisions, from page 9 of "IEEE Standard for Binary Floating-Point +// Arithmetic", copyright 1985, IEEE Std 754-1985: +// +// +// Single Format +// +// msb means most significant bit +// lsb means least significant bit +// +// 1 8 23 +// _____________________________________________________________________ +// | | | | +// | s | e | f | +// |___|________________|______________________________________________| +// msb lsb msb lsb +// +// +// +// Double Format +// +// msb means most significant bit +// lsb means least significant bit +// +// 1 11 52 +// _____________________________________________________________________ +// | | | | +// | s | e | f | +// |___|________________|______________________________________________| +// msb lsb msb lsb +// +// +// (Thanks to: Andy Mai (ma...@nc...)) +// +// +// According to "inmos: Transputer instruction set" the IEEE standard +// specifies the floating format as: +// +// s exp frac +// +// Where: s = sign bit (1 bit) +// exp = exponent (8 bits for 32 bit float / 11 bits for 64 bit float) +// frac = fraction (23 bits for 32 bit float / 52 bits for 64 bit float) +// +// value of (s exp frac) = (-1)^s * 1.frac * 2^(exp-bias) ; if exp not 0 +// (-1)^s * 0.frac * 2^(1-bias) ; if exp = 0 +// +// where bias = 127 for 32 bit float +// bias = 1023 for 64 bit float +// +// (Thanks to: Tom Bjorkholm(TBJ...@ab...)) +// +//-------------------------------------------------------------------------- -/*--------------------------------------------------------------------------*\ - * int pdf_wr_ieeef() - * - * Writes a float in IEEE single precision (32 bit) format. - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// int pdf_wr_ieeef() +// +// Writes a float in IEEE single precision (32 bit) format. +//-------------------------------------------------------------------------- int pdf_wr_ieeef( PDFstrm *pdfs, float f ) @@ -806,7 +806,7 @@ e_ieee = e_new + bias; f_tmp = (float) ( f_new - 1 ); } - f_ieee = (U_LONG) ( f_tmp * 8388608 ); /* multiply by 2^23 */ + f_ieee = (U_LONG) ( f_tmp * 8388608 ); // multiply by 2^23 if ( e_ieee > 255 ) { @@ -832,11 +832,11 @@ return 0; } -/*--------------------------------------------------------------------------*\ - * int pdf_rd_ieeef() - * - * Reads a float from a IEEE single precision (32 bit) format. - \*--------------------------------------------------------------------------*/ +//-------------------------------------------------------------------------- +// int pdf_rd_ieeef() +// +// Reads a float from a IEEE single precision (32 bit) format. +//-------------------------------------------------------------------------- int pdf_rd_ieeef( PDFstrm *pdfs, float *pf ) @@ -853,7 +853,7 @@ e_ieee = ( value & (U_LONG) 0x7F800000 ) >> 23; f_ieee = ( value & (U_LONG) 0x007FFFFF ); - f_tmp = (double) f_ieee / 8388608.0; /* divide by 2^23 */ + f_tmp = (double) f_ieee / 8388608.0; // divide by 2^23 if ( e_ieee == 0 ) { @@ -881,14 +881,14 @@ return 0; } -/*--------------------------------------------------------------------------*\ - * print_ieeef() - * - * Prints binary representation for numbers pointed to by arguments. - * The first argument is the original float, the second is the - * IEEE representation. They should be the same on any machine that - * uses IEEE floats. - \*------------------------... [truncated message content] |