00001 /** @file tcl/namesp.h Thin wrapper around Tcl_Namespace */ 00002 00003 /////////////////////////////////////////////////////////////////////// 00004 // 00005 // Copyright (c) 2006-2007 University of Southern California 00006 // Rob Peters <rjpeters at usc dot edu> 00007 // 00008 // created: Fri Feb 17 16:58:18 2006 00009 // commit: $Id: namesp.h 11876 2009-10-22 15:53:06Z icore $ 00010 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/tcl/namesp.h $ 00011 // 00012 // -------------------------------------------------------------------- 00013 // 00014 // This file is part of GroovX 00015 // [http://www.klab.caltech.edu/rjpeters/groovx/] 00016 // 00017 // GroovX is free software; you can redistribute it and/or modify it 00018 // under the terms of the GNU General Public License as published by 00019 // the Free Software Foundation; either version 2 of the License, or 00020 // (at your option) any later version. 00021 // 00022 // GroovX is distributed in the hope that it will be useful, but 00023 // WITHOUT ANY WARRANTY; without even the implied warranty of 00024 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00025 // General Public License for more details. 00026 // 00027 // You should have received a copy of the GNU General Public License 00028 // along with GroovX; if not, write to the Free Software Foundation, 00029 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 00030 // 00031 /////////////////////////////////////////////////////////////////////// 00032 00033 #ifndef GROOVX_TCL_NAMESP_H_UTC20060218005818_DEFINED 00034 #define GROOVX_TCL_NAMESP_H_UTC20060218005818_DEFINED 00035 00036 #include "rutz/fstring.h" 00037 00038 #ifdef HAVE_TCLINT_H 00039 #include <tclInt.h> 00040 #endif 00041 00042 namespace tcl 00043 { 00044 class interpreter; 00045 class list; 00046 00047 #ifdef HAVE_TCLINT_H 00048 class native_namesp 00049 { 00050 public: 00051 native_namesp(tcl::interpreter& interp, const char* name); 00052 00053 static native_namesp lookup(tcl::interpreter& interp, 00054 const char* name); 00055 00056 void export_cmd(tcl::interpreter& interp, 00057 const char* cmdname) const; 00058 00059 tcl::list get_export_list(tcl::interpreter& interp) const; 00060 00061 private: 00062 native_namesp(Tcl_Namespace* ns); 00063 00064 Tcl_Namespace* m_ns; 00065 }; 00066 #endif 00067 00068 class emu_namesp 00069 { 00070 public: 00071 emu_namesp(tcl::interpreter& interp, const char* name); 00072 00073 static emu_namesp lookup(tcl::interpreter& interp, 00074 const char* name); 00075 00076 void export_cmd(tcl::interpreter& interp, 00077 const char* cmdname) const; 00078 00079 tcl::list get_export_list(tcl::interpreter& interp) const; 00080 00081 private: 00082 const rutz::fstring m_ns_name; 00083 }; 00084 00085 #ifdef HAVE_TCLINT_H 00086 typedef native_namesp namesp; 00087 #else 00088 typedef emu_namesp namesp; 00089 #endif 00090 } 00091 00092 00093 static const char __attribute__((used)) vcid_groovx_tcl_namesp_h_utc20060218005818[] = "$Id: namesp.h 11876 2009-10-22 15:53:06Z icore $ $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/tcl/namesp.h $"; 00094 #endif // !GROOVX_TCL_NAMESP_H_UTC20060218005818DEFINED