00001 /*************************************************************************** 00002 *cr 00003 *cr (C) Copyright 1995-2019 The Board of Trustees of the 00004 *cr University of Illinois 00005 *cr All Rights Reserved 00006 *cr 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * RCS INFORMATION: 00011 * 00012 * $RCSfile: vmdconsole.h,v $ 00013 * $Author: johns $ $Locker: $ $State: Exp $ 00014 * $Revision: 1.10 $ $Date: 2019/01/17 21:21:03 $ 00015 * 00016 *************************************************************************** 00017 * DESCRIPTION: 00018 * 00019 * vmd console redirector 00020 * (c) 2006-2009 Axel Kohlmeyer <akohlmey@cmm.chem.upenn.edu> 00021 * 00022 ***************************************************************************/ 00023 00024 /* common definitions for the vmdconsole plugin */ 00025 #ifndef _VMDCONSOLE_H 00026 #define _VMDCONSOLE_H 00027 00028 #ifdef __cplusplus 00029 extern "C" { 00030 #endif 00031 00032 /* list of vmd status types */ 00033 #define VMDCON_UNDEF -1 00034 #define VMDCON_NONE 0 00035 #define VMDCON_WIDGET 1 00036 #define VMDCON_TEXT 2 00037 00038 /* list of vmd console 'urgencies' */ 00039 #define VMDCON_ALL 0 00040 #define VMDCON_INFO 1 00041 #define VMDCON_WARN 2 00042 #define VMDCON_ERROR 3 00043 #define VMDCON_ALWAYS 4 00044 #define VMDCON_LOG 5 00046 /* initialize vmd console */ 00047 extern void vmdcon_init(void); 00048 00049 /* report current vmdcon status */ 00050 extern int vmdcon_get_status(void); 00051 00052 /* set current vmdcon status */ 00053 extern void vmdcon_set_status(int, void *interp); 00054 00055 /* set current vmdcon log level */ 00056 void vmdcon_set_loglvl(int lvl); 00057 00058 /* set current vmdcon log level */ 00059 int vmdcon_get_loglvl(void); 00060 00061 /* turn on text mode processing */ 00062 extern void vmdcon_use_text(void *interp); 00063 00064 /* turn on tk text widget mode processing */ 00065 extern void vmdcon_use_widget(void *interp); 00066 00067 /* (de-)register a widget to be the console window */ 00068 extern int vmdcon_register(const char *w_path, const char *mark, void *interp); 00069 00070 /* append a string of up to 'length' characters to console message queue 00071 * at log level 'level'. 00072 * 'length' can be -1 to autodetect length with \0 terminated strings. 00073 * a 'length' of 0 means, do not add to message queue. */ 00074 extern int vmdcon_append(int level, const char *text, int length); 00075 00076 /* purge message queue into registered text widget. */ 00077 extern int vmdcon_purge(void); 00078 00079 /* insert log message buffer into console destination. */ 00080 extern int vmdcon_showlog(void); 00081 00082 /* print to the current vmd console, printf style.*/ 00083 extern int vmdcon_printf(const int lvl, const char *format, ...); 00084 00085 /* print to the current vmd console, fputs style.*/ 00086 extern int vmdcon_fputs(const int lvl, const char *text); 00087 00088 /* insert text into an existing text widget. 00089 * returns NULL on success, or an error message on failure. */ 00090 extern const char *tcl_vmdcon_insert(void *interp, const char *w_path, 00091 const char *mark, const char *text); 00092 00093 /* synchronize tcl variable for vmdcon status */ 00094 extern void tcl_vmdcon_set_status_var(void *interp, int status); 00095 00096 #ifdef __cplusplus 00097 } 00098 #endif 00099 00100 #endif