File move
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4150 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
d199dde9e2
commit
74a3aa015c
25 changed files with 19427 additions and 0 deletions
57
Source/Modules/module.cxx
Normal file
57
Source/Modules/module.cxx
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* module.cxx
|
||||
*
|
||||
* This file is responsible for the module system.
|
||||
*
|
||||
* Author(s) : David Beazley (beazley@cs.uchicago.edu)
|
||||
*
|
||||
* Copyright (C) 1999-2000. The University of Chicago
|
||||
* See the file LICENSE for information on usage and redistribution.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
char cvsroot_module_cxx[] = "$Header$";
|
||||
|
||||
#include "swigmod.h"
|
||||
|
||||
struct Module {
|
||||
ModuleFactory fac;
|
||||
char *name;
|
||||
Module *next;
|
||||
Module(const char *n, ModuleFactory f) {
|
||||
fac = f;
|
||||
name = new char[strlen(n)+1];
|
||||
strcpy(name, n);
|
||||
next = 0;
|
||||
}
|
||||
};
|
||||
|
||||
static Module *modules = 0;
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* void Swig_register_module()
|
||||
*
|
||||
* Register a module.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void Swig_register_module(const char *n, ModuleFactory f) {
|
||||
Module *m = new Module(n,f);
|
||||
m->next = modules;
|
||||
modules = m;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Language *Swig_find_module()
|
||||
*
|
||||
* Given a command line option, locates the factory function.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
ModuleFactory Swig_find_module(const char *name) {
|
||||
Module *m = modules;
|
||||
while (m) {
|
||||
if (strcmp(m->name,name) == 0) {
|
||||
return m->fac;
|
||||
}
|
||||
m = m->next;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue