1/*
2 File:		MBCDebug.cp
3 Contains:	Debug flags
4 Copyright:	© 2011 by Apple Inc., all rights reserved.
5
6 IMPORTANT: This Apple software is supplied to you by Apple Computer,
7 Inc.  ("Apple") in consideration of your agreement to the following
8 terms, and your use, installation, modification or redistribution of
9 this Apple software constitutes acceptance of these terms.  If you do
10 not agree with these terms, please do not use, install, modify or
11 redistribute this Apple software.
12
13 In consideration of your agreement to abide by the following terms,
14 and subject to these terms, Apple grants you a personal, non-exclusive
15 license, under Apple's copyrights in this original Apple software (the
16 "Apple Software"), to use, reproduce, modify and redistribute the
17 Apple Software, with or without modifications, in source and/or binary
18 forms; provided that if you redistribute the Apple Software in its
19 entirety and without modifications, you must retain this notice and
20 the following text and disclaimers in all such redistributions of the
21 Apple Software.  Neither the name, trademarks, service marks or logos
22 of Apple Inc. may be used to endorse or promote products
23 derived from the Apple Software without specific prior written
24 permission from Apple.  Except as expressly stated in this notice, no
25 other rights or licenses, express or implied, are granted by Apple
26 herein, including but not limited to any patent rights that may be
27 infringed by your derivative works or by other works in which the
28 Apple Software may be incorporated.
29
30 The Apple Software is provided by Apple on an "AS IS" basis.  APPLE
31 MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
32 THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND
33 FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS
34 USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
35
36 IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT,
37 INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
38 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
39 PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
40 REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE,
41 HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING
42 NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN
43 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44 */
45
46#include "MBCDebug.h"
47
48#include <stdlib.h>
49
50int MBCDebug::sDebugFlags;
51
52void
53MBCDebug::Update()
54{
55    if (const char * dbg = getenv("MBC_DEBUG"))
56        sDebugFlags = atoi(dbg);
57    else
58        sDebugFlags = 0;
59}
60
61void
62MBCDebug::SetDebugFlags(int flag, bool val)
63{
64    if (val)
65        sDebugFlags |=  flag;
66    else
67        sDebugFlags &= ~flag;
68}
69