lib/libvcc/vcc_compile.c
int
VCC_Compile(struct vcc *tl, struct vsb **sb,
    const char *vclsrc, const char *vclsrcfile,
    const char *ofile, const char *jfile)
{
	struct source *sp;
	struct vsb *r = NULL;
	int retval = 0;

	CHECK_OBJ_NOTNULL(tl, VCC_MAGIC);
	AN(sb);
	AN(vclsrcfile);
	AN(ofile);
	AN(jfile);

	AZ(vcc_builtin);
	vcc_builtin = vcc_ParseBuiltin(tl);
	AN(vcc_builtin);
	if (vcc_builtin->err) {
		AZ(VSB_finish(vcc_builtin->sb));
		*sb = vcc_builtin->sb;
		return (-1);
	}

	if (vclsrc != NULL)
		sp = vcc_new_source(vclsrc, "vcl.inline", vclsrcfile);
	else
		sp = vcc_file_source(tl, vclsrcfile);

	if (sp != NULL)
		r = vcc_CompileSource(tl, sp, jfile);

	if (r != NULL) {
		retval = TLWriteVSB(tl, ofile, r, "C-source");
		VSB_destroy(&r);
	} else {
		retval = -1;
	}
	AZ(VSB_finish(tl->sb));
	*sb = tl->sb;
	return (retval);
}
/*--------------------------------------------------------------------
 * Compile the VCL code in the argument.  Error messages, if any are
 * formatted into the vsb.
 */
Compile the VCL code in the argument.  Error messages, if any are
formatted into the vsb.
Compile the VCL code in the argument . Error messages if any are formatted into the vsb .
int
VCC_Compile(struct vcc *tl, struct vsb **sb,
    const char *vclsrc, const char *vclsrcfile,
    const char *ofile, const char *jfile)
{
	struct source *sp;
	struct vsb *r = NULL;
	int retval = 0;
	CHECK_OBJ_NOTNULL(tl, VCC_MAGIC);
	AN(sb);
	AN(vclsrcfile);
	AN(ofile);
	AN(jfile);
	AZ(vcc_builtin);
	vcc_builtin = vcc_ParseBuiltin(tl);
	AN(vcc_builtin);
	if (vcc_builtin->err) {
		AZ(VSB_finish(vcc_builtin->sb));
		*sb = vcc_builtin->sb;
		return (-1);
	}
	if (vclsrc != NULL)
		sp = vcc_new_source(vclsrc, "vcl.inline", vclsrcfile);
	else
		sp = vcc_file_source(tl, vclsrcfile);
	if (sp != NULL)
		r = vcc_CompileSource(tl, sp, jfile);
	if (r != NULL) {
		retval = TLWriteVSB(tl, ofile, r, "C-source");
		VSB_destroy(&r);
	} else {
		retval = -1;
	}
	AZ(VSB_finish(tl->sb));
	*sb = tl->sb;
	return (retval);
}
int VCC_Compile ( struct vcc * tl , struct vsb * * sb , const char * vclsrc , const char * vclsrcfile , const char * ofile , const char * jfile ) { struct source * sp ; struct vsb * r = NULL ; int retval = 0 ; CHECK_OBJ_NOTNULL ( tl , VCC_MAGIC ) ; AN ( sb ) ; AN ( vclsrcfile ) ; AN ( ofile ) ; AN ( jfile ) ; AZ ( vcc_builtin ) ; vcc_builtin = vcc_ParseBuiltin ( tl ) ; AN ( vcc_builtin ) ; if ( vcc_builtin -> err ) { AZ ( VSB_finish ( vcc_builtin -> sb ) ) ; * sb = vcc_builtin -> sb ; return ( -1 ) ; } if ( vclsrc != NULL ) sp = vcc_new_source ( vclsrc , " " , vclsrcfile ) ; else sp = vcc_file_source ( tl , vclsrcfile ) ; if ( sp != NULL ) r = vcc_CompileSource ( tl , sp , jfile ) ; if ( r != NULL ) { retval = TLWriteVSB ( tl , ofile , r , " " ) ; VSB_destroy ( & r ) ; } else { retval = -1 ; } AZ ( VSB_finish ( tl -> sb ) ) ; * sb = tl -> sb ; return ( retval ) ; }
Compile the VCL code in the argument.
Compile the VCL code in the argument .