-
Notifications
You must be signed in to change notification settings - Fork 5
/
special.cpp
93 lines (62 loc) · 2.23 KB
/
special.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
This is special.cpp
Coxeter version 3.0_demo Copyright (C) 2001 Fokko du Cloux
See file main.cpp for full copyright notice
*/
#include "special.h"
#include "directories.h"
#include "interactive.h"
/******** local definitions **************************************************/
namespace {
using namespace special;
void special_f();
void special_h();
const char* special_tag = "user-defined command";
};
/************************************************************************
Chapter I -- Functions for the special commands.
This section defines the functions provided by special.c
************************************************************************/
void special::addSpecialCommands(commands::CommandTree* tree)
/*
This function should be edited if you want to add new commands to the
system, instead of just editing the "special" command. Adding a command
is easy : you should choose a name for it (an arbitrary string; if it
already exists it will replace the existing command), a "tag" (used
for help purposes; special_tag will do), a function which should take
no arguments and return void, which will be executed by the command,
and a help function (the empty function will do; this is already
provided as relax_f, provided by commands.h).
The commands are added to the main command tree of the program (the
tree argument is used for convienience, since this function is called
when mainCommandTree() is not yet functional); it would also be possible
to add special command trees, but we have decided to leave this to users
willing to delve into commands.c.
*/
{
using namespace commands;
/* prototype line for adding a special command */
/* the last argument is optional; it defaults to default_help, declared
in commands.h */
tree->add("special",special_tag,&special_f,&special_h);
/* add user-defined commands here ... */
return;
}
namespace {
void special_f()
/*
Comment out the default code below and replace by your own code.
*/
{
fprintf(stderr,"not implemented\n");
return;
}
void special_h()
/*
Comment out the default code below and replace by your own code.
*/
{
io::printFile(stderr,"special.defhelp",directories::MESSAGE_DIR);
return;
}
};