Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

colvarscript_commands_colvar.C

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 
00003 // This file is part of the Collective Variables module (Colvars).
00004 // The original version of Colvars and its updates are located at:
00005 // https://github.com/Colvars/colvars
00006 // Please update all Colvars source files before making any changes.
00007 // If you wish to distribute your changes, please submit them to the
00008 // Colvars repository at GitHub.
00009 
00010 
00011 #include <vector>
00012 #include <cstdlib>
00013 #include <stdlib.h>
00014 #include <string.h>
00015 
00016 #include "colvarproxy.h"
00017 #include "colvardeps.h"
00018 #include "colvarscript.h"
00019 #include "colvarscript_commands.h"
00020 
00021 
00022 
00023 // Instantiate the body of all colvar-specific script commands
00024 
00025 #define CVSCRIPT_COMM_FN(COMM,N_ARGS_MIN,N_ARGS_MAX,ARGS,FN_BODY)       \
00026   int CVSCRIPT_COMM_FNAME(COMM)(void *pobj,                             \
00027                                 int objc, unsigned char *const objv[])  \
00028   {                                                                     \
00029     if (cvm::debug()) {                                                 \
00030       cvm::log("Executing script function \""+std::string(#COMM)+"\""); \
00031     }                                                                   \
00032     colvarscript *script = colvarscript_obj();                          \
00033     script->clear_str_result();                                         \
00034     if (script->check_colvar_cmd_nargs(#COMM,                           \
00035                                        objc, N_ARGS_MIN, N_ARGS_MAX) != \
00036         COLVARSCRIPT_OK) {                                              \
00037       return COLVARSCRIPT_ERROR;                                        \
00038     }                                                                   \
00039     if (objc > 1) {                                                     \
00040       /* Silence unused parameter warning */                            \
00041       (void) objv[0];                                                    \
00042     }                                                                   \
00043     colvar *this_colvar = colvar_obj(pobj);                             \
00044     FN_BODY;                                                            \
00045   }
00046 #undef CVSCRIPT
00047 #define CVSCRIPT(COMM,HELP,N_ARGS_MIN,N_ARGS_MAX,ARGS,FN_BODY)  \
00048   CVSCRIPT_COMM_FN(COMM,N_ARGS_MIN,N_ARGS_MAX,ARGS,FN_BODY)
00049 
00050 #include "colvarscript_commands_colvar.h"
00051 
00052 #undef CVSCRIPT_COMM_FN
00053 #undef CVSCRIPT

Generated on Wed Apr 17 02:45:23 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002