#include "hush.h"
// Include definitions of external package(s)
#include "extern/ht.h"
// Define the application class
class application : public session {
public:
application(int argc, char* argv[]) : session(argc,argv) {
hyper = 0;
if ((argc==3) && !strcmp(argv[1],"-x")) { // check for -x
hyper = 1;
strcpy(hyperfile,argv[2]);
}
}
void main() { // tk represents the kit
init_ht(tk); // initialize package(s)
if (hyper) { // initialize hypertext
hypertext* h = new hypertext(".help");
h->file(hyperfile);
h->geometry(330,250);
h->pack();
tk->pack(".quit"); // predefined button to quit
}
}
private:
char hyperfile[BUFSIZ];
int hyper;
};
// Define the main function
int main (int argc, char* argv[]) {
session* s = new application(argc,argv);
s->run(); // start X event loop
}
slide: A simple interpreter