xref: /onnv-gate/usr/src/lib/libpp/common/ppincref.c (revision 10898:1883b621b3ea)
14887Schin /***********************************************************************
24887Schin *                                                                      *
34887Schin *               This software is part of the ast package               *
4*10898Sroland.mainz@nrubsig.org *          Copyright (c) 1986-2009 AT&T Intellectual Property          *
54887Schin *                      and is licensed under the                       *
64887Schin *                  Common Public License, Version 1.0                  *
78462SApril.Chin@Sun.COM *                    by AT&T Intellectual Property                     *
84887Schin *                                                                      *
94887Schin *                A copy of the License is available at                 *
104887Schin *            http://www.opensource.org/licenses/cpl1.0.txt             *
114887Schin *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
124887Schin *                                                                      *
134887Schin *              Information and Software Systems Research               *
144887Schin *                            AT&T Research                             *
154887Schin *                           Florham Park NJ                            *
164887Schin *                                                                      *
174887Schin *                 Glenn Fowler <gsf@research.att.com>                  *
184887Schin *                                                                      *
194887Schin ***********************************************************************/
204887Schin #pragma prototyped
214887Schin /*
224887Schin  * Glenn Fowler
234887Schin  * AT&T Research
244887Schin  *
254887Schin  * common include reference handler
264887Schin  * the type arg is inclusive or of PP_SYNC_*
274887Schin  */
284887Schin 
294887Schin #include "pplib.h"
304887Schin 
314887Schin void
ppincref(char * parent,char * file,int line,int type)324887Schin ppincref(char* parent, char* file, int line, int type)
334887Schin {
344887Schin 	register struct ppinstk*	sp;
354887Schin 	int				level;
364887Schin 
374887Schin 	NoP(parent);
384887Schin 	NoP(line);
394887Schin 	if (type & PP_SYNC_PUSH)
404887Schin 	{
414887Schin 		level = 0;
424887Schin 		for (sp = pp.in; sp; sp = sp->prev)
434887Schin 			if (sp->type == IN_FILE)
444887Schin 				level++;
454887Schin 		if (level > 0)
464887Schin 			level--;
474887Schin 		error(0, "%-*s%s", level * 4, "", file);
484887Schin 	}
494887Schin }
50