FreeBSD/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c
/*
 * The #line directive is used to reset the input line number and to optionally
 * note the file name for use in error messages.  Sun cpp(1) also produces a
 * third integer token after the filename which is one of the following:
 *
 * 0 - line change has nothing to do with an #include file
 * 1 - line change because we just entered a #include file
 * 2 - line change because we just exited a #include file
 *
 * We use these state tokens to adjust pcb_idepth, which in turn controls
 * whether type lookups access the global type space or not.
 */
The #line directive is used to reset the input line number and to optionally
note the file name for use in error messages.  Sun cpp(1) also produces a
third integer token after the filename which is one of the following.

line change has nothing to do with an #include file
1 - line change because we just entered a #include file
2 - line change because we just exited a #include file

We use these state tokens to adjust pcb_idepth, which in turn controls
whether type lookups access the global type space or not.
The #line directive is used to reset the input line number and to optionally note the file name for use in error messages . Sun cpp ( 1 ) also produces a third integer token after the filename which is one of the following . line change has nothing to do with an #include file 1 - line change because we just entered a #include file 2 - line change because we just exited a #include file We use these state tokens to adjust pcb_idepth which in turn controls whether type lookups access the global type space or not .
static void
dt_pragma_line(const char *prname, dt_node_t *dnp)
{
	dt_node_t *fnp = dnp ? dnp->dn_list : NULL;
	dt_node_t *inp = fnp ? fnp->dn_list : NULL;
	if ((dnp == NULL || dnp->dn_kind != DT_NODE_INT) ||
	    (fnp != NULL && fnp->dn_kind != DT_NODE_STRING) ||
	    (inp != NULL && inp->dn_kind != DT_NODE_INT)) {
		xyerror(D_PRAGMA_MALFORM, "malformed #%s "
		    "<line> [ [\"file\"] state ]\n", prname);
	}
	if (fnp != NULL) {
		if (yypcb->pcb_filetag != NULL)
			free(yypcb->pcb_filetag);
		if (strncmp(fnp->dn_string, "/dev/fd/", 8) != 0) {
			yypcb->pcb_filetag = fnp->dn_string;
			fnp->dn_string = NULL;
		} else
			yypcb->pcb_filetag = NULL;
	}
	if (inp != NULL) {
		if (inp->dn_value == 1)
			yypcb->pcb_idepth++;
		else if (inp->dn_value == 2 && yypcb->pcb_idepth != 0)
			yypcb->pcb_idepth--;
	}
	yylineno = dnp->dn_value;
}
static void dt_pragma_line ( const char * prname , dt_node_t * dnp ) { dt_node_t * fnp = dnp ? dnp -> dn_list : NULL ; dt_node_t * inp = fnp ? fnp -> dn_list : NULL ; if ( ( dnp == NULL || dnp -> dn_kind != DT_NODE_INT ) || ( fnp != NULL && fnp -> dn_kind != DT_NODE_STRING ) || ( inp != NULL && inp -> dn_kind != DT_NODE_INT ) ) { xyerror ( D_PRAGMA_MALFORM , " " " \" \" \n " , prname ) ; } if ( fnp != NULL ) { if ( yypcb -> pcb_filetag != NULL ) free ( yypcb -> pcb_filetag ) ; if ( strncmp ( fnp -> dn_string , " " , 8 ) != 0 ) { yypcb -> pcb_filetag = fnp -> dn_string ; fnp -> dn_string = NULL ; } else yypcb -> pcb_filetag = NULL ; } if ( inp != NULL ) { if ( inp -> dn_value == 1 ) yypcb -> pcb_idepth ++ ; else if ( inp -> dn_value == 2 && yypcb -> pcb_idepth != 0 ) yypcb -> pcb_idepth -- ; } yylineno = dnp -> dn_value ; }
The #line directive is used to reset the input line number and to optionally
 note the file name for use in error messages.
The #line directive is used to reset the input line number and to optionally note the file name for use in error messages .
/*
	 * If a file is specified, free any old pcb_filetag and swap fnp's
	 * dn_string into pcb_filetag as the new filename for error messages.
	 */ /*
		 * This is not pretty, but is a necessary evil until we either
		 * write "dpp" or get a useful standalone cpp from DevPro.  If
		 * the filename begins with /dev/fd, we know it's the master
		 * input file (see dt_preproc() in dt_cc.c), so just clear the
		 * dt_filetag pointer so error messages refer to the main file.
		 */