/************************************************************************* * * HTCd - Copyright (C) 1998-2006 Henrik Rydberg * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include TOK_IMPL(help) { out<<"HTC/1.2 - HyperText Compiler (H. Rydberg (C) 1998,1999,2000,2001)\n"; out<<"\n"; out<<"Try these commands:\n"; out<<"\\help - This message\n"; out<<"\\ops - List all operators\n"; out<<"\\ops{op} - Get info on operator\n"; out<<"\\tok - List all tokens\n"; out<<"\\tok{tok} - Get info on token\n"; out<<"\\src{tok} - View token source\n"; } TOK_IMPL(ops) { mstring cmd; env.parg(cmd,-1); if(cmd.nempty()) { out<get(cmd); if(p) { if(p->pre1) out<<"Unary operator, precedence "<pre1<<"\n"; if(p->pre2) out<<"Binary operator, precedence "<pre2<<"\n"; out<<"\n"; out<desc; } else { out<<"(not found)\n"; } } else { mstring line; line.convert("%-3s %-3s %s\n","P1","P2","NAME"); out<begin();p!=env.ops->end();p++) { line.convert("%-3d %-3d %s\n",(*p)->pre1,(*p)->pre2,(*p)->name.c_str()); out<get(cmd); if(p) { out<<"Mode: "<mod&tok_t::RESTRICT) out<<"public "; else if(p->mod&tok_t::NORMAL) out<<"normal "; else if(p->mod&tok_t::SYSONLY) out<<"system "; else if(p->mod&tok_t::INIT) out<<"init "; if(p->is_runnable()) { if(p->is_binary()) out<<"built-in "; out<<"function\n"; } else { if(p->is_const()) out<<"constant"; else out<<"variable"; if(p->is_reference()) out<<" reference"; if(p->is_dbref()) out<<" database reference"; out<<"\n"; } out<<"Usage: "; if(p->is_runnable()) out<<*(func_t*)p; else out<<"\\"<name; out<<"\n"; if(p->is_runnable()) { mstring desc=Desc(*p); if(desc.nempty()) { out<<"\n"; out<up) { line.convert("%-12s %s %d\n","MODE","NAME LEVEL",n); out<begin();p!=tok->end();p++) { line.convert("%s %s\n",Mode(*(*p)).c_str(),(*p)->name.c_str()); out<get(env[0]); if(!p) out<is_runnable()) { const func_t* ftok=(func_t*)p; out<<"{"<name<<"}{"<arg<<"}"; if(p->is_binary()) out<<" (built-in function)\n"; else out<<"{"<x.expr<<"}\n"; } else out<\n" ); TOK_ADD(tok,"?",tok_t::PRIVATE, "%Help on tokens\n" "%Syntax: \\tok\n" ); TOK_ADD(src,"x",tok_t::SYSONLY, "%Source of token\n" "%Syntax: \\src{tokname}\n" ); }