ftp.nice.ch/pub/next/unix/developer/docgen.0.3.2.s.tar.gz#/docgen-0.3.2/parsers.h

This is parsers.h in view mode; [Download] [Up]

/*
  docgen  Objective C Document Generator
  Copyright (C) 1995  Bill Bereza.
  
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.
  
  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  
  Email:
  berezaw@river.it.gvsu.edu

  S-mail:
  Bill Bereza
  9526 Judson Rd.
  Ravenna, MI 49451-9427

  */
/* docgen	Objective C Document Generator
 * Copyright (c) 1994 Bill Bereza
 *
 *	$Log:	parsers.h,v $
 * Revision 1.25  96/01/07  01:30:32  berezaw
 * additions for 0.3.2
 * 
 * Revision 1.24  95/07/26  17:50:49  berezaw
 * got before and after comments parsing to work
 * 
 * added findrealchr() function
 * 
 * Revision 1.23  95/07/26  16:17:33  berezaw
 * 0.3.1
 * 
 * Revision 1.22  95/07/21  15:22:48  berezaw
 * *** empty log message ***
 * 
 * Revision 1.21  95/07/16  19:19:57  berezaw
 * 
 * bug fix found by pburka
 * 
 * Revision 1.20  95/03/02  18:54:43  berezaw
 * adjusting expressions for methods
 * 
 * Revision 1.19  95/03/02  03:44:48  berezaw
 * using GNU regex library
 * rewrote recmp() as docgen_recmp()
 * added GPL stuff to each file
 * increase rev. to 0.1.9
 * 
 * Revision 1.18  95/02/13  18:22:37  berezaw
 * *** empty log message ***
 * 
 * Revision 1.17  95/02/13  18:01:56  berezaw
 * fixed METHEXP
 * 
 * Revision 1.16  95/02/02  18:32:15  berezaw
 * 0.1.7, fixed problems with skipping lines
 * in odd classes
 * 
 * Revision 1.15  95/02/02  15:22:00  berezaw
 * 0.1.6
 * 
 * Revision 1.14  95/02/01  18:50:05  berezaw
 * 
 * 0.1.6
 * 
 * Revision 1.13  95/01/29  01:52:55  berezaw
 * reused code from parsemethods to create general
 * comment printing function to handle italicizing
 * variable names, and to eventually handle fancy
 * text
 * 
 * Revision 1.12  95/01/28  23:22:10  berezaw
 * added CPEXPII for the way _I_ do copyrights
 * ,
 * 
 * Revision 1.11  95/01/27  00:31:47  berezaw
 * added '-x' option to hide methods beginning with '_'
 * 
 * Revision 1.10  95/01/26  15:33:08  berezaw
 * added BSD, SYSV and HPUX checks
 * 
 * Revision 1.9  95/01/26  05:36:24  berezaw
 * major fixing in parseivars and parsemethodtypes
 * added dcmp()
 * changed parsemethods to handle multiple classes,
 * to use a list that can be sorted,
 * and to handle method declarations better
 * 
 * Revision 1.8  94/11/28  12:08:37  berezaw
 * *** empty log message ***
 * 
 *
 *	$Id: parsers.h,v 1.25 96/01/07 01:30:32 berezaw Exp $
 */

#ifndef PARSERS_H
#define PARSERS_H

#include <ctype.h>
#include <limits.h>

#include "docgen.h"
#include "RTFcrap.h"

#include <sys/types.h>
#include <regex-0.12/regex.h>

#ifndef HAVE_FGETPOS
#define fpos_t long int
static int fgetpos(FILE *stream, fpos_t *pos)
{ return (int)(*pos=ftell(stream)); }

static int fsetpos(FILE *stream, const fpos_t *pos)
{ return fseek(stream, *pos, SEEK_SET); }
#endif

#define DOCGEN_REBUF	1024

/* maximum number of files to add to the inheritance list (to stop infinite loops) */
#ifndef MAX_INHERIT_SEARCHES
#define MAX_INHERIT_SEARCHES	200
#endif

/* syntax for docgen regular expressions */
#define DOCGEN_SYNTAX ( RE_BK_PLUS_QM | RE_DOT_NOT_NULL )

/* regular-expression daffynitions */
#define SETEXP "^ *-.*set.*:"
#define CLASSMETH "^ *+ *[^0-9+-]"

#define WHITEXP		"^ *$"		/* Matches lines of all white space */
#define CPEXP		".*COPYRIGHT" /* Find a commented Copyright notice */
#define CPEXPII		".*Copyright"
#define STOPEXP		".*\\*/"	/* Find comment delimiter, looser than comment starter */
#define STARTEXP	"^/\\*"	/* Find comment starter, only finds comments on their own line */
#define IMPLEM		"^ *@imp"	/* Find @implementation line */
#define INTERFACE	"^ *@interface" /* Find @interface line */
#define DONEINT		".*@end"	/* Find @end line, looser to stop runs to eof */
#define IVARBEG		"^ *{"		/* Line beginning instance variables */
#define IVAREND		"^ *}"		/* Line at end of instance variables */
#define IVARNONE      "^ *{ *}"       /* Empty istance variable block */
#define	IDESCEXP	".*; */"		/* instance variable description comment prefix */
#define METHEXP		"^ *[-+] *[^0-9+-]"	/* expression to find a method */
#define UNDOC		"^ *[-+].*[ )]*_" /* Pattern for methods that should be undocumented */
#define SEEALSO		"^ *See.*:" /* Expression for extra special text in
								 * method descriptions
								 */

/* not-regular-expression definitions */
#define CLASSCHK	":"			/* If this is in the interface line it is a Class */
#define CATCHK		"("			/*                    "                     Category */
#define	TOKSPACE	" \t"		/* String of whitespace chars */
#define INTTOK		":( "		/* characters that seperate tokens in the @interface */
#define TOKPARENS	"("			/* Left parenthesis */
#define IDESCSTR	"//"		/* String signifying start of i-var descriptions */
#define IDESCCHAR	'/'			/* Character that is the first of i-var description */
#define IVTOK		";"			/* Seperates the declaration from the comment */
#define DESCRIPTOK	" \t"		/* String of whitespace for method descriptions */
#define PUNCS		"!;,.?"		/* String of chars that might be at the end of a word */

typedef enum { none, class, category } ofiletype;

extern DSTRING *GLOB_istring;

extern int parseivars(FILE *RTFf, FILE *Hf, char *FQh);
extern void parsemethodtype(FILE *Hf, FILE *RTFf, char *hline);
extern void parsecomments(FILE *RTFf, char *mline, DSTRING *dynstr);
extern void parsemethods(FILE *Mf, FILE *RTFf, char *mline, fpos_t currPos);
extern void traceinheritance(FILE *RTFf, char *hdir, char *hname);

extern int docgen_recmp(char *expr, char *line);

#define SKIPSPACE(s)	while(isspace(*(s)) && *(s)) (s)++
#define SKIPTOCHAR(s,c)	while(*(s) != (c) && *(s)) (s)++
#define SKIPCHAR(s,c)	while(*(s) == (c) && *(s)) (s)++

#define SKIPPARENS(c) \
{\
   int __parencount=1;\
	 while(__parencount && *(c)) { (c)++; if(*(c)=='(') __parencount++; else if(*(c)==')') __parencount--; }\
	   if(*(c)) \
		 (c)++;\
	   }



#endif /* PARSERS_H */

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.