add a "deprecated" command style for flagging future removed commands
This commit is contained in:
48
src/deprecated.cpp
Normal file
48
src/deprecated.cpp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
Contributing authors: Axel Kohlmeyer (Temple U),
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
#include "deprecated.h"
|
||||||
|
#include "comm.h"
|
||||||
|
#include "force.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "input.h"
|
||||||
|
|
||||||
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
static void writemsg(LAMMPS *lmp, const char *msg, int abend=1)
|
||||||
|
{
|
||||||
|
if (lmp->comm->me == 0) {
|
||||||
|
if (lmp->screen) fputs(msg,lmp->screen);
|
||||||
|
if (lmp->logfile) fputs(msg,lmp->logfile);
|
||||||
|
}
|
||||||
|
if (abend)
|
||||||
|
lmp->error->all(FLERR,"This command is no longer available");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void Deprecated::command(int narg, char **arg)
|
||||||
|
{
|
||||||
|
if (strcmp(input->command,"deprecated") == 0) {
|
||||||
|
writemsg(lmp,"\nCommand 'deprecated' is a dummy command\n\n",0);
|
||||||
|
|
||||||
|
} else if (strcmp(input->command,"XXX") == 0) {
|
||||||
|
writemsg(lmp, "\nCommand 'XXX' has been removed from LAMMPS "
|
||||||
|
"after the\n## XXX 20## stable release.\n\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
70
src/deprecated.h
Normal file
70
src/deprecated.h
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
/* -*- c++ -*- ----------------------------------------------------------
|
||||||
|
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||||
|
http://lammps.sandia.gov, Sandia National Laboratories
|
||||||
|
Steve Plimpton, sjplimp@sandia.gov
|
||||||
|
|
||||||
|
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||||
|
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||||
|
certain rights in this software. This software is distributed under
|
||||||
|
the GNU General Public License.
|
||||||
|
|
||||||
|
See the README file in the top-level LAMMPS directory.
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifdef COMMAND_CLASS
|
||||||
|
|
||||||
|
CommandStyle(deprecated,Deprecated)
|
||||||
|
CommandStyle(XXX,Deprecated)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#ifndef LMP_DEPRECATED_H
|
||||||
|
#define LMP_DEPRECATED_H
|
||||||
|
|
||||||
|
#include "pointers.h"
|
||||||
|
|
||||||
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
|
class Deprecated : protected Pointers {
|
||||||
|
public:
|
||||||
|
Deprecated(class LAMMPS *lmp) : Pointers(lmp) {};
|
||||||
|
void command(int, char **);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ERROR/WARNING messages:
|
||||||
|
|
||||||
|
W: Ignoring unknown or incorrect info command flag
|
||||||
|
|
||||||
|
Self-explanatory. An unknown argument was given to the info command.
|
||||||
|
Compare your input with the documentation.
|
||||||
|
|
||||||
|
E: Unknown name for info package category
|
||||||
|
|
||||||
|
Self-explanatory.
|
||||||
|
|
||||||
|
E: Unknown name for info newton category
|
||||||
|
|
||||||
|
Self-explanatory.
|
||||||
|
|
||||||
|
E: Unknown name for info pair category
|
||||||
|
|
||||||
|
Self-explanatory.
|
||||||
|
|
||||||
|
E: Unknown category for info is_active()
|
||||||
|
|
||||||
|
Self-explanatory.
|
||||||
|
|
||||||
|
E: Unknown category for info is_available()
|
||||||
|
|
||||||
|
Self-explanatory.
|
||||||
|
|
||||||
|
E: Unknown category for info is_defined()
|
||||||
|
|
||||||
|
Self-explanatory.
|
||||||
|
|
||||||
|
*/
|
||||||
@ -24,6 +24,8 @@ namespace LAMMPS_NS {
|
|||||||
class Input : protected Pointers {
|
class Input : protected Pointers {
|
||||||
friend class Info;
|
friend class Info;
|
||||||
friend class Error;
|
friend class Error;
|
||||||
|
friend class Deprecated;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int narg; // # of command args
|
int narg; // # of command args
|
||||||
char **arg; // parsed args for command
|
char **arg; // parsed args for command
|
||||||
@ -38,9 +40,11 @@ class Input : protected Pointers {
|
|||||||
// substitute for variables in a string
|
// substitute for variables in a string
|
||||||
int expand_args(int, char **, int, char **&); // expand args due to wildcard
|
int expand_args(int, char **, int, char **&); // expand args due to wildcard
|
||||||
|
|
||||||
|
protected:
|
||||||
|
char *command; // ptr to current command
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int me; // proc ID
|
int me; // proc ID
|
||||||
char *command; // ptr to current command
|
|
||||||
int maxarg; // max # of args in arg
|
int maxarg; // max # of args in arg
|
||||||
char *line,*copy,*work; // input line & copy and work string
|
char *line,*copy,*work; // input line & copy and work string
|
||||||
int maxline,maxcopy,maxwork; // max lengths of char strings
|
int maxline,maxcopy,maxwork; // max lengths of char strings
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
Contributing author: Axel Kohlmeyer (Temple U)
|
Contributing author: Axel Kohlmeyer (Temple U)
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
#include "pair_deprecated.h"
|
#include "pair_deprecated.h"
|
||||||
#include "pair_hybrid.h"
|
#include "pair_hybrid.h"
|
||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user