shellblocker.c

Go to the documentation of this file.
00001 
00002 /*  $Id: shellblocker.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 "shell.h"
00032 #include "shellprivate.h"
00033 
00034 
00035 
00036 
00037 #define ctblocks 5 /*we can remember blocked events up to 5 levels deep*/
00038 
00039 static short topblocks = 0;
00040 
00041 static short blockstack [ctblocks];
00042 
00043 static short blockedevents = 0;
00044 
00045 
00046 
00047 short shellblockedevents (void) {
00048     
00049     return (blockedevents);
00050     } /*shellblockedevents*/
00051 
00052 
00053 boolean shellblocked (short mask) {
00054     
00055     return ((blockedevents & mask) != 0);
00056     } /*shellblocked*/
00057 
00058 
00059 boolean shellpushblock (short mask, boolean flblock) {
00060     
00061     if (topblocks >= ctblocks)
00062         return (false);
00063     
00064     blockstack [topblocks++] = blockedevents;
00065     
00066     if (flblock)
00067         blockedevents |= mask;
00068     else
00069         blockedevents &= ~mask;
00070     
00071     return (true);
00072     } /*shellpushblock*/
00073 
00074 
00075 boolean shellpopblock (void) {
00076     
00077     if (topblocks <= 0)
00078         return (false);
00079     
00080     blockedevents = blockstack [--topblocks];
00081     
00082     return (true);
00083     } /*shellpopblock*/
00084     
00085 
00086 
00087 static short shelleventsdisable = 0;
00088 
00089 
00090 boolean shelleventsblocked (void) {
00091     
00092     return (shelleventsdisable > 0);
00093     } /*shelleventsblocked*/
00094     
00095     
00096 boolean shellblockevents (void) {
00097     
00098     ++shelleventsdisable;
00099     
00100     return (true);
00101     } /*shellblockevents*/
00102     
00103 
00104 boolean shellpopevents (void) {
00105     
00106     if (shelleventsdisable <= 0)
00107         return (false);
00108     
00109     --shelleventsdisable;
00110     
00111     return (true);
00112     } /*shellpopevents*/
00113     
00114     

Generated on Wed May 31 18:20:01 2006 for frontierkernel 10.1.10a by  doxygen 1.4.6