langtrace.c

Go to the documentation of this file.
00001 
00002 /*  $Id: langtrace.c 1204 2006-04-05 23:07:18Z karstenw $    */
00003 
00004 /******************************************************************************
00005 
00006     UserLand Frontier(tm) -- High performance Web content management,
00007     object database, system-level and Internet scripting environment,
00008     including source code editing and debugging.
00009 
00010     Copyright (C) 1992-2004 UserLand Software, Inc.
00011 
00012     This program is free software; you can redistribute it and/or modify
00013     it under the terms of the GNU General Public License as published by
00014     the Free Software Foundation; either version 2 of the License, or
00015     (at your option) any later version.
00016 
00017     This program is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020     GNU General Public License for more details.
00021 
00022     You should have received a copy of the GNU General Public License
00023     along with this program; if not, write to the Free Software
00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 
00026 ******************************************************************************/
00027 
00028 #include "frontier.h"
00029 #include "standard.h"
00030 
00031 #include "kb.h"
00032 #include "mouse.h"
00033 #include "strings.h"
00034 #include "shell.h"
00035 #include "langinternal.h"
00036 
00037 
00038 
00039 
00040 /*
00041 static boolean fllangtrace = false; 
00042 */
00043 
00044 
00045 #ifdef fldebug
00046     #define fllangtrace 0
00047 #else
00048     #define fllangtrace 0
00049 #endif
00050 
00051 extern bigstring bstoken; /*text of last token, see langscan.c*/
00052 
00053 /*
00054 #if fllangtrace
00055     #ifdef MACVERSION
00056         #define messageset(bs) shellfrontwindowmessage (bs)
00057     #endif
00058 
00059     #ifdef WIN95VERSION
00060         static FILE * tracefile = NULL;
00061         #define messageset(bs)  \
00062                 do {if (tracefile == NULL) \
00063                     tracefile = fopen ("langtrace.txt", "w+"); \
00064                     fprintf (tracefile, "%s\n", bs);} while (0)
00065     #endif
00066 #endif
00067 */
00068 
00069 
00070 #if fllangtrace
00071     
00072 
00073     #define STR_lineterminator "\r\n"
00074 
00075 
00076     static FILE * tracefile = NULL;
00077 
00078 
00079     void langstarttrace (void) {
00080 
00081         if (tracefile == NULL)
00082             tracefile = fopen ("frontier_langtrace.txt", "a+"); /* append */
00083 
00084         fprintf (tracefile, STR_lineterminator);
00085         } /*langstarttrace*/
00086         
00087         
00088     void langendtrace (void) {
00089 
00090         if (tracefile)
00091             fclose (tracefile);
00092         
00093         tracefile = NULL;
00094         } /*langendtrace*/
00095 
00096 
00097     void langtrace (bigstring bs) {
00098         
00099         nullterminate (bstoken);
00100 
00101         nullterminate (bs);
00102 
00103         fprintf (tracefile, ("'%s' ==> %s" STR_lineterminator), &bstoken[1], &bs[1]);
00104         
00105         if (shiftkeydown ())
00106             waitmouseclick ();
00107         } /*langtrace*/
00108 
00109 
00110 #else
00111 
00112 
00113     void langstarttrace (void) { }
00114 
00115     void langendtrace (void) { }
00116 
00117     void langtrace (bigstring bs) {
00118 #pragma unused (bs)
00119 }
00120 
00121 #endif
00122 
00123 /*
00124 void langsyntaxtrace (boolean fl) {
00125     
00126     #ifdef fldebug
00127     
00128     fllangtrace = fl; /%set global that turns the syntax trace on or off%/
00129     
00130     if (fl) 
00131         langstarttrace ();
00132     
00133     #endif
00134     } /%langsyntaxtrace%/
00135 */  
00136 

Generated on Wed May 31 18:19:53 2006 for frontierkernel 10.1.10a by  doxygen 1.4.6