⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ansi2knr.c

📁 linux下的jpeg解码库
💻 C
📖 第 1 页 / 共 2 页
字号:
/* ansi2knr.c *//* Convert ANSI C function definitions to K&R ("traditional C") syntax *//*ansi2knr is distributed in the hope that it will be useful, but WITHOUT ANYWARRANTY.  No author or distributor accepts responsibility to anyone for theconsequences of using it or for whether it serves any particular purpose orworks at all, unless he says so in writing.  Refer to the GNU General PublicLicense (the "GPL") for full details.Everyone is granted permission to copy, modify and redistribute ansi2knr,but only under the conditions described in the GPL.  A copy of this licenseis supposed to have been given to you along with ansi2knr so you can knowyour rights and responsibilities.  It should be in a file named COPYLEFT.[In the IJG distribution, the GPL appears below, not in a separate file.]Among other things, the copyright notice and this notice must be preservedon all copies.We explicitly state here what we believe is already implied by the GPL: ifthe ansi2knr program is distributed as a separate set of sources and aseparate executable file which are aggregated on a storage medium togetherwith another program, this in itself does not bring the other program underthe GPL, nor does the mere fact that such a program or the procedures forconstructing it invoke the ansi2knr executable bring any other part of theprogram under the GPL.*//*---------- Here is the GNU GPL file COPYLEFT, referred to above --------------- These terms do NOT apply to the JPEG software itself; see README ------		    GHOSTSCRIPT GENERAL PUBLIC LICENSE		    (Clarified 11 Feb 1988) Copyright (C) 1988 Richard M. Stallman Everyone is permitted to copy and distribute verbatim copies of this license, but changing it is not allowed.  You can also use this wording to make the terms for other programs.  The license agreements of most software companies keep you at themercy of those companies.  By contrast, our general public license isintended to give everyone the right to share Ghostscript.  To make surethat you get the rights we want you to have, we need to makerestrictions that forbid anyone to deny you these rights or to ask youto surrender the rights.  Hence this license agreement.  Specifically, we want to make sure that you have the right to giveaway copies of Ghostscript, that you receive source code or else can getit if you want it, that you can change Ghostscript or use pieces of itin new free programs, and that you know you can do these things.  To make sure that everyone has such rights, we have to forbid you todeprive anyone else of these rights.  For example, if you distributecopies of Ghostscript, you must give the recipients all the rights thatyou have.  You must make sure that they, too, receive or can get thesource code.  And you must tell them their rights.  Also, for our own protection, we must make certain that everyone findsout that there is no warranty for Ghostscript.  If Ghostscript ismodified by someone else and passed on, we want its recipients to knowthat what they have is not what we distributed, so that any problemsintroduced by others will not reflect on our reputation.  Therefore we (Richard M. Stallman and the Free Software Foundation,Inc.) make the following terms which say what you must do to be allowedto distribute or change Ghostscript.			COPYING POLICIES  1. You may copy and distribute verbatim copies of Ghostscript sourcecode as you receive it, in any medium, provided that you conspicuouslyand appropriately publish on each copy a valid copyright and licensenotice "Copyright (C) 1989 Aladdin Enterprises.  All rights reserved.Distributed by Free Software Foundation, Inc." (or with whatever year isappropriate); keep intact the notices on all files that refer to thisLicense Agreement and to the absence of any warranty; and give any otherrecipients of the Ghostscript program a copy of this License Agreementalong with the program.  You may charge a distribution fee for thephysical act of transferring a copy.  2. You may modify your copy or copies of Ghostscript or any portion ofit, and copy and distribute such modifications under the terms ofParagraph 1 above, provided that you also do the following:    a) cause the modified files to carry prominent notices stating    that you changed the files and the date of any change; and    b) cause the whole of any work that you distribute or publish,    that in whole or in part contains or is a derivative of Ghostscript    or any part thereof, to be licensed at no charge to all third    parties on terms identical to those contained in this License    Agreement (except that you may choose to grant more extensive    warranty protection to some or all third parties, at your option).    c) You may charge a distribution fee for the physical act of    transferring a copy, and you may at your option offer warranty    protection in exchange for a fee.Mere aggregation of another unrelated program with this program (or itsderivative) on a volume of a storage or distribution medium does not bringthe other program under the scope of these terms.  3. You may copy and distribute Ghostscript (or a portion or derivativeof it, under Paragraph 2) in object code or executable form under theterms of Paragraphs 1 and 2 above provided that you also do one of thefollowing:    a) accompany it with the complete corresponding machine-readable    source code, which must be distributed under the terms of    Paragraphs 1 and 2 above; or,    b) accompany it with a written offer, valid for at least three    years, to give any third party free (except for a nominal    shipping charge) a complete machine-readable copy of the    corresponding source code, to be distributed under the terms of    Paragraphs 1 and 2 above; or,    c) accompany it with the information you received as to where the    corresponding source code may be obtained.  (This alternative is    allowed only for noncommercial distribution and only if you    received the program in object code or executable form alone.)For an executable file, complete source code means all the source code forall modules it contains; but, as a special exception, it need not includesource code for modules which are standard libraries that accompany theoperating system on which the executable file runs.  4. You may not copy, sublicense, distribute or transfer Ghostscriptexcept as expressly provided under this License Agreement.  Any attemptotherwise to copy, sublicense, distribute or transfer Ghostscript isvoid and your rights to use the program under this License agreementshall be automatically terminated.  However, parties who have receivedcomputer software programs from you with this License Agreement will nothave their licenses terminated so long as such parties remain in fullcompliance.  5. If you wish to incorporate parts of Ghostscript into other freeprograms whose distribution conditions are different, write to the FreeSoftware Foundation at 675 Mass Ave, Cambridge, MA 02139.  We have notyet worked out a simple rule that can be stated here, but we will oftenpermit this.  We will be guided by the two goals of preserving the freestatus of all derivatives of our free software and of promoting thesharing and reuse of software.Your comments and suggestions about our licensing policies and oursoftware are welcome!  Please contact the Free Software Foundation,Inc., 675 Mass Ave, Cambridge, MA 02139, or call (617) 876-3296.		       NO WARRANTY  BECAUSE GHOSTSCRIPT IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELYNO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW.  EXCEPTWHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC, RICHARDM. STALLMAN, ALADDIN ENTERPRISES, L. PETER DEUTSCH, AND/OR OTHER PARTIESPROVIDE GHOSTSCRIPT "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHEREXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIEDWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THEENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF GHOSTSCRIPT IS WITHYOU.  SHOULD GHOSTSCRIPT PROVE DEFECTIVE, YOU ASSUME THE COST OF ALLNECESSARY SERVICING, REPAIR OR CORRECTION.  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL RICHARD M.STALLMAN, THE FREE SOFTWARE FOUNDATION, INC., L. PETER DEUTSCH, ALADDINENTERPRISES, AND/OR ANY OTHER PARTY WHO MAY MODIFY AND REDISTRIBUTEGHOSTSCRIPT AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDINGANY LOST PROFITS, LOST MONIES, OR OTHER SPECIAL, INCIDENTAL ORCONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDEREDINACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A FAILURE OF THEPROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) GHOSTSCRIPT, EVEN IF YOUHAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIMBY ANY OTHER PARTY.-------------------- End of file COPYLEFT ------------------------------*//* * Usage:	ansi2knr input_file [output_file] * If no output_file is supplied, output goes to stdout. * There are no error messages. * * ansi2knr recognizes function definitions by seeing a non-keyword * identifier at the left margin, followed by a left parenthesis, * with a right parenthesis as the last character on the line, * and with a left brace as the first token on the following line * (ignoring possible intervening comments). * It will recognize a multi-line header provided that no intervening * line ends with a left or right brace or a semicolon. * These algorithms ignore whitespace and comments, except that * the function name must be the first thing on the line. * The following constructs will confuse it: *	- Any other construct that starts at the left margin and *	    follows the above syntax (such as a macro or function call). *	- Some macros that tinker with the syntax of the function header. *//* * The original and principal author of ansi2knr is L. Peter Deutsch * <ghost@aladdin.com>.  Other authors are noted in the change history * that follows (in reverse chronological order):	lpd 96-01-21 added code to cope with not HAVE_CONFIG_H and with		compilers that don't understand void, as suggested by		Tom Lane	lpd 96-01-15 changed to require that the first non-comment token		on the line following a function header be a left brace,		to reduce sensitivity to macros, as suggested by Tom Lane		<tgl@sss.pgh.pa.us>	lpd 95-06-22 removed #ifndefs whose sole purpose was to define		undefined preprocessor symbols as 0; changed all #ifdefs		for configuration symbols to #ifs	lpd 95-04-05 changed copyright notice to make it clear that		including ansi2knr in a program does not bring the entire		program under the GPL	lpd 94-12-18 added conditionals for systems where ctype macros		don't handle 8-bit characters properly, suggested by		Francois Pinard <pinard@iro.umontreal.ca>;		removed --varargs switch (this is now the default)	lpd 94-10-10 removed CONFIG_BROKETS conditional	lpd 94-07-16 added some conditionals to help GNU `configure',		suggested by Francois Pinard <pinard@iro.umontreal.ca>;		properly erase prototype args in function parameters,		contributed by Jim Avera <jima@netcom.com>;		correct error in writeblanks (it shouldn't erase EOLs)	lpd 89-xx-xx original version *//* Most of the conditionals here are to make ansi2knr work with *//* or without the GNU configure machinery. */#if HAVE_CONFIG_H# include <config.h>#endif#include <stdio.h>#include <ctype.h>#if HAVE_CONFIG_H/*   For properly autoconfiguring ansi2knr, use AC_CONFIG_HEADER(config.h).   This will define HAVE_CONFIG_H and so, activate the following lines. */# if STDC_HEADERS || HAVE_STRING_H#  include <string.h># else#  include <strings.h># endif#else /* not HAVE_CONFIG_H *//* Otherwise do it the hard way */# ifdef BSD#  include <strings.h># else#  ifdef VMS    extern int strlen(), strncmp();#  else#   include <string.h>#  endif# endif#endif /* not HAVE_CONFIG_H */#if STDC_HEADERS# include <stdlib.h>#else/*   malloc and free should be declared in stdlib.h,   but if you've got a K&R compiler, they probably aren't. */# ifdef MSDOS#  include <malloc.h># else#  ifdef VMS     extern char *malloc();     extern void free();#  else     extern char *malloc();     extern int free();#  endif# endif#endif/* * The ctype macros don't always handle 8-bit characters correctly. * Compensate for this here. */#ifdef isascii#  undef HAVE_ISASCII		/* just in case */#  define HAVE_ISASCII 1#else#endif#if STDC_HEADERS || !HAVE_ISASCII#  define is_ascii(c) 1#else#  define is_ascii(c) isascii(c)#endif#define is_space(c) (is_ascii(c) && isspace(c))#define is_alpha(c) (is_ascii(c) && isalpha(c))#define is_alnum(c) (is_ascii(c) && isalnum(c))/* Scanning macros */#define isidchar(ch) (is_alnum(ch) || (ch) == '_')#define isidfirstchar(ch) (is_alpha(ch) || (ch) == '_')/* Forward references */char *skipspace();int writeblanks();int test1();int convert1();/* The main program */intmain(argc, argv)    int argc;    char *argv[];{	FILE *in, *out;#define bufsize 5000			/* arbitrary size */	char *buf;	char *line;	char *more;	/*	 * In previous versions, ansi2knr recognized a --varargs switch.	 * If this switch was supplied, ansi2knr would attempt to convert	 * a ... argument to va_alist and va_dcl; if this switch was not	 * supplied, ansi2knr would simply drop any such arguments.	 * Now, ansi2knr always does this conversion, and we only	 * check for this switch for backward compatibility.	 */	int convert_varargs = 1;	if ( argc > 1 && argv[1][0] == '-' )	  {	if ( !strcmp(argv[1], "--varargs") )		  {	convert_varargs = 1;			argc--;			argv++;		  }		else		  {	fprintf(stderr, "Unrecognized switch: %s\n", argv[1]);			exit(1);		  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -