ESPResSo 3.2.0-11-g9950804-git
Extensible Simulation Package for Soft Matter Research
config_tcl.c
Go to the documentation of this file.
00001 /*
00002   Copyright (C) 2010,2011,2012,2013 The ESPResSo project
00003   Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 
00004     Max-Planck-Institute for Polymer Research, Theory Group
00005   
00006   This file is part of ESPResSo.
00007   
00008   ESPResSo is free software: you can redistribute it and/or modify
00009   it under the terms of the GNU General Public License as published by
00010   the Free Software Foundation, either version 3 of the License, or
00011   (at your option) any later version.
00012   
00013   ESPResSo 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
00019   along with this program.  If not, see <http://www.gnu.org/licenses/>. 
00020 */
00021 /** \file config_tcl.c
00022  *
00023  *  contains code_info and version stuff.
00024 */
00025 #include "utils.h"
00026 #include <tcl.h>
00027 
00028 static int tclcommand_code_info_version(Tcl_Interp *interp)
00029 {
00030   Tcl_AppendResult(interp, PACKAGE_NAME, "-", ESPRESSO_VERSION, (char *) NULL);
00031   return (TCL_OK);
00032 }
00033 
00034 /** callback for compilation status. */
00035 static int tclcommand_code_info_compilation(Tcl_Interp *interp)
00036 {
00037   Tcl_AppendResult(interp, "{ Compilation status ", (char *) NULL);
00038   for (int i=0; i < NUM_FEATURES; i++) {
00039     Tcl_AppendResult(interp, "{ ", (char *) NULL);
00040     Tcl_AppendResult(interp, FEATURES[i], (char *) NULL);
00041     Tcl_AppendResult(interp, " } ", (char *) NULL);
00042   }
00043   Tcl_AppendResult(interp, "}", (char *) NULL);
00044   return (TCL_OK);
00045 }
00046 
00047 int tclcommand_code_info(ClientData data, Tcl_Interp *interp,
00048          int argc, char **argv)
00049 {
00050   if (argc < 2) {
00051     tclcommand_code_info_version(interp);
00052     Tcl_AppendResult(interp, "\n", (char *) NULL);
00053     tclcommand_code_info_compilation(interp);
00054   }
00055   else {
00056     if(!strncmp(argv[1], "version" , strlen(argv[1]))) {
00057       tclcommand_code_info_version(interp);
00058     }
00059     else if(!strncmp(argv[1], "compilation" , strlen(argv[1]))) {
00060       tclcommand_code_info_compilation(interp);
00061     }
00062     else if(!strncmp(argv[1], "debug" , strlen(argv[1]))) {
00063       tclcommand_code_info_compilation(interp);
00064     }
00065     else {
00066       Tcl_AppendResult(interp, "info ",argv[1]," not known!", (char *) NULL);
00067     }
00068   }
00069   return (TCL_OK);
00070 }