/***********************************************************************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/* Return a windowing method by its string name.22**23** Written by Kiem-Phong Vo ([email protected])24*/2526/* List of currently supported windowing methods */27_BEGIN_EXTERNS_28extern Vcwmethod_t _Vcwprefix;29extern Vcwmethod_t _Vcwmirror;30extern Vcwmethod_t _Vcwvote;31_END_EXTERNS_3233static Vcwmethod_t* _Vcwmethods[] =34{35&_Vcwprefix,36&_Vcwmirror,37&_Vcwvote,38039};4041#if __STD_C42Vcwmethod_t* vcwgetmeth(char* name)43#else44Vcwmethod_t* vcwgetmeth(name)45char* name;46#endif47{48int i, k;4950if(!name)51return NIL(Vcwmethod_t*);5253for (i = 0; _Vcwmethods[i]; ++i)54{ for(k = 0; name[k] && _Vcwmethods[i]->name[k]; ++k)55if(name[k] != _Vcwmethods[i]->name[k])56break;57if(name[k] == 0) /* match a prefix */58return _Vcwmethods[i];59}6061return NIL(Vcwmethod_t*);62}6364#if __STD_C65int vcwwalkmeth(Vcwalk_f walkf, Void_t* disc)66#else67int vcwwalkmeth(Vcwalk_f walkf, Void_t* disc)68Vcwalk_t walkf;69Void_t* disc;70#endif71{72int i, rv;7374if(!walkf)75return -1;7677for (i = 0; _Vcwmethods[i]; ++i)78{ rv = (*walkf)((Void_t*)_Vcwmethods[i],79_Vcwmethods[i]->name, _Vcwmethods[i]->desc, disc);80if(rv < 0)81return rv;82}8384return 0;85}868788