00001 /* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */ 00002 // 00003 00004 /* 00005 * ns-process.cc 00006 * Copyright (C) 1997 by the University of Southern California 00007 * $Id: ns-process.cc,v 1.5 2005/08/25 18:58:02 johnh Exp $ 00008 * 00009 * This program is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU General Public License, 00011 * version 2, as published by the Free Software Foundation. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License along 00019 * with this program; if not, write to the Free Software Foundation, Inc., 00020 * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 00021 * 00022 * 00023 * The copyright of this module includes the following 00024 * linking-with-specific-other-licenses addition: 00025 * 00026 * In addition, as a special exception, the copyright holders of 00027 * this module give you permission to combine (via static or 00028 * dynamic linking) this module with free software programs or 00029 * libraries that are released under the GNU LGPL and with code 00030 * included in the standard release of ns-2 under the Apache 2.0 00031 * license or under otherwise-compatible licenses with advertising 00032 * requirements (or modified versions of such code, with unchanged 00033 * license). You may copy and distribute such a system following the 00034 * terms of the GNU GPL for this module and the licenses of the 00035 * other code concerned, provided that you include the source code of 00036 * that other code when and as the GNU GPL requires distribution of 00037 * source code. 00038 * 00039 * Note that people who make modified versions of this module 00040 * are not obligated to grant this special exception for their 00041 * modified versions; it is their choice whether to do so. The GNU 00042 * General Public License gives permission to release a modified 00043 * version without this exception; this exception also makes it 00044 * possible to release a modified version which carries forward this 00045 * exception. 00046 * 00047 */ 00048 // 00049 // Other copyrights might apply to parts of this software and are so 00050 // noted when applicable. 00051 // 00052 // ADU and ADU processor 00053 // 00054 // $Header: /nfs/jade/vint/CVSROOT/ns-2/common/ns-process.cc,v 1.5 2005/08/25 18:58:02 johnh Exp $ 00055 00056 #include "ns-process.h" 00057 00058 static class ProcessClass : public TclClass { 00059 public: 00060 ProcessClass() : TclClass("Process") {} 00061 TclObject* create(int, const char*const*) { 00062 return (new Process); 00063 } 00064 } class_process; 00065 00066 void Process::process_data(int, AppData*) 00067 { 00068 abort(); 00069 } 00070 00071 AppData* Process::get_data(int&, AppData*) 00072 { 00073 abort(); 00074 /* NOTREACHED */ 00075 return NULL; // Make msvc happy 00076 } 00077 00078 int Process::command(int argc, const char*const* argv) 00079 { 00080 Tcl& tcl = Tcl::instance(); 00081 if (strcmp(argv[1], "target") == 0) { 00082 if (argc == 2) { 00083 Process *p = target(); 00084 tcl.resultf("%s", p ? p->name() : ""); 00085 return TCL_OK; 00086 } else if (argc == 3) { 00087 Process *p = (Process *)TclObject::lookup(argv[2]); 00088 if (p == NULL) { 00089 fprintf(stderr, "Non-existent media app %s\n", 00090 argv[2]); 00091 abort(); 00092 } 00093 target() = p; 00094 return TCL_OK; 00095 } 00096 } 00097 return TclObject::command(argc, argv); 00098 }
1.4.6