/* _______________________________________________________________________ * * RDPARM/PTRAJ: APR 2000 * _______________________________________________________________________ * * $Header: /thr/gamow/cvsroot/amber7/src/ptraj/interface.c,v 1.5 2000/05/10 21:53:19 cheatham Exp $ * * Revision: $Revision: 1.5 $ * Date: $Date: 2000/05/10 21:53:19 $ * Last checked in by $Author: cheatham $ * * This source is now archived under CVS at Scripps in the amber7 tree. * * NOTE: this is a beta, pre-release version, is under constant development, * probably contains some bugs and is under constant revision; therefore * take care. Please report bugs (and fixes!) to cheatham@chpc.utah.edu or * cheatham@cgl.ucsf.edu * * Do not distribute this code without explicit permission. * Do not incorporate into other codes without explicit permission. * * Current contact information: * * Thomas Cheatham, III * 2000 East, 30 South, Skaggs Hall 201 * Department of Medicinal Chemistry * University of Utah * Salt Lake City, UT 84112-5820 * cheatham@chpc.utah.edu * (801) 587-9653 * FAX: (801) 585-5366 * * Other contributors: * * David Case (Scripps) * Michael Crowley (Scripps) * Jed Pitera (UCSF) * Vickie Tsui (Scripps) * * _______________________________________________________________________ * * interface.c * * This is the basic user interface for rdparm and ptraj; the major functionality * is implemented in the file dispatch.h * * Currently only two user interface modes are supported, that for "rdparm" and that * for "ptraj". The "ptraj" input file processing is performed by ptraj() in ptraj.c * and that for "rdparm" is performed here. The "rdparm" interface is slightly more * interactive in that the user is prompted, text is processed and a command immediately * performed. The "ptraj" interface works more in the mode of processing an input * file until a particular command is reached (or EOF) and then a whole series of * commands is performed. In both cases, conversion of text typed by the user to * commands run by this program is performed by the dispatchToken() routine defined * in dispatch.c. */ #include #include #include "ptraj.h" char *rdparm_header = "\n RDPARM MENU. Please enter commands. Use \"?\" or \"help\"\n for more info. \"exit\" or \"quit\" to leave program...\n\n"; char *rdparm_prompt = "\nRDPARM MENU: "; void interface(interfaceMode mode, char *filename) { stackType *argumentStack; char buffer[BUFFER_SIZE]; Token *tokenlist; argumentStack = NULL; switch(mode) { case INTERFACE_PTRAJ: /* * ptraj input file processing is performed in ptraj(), ptraj.c */ tokenlist = (Token *) &ptrajTokenlist; ptraj(filename); break; case INTERFACE_RDPARM: tokenlist = (Token *) &rdparmTokenlist; fprintf(stdout, rdparm_header); fprintf(stdout, rdparm_prompt); while (1) { fflush(stdout); if ( fgets(buffer, BUFFER_SIZE, stdin) == NULL ) { warning("interface()", "NULL input\n"); } else { dispatchToken( tokenlist, argumentStack, (char *) buffer); } fprintf(stdout, rdparm_prompt); } } }