/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 2003-2011 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* Phong Vo <[email protected]> *17* *18***********************************************************************/19#include "vcwhdr.h"2021/* Open a handle for computing matching windows.22**23** Written by Kiem-Phong Vo ([email protected])24*/2526#if __STD_C27Vcwindow_t* vcwopen(Vcwdisc_t* disc, Vcwmethod_t* meth)28#else29Vcwindow_t* vcwopen(disc, meth)30Vcwdisc_t* disc;31Vcwmethod_t* meth; /* window matching method */32#endif33{34Vcwindow_t* vcw;3536if(!disc || (!disc->srcf && !disc->tarf) )37return NIL(Vcwindow_t*);38if(disc->srcf && sfseek(disc->srcf, (Sfoff_t)0, 0) < 0)39return NIL(Vcwindow_t*);40if(disc->tarf && sfseek(disc->tarf, (Sfoff_t)0, 0) < 0)41return NIL(Vcwindow_t*);4243if(!meth)44meth = Vcwdecode;4546if(!(vcw = (Vcwindow_t*)calloc(1,sizeof(Vcwindow_t))) )47return NIL(Vcwindow_t*);4849vcw->disc = disc;50vcw->meth = meth;51vcw->mtdata = NIL(Void_t*);5253if(disc->eventf && (*disc->eventf)(vcw, VCW_OPENING, 0, disc) < 0)54{ vcwclose(vcw);55return NIL(Vcwindow_t*);56}5758if(meth->eventf && (*meth->eventf)(vcw, VCW_OPENING) < 0)59{ vcwclose(vcw);60return NIL(Vcwindow_t*);61}6263return vcw;64}656667