langerror.c

Go to the documentation of this file.
00001 
00002 /*  $Id: langerror.c 355 2005-01-11 22:48:55Z andreradke $    */
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 "ops.h"
00032 #include "resources.h"
00033 #include "strings.h"
00034 #include "langinternal.h"
00035 
00036 
00037 
00038 boolean fllangerror = false;  /*if true, the langerror dialog has already appeared*/
00039 
00040 unsigned short langerrordisable = 0; /*it's possible to temporarily disable lang errors*/
00041 
00042 
00043 
00044 
00045 void disablelangerror (void) {
00046     
00047     ++langerrordisable;
00048     } /*disablelangerror*/
00049 
00050 
00051 void enablelangerror (void) {
00052     
00053     --langerrordisable;
00054     } /*enablelangerror*/
00055 
00056 
00057 boolean langerrorenabled (void) {
00058     
00059     return (langerrordisable == 0);
00060     } /*langerrorenabled*/
00061 
00062 
00063 /*
00064 static boolean fllocalerrorhook = false;
00065 
00066 langerrordispatch (bigstring bs) { /%finish this someday%/
00067     
00068     hdltreenode hcode;
00069     
00070     if (!fllocalerrorhook && langgetlocalhandlercode ((ptrstring) "\perror", &hcode)) {
00071         
00072         fllocalerrorhook = true;
00073         
00074         fllocalerrorhook = false;
00075         
00076         return;
00077         }
00078     
00079     langerrormessage (bs);
00080     } /%langerrordispatch%/
00081 */
00082 
00083 void langerror (short stringnum) {
00084     
00085     bigstring bs;
00086     
00087     getstringlist (langerrorlist, stringnum, bs);
00088     
00089     langerrormessage (bs);
00090     } /*langerror*/
00091 
00092 
00093 void lang3paramerror (short stringnum, const bigstring bs1, const bigstring bs2, const bigstring bs3) {
00094     
00095     bigstring bs;
00096     
00097     getstringlist (langerrorlist, stringnum, bs);
00098     
00099     parsedialogstring (bs, (ptrstring) bs1, (ptrstring) bs2, (ptrstring) bs3, nil, bs);
00100     
00101     langerrormessage (bs);
00102     } /*lang3paramerror*/
00103 
00104 
00105 void langparamerror (short stringnum, const bigstring bsparam) {
00106     
00107     lang3paramerror (stringnum, bsparam, nil, nil);
00108     } /*langparamerror*/
00109 
00110 
00111 void lang2paramerror (short stringnum, const bigstring bs1, const bigstring bs2) {
00112     
00113     lang3paramerror (stringnum, bs1, bs2, nil);
00114     } /*lang2paramerror*/
00115 
00116 
00117 void langlongparamerror (short stringnum, long x) {
00118     
00119     byte bslong [64];
00120     
00121     numbertostring (x, bslong);
00122     
00123     lang3paramerror (stringnum, bslong, nil, nil);
00124     } /*langlongparamerror*/
00125 
00126 
00127 void langostypeparamerror (short stringnum, OSType x) {
00128     
00129     byte bsid [6];
00130     
00131     ostypetostring (x, bsid);
00132     
00133     lang3paramerror (stringnum, bsid, nil, nil);
00134     } /*langostypeparamerror*/
00135 
00136 
00137 void parseerror (bigstring bs) {
00138 
00139     bigstring bscopy; /*must work on a copy!*/
00140     
00141     copystring (bs, bscopy); 
00142     
00143     convertcstring (bscopy); /*convert a c string to pascal format*/
00144     
00145     langparamerror (parsererror, bscopy);
00146     } /*parseerror*/
00147 
00148 
00149 

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