updated some printfs, added comment about sched_yield
[mesa.git] / src / mesa / shader / slang / MachineIndependent / InfoSink.cpp
1 //
2 //Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
3 //All rights reserved.
4 //
5 //Redistribution and use in source and binary forms, with or without
6 //modification, are permitted provided that the following conditions
7 //are met:
8 //
9 // Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //
12 // Redistributions in binary form must reproduce the above
13 // copyright notice, this list of conditions and the following
14 // disclaimer in the documentation and/or other materials provided
15 // with the distribution.
16 //
17 // Neither the name of 3Dlabs Inc. Ltd. nor the names of its
18 // contributors may be used to endorse or promote products derived
19 // from this software without specific prior written permission.
20 //
21 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 //"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 //LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 //FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 //COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 //INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 //BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 //CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 //LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 //ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 //POSSIBILITY OF SUCH DAMAGE.
33 //
34
35 #include "Include/InfoSink.h"
36
37 #ifdef _WIN32
38 #include <windows.h>
39 #endif
40
41 void TInfoSinkBase::append(const char *s)
42 {
43 if (outputStream & EString) {
44 checkMem(strlen(s));
45 sink.append(s);
46 }
47
48 #ifdef _WIN32
49 if (outputStream & EDebugger)
50 OutputDebugString(s);
51 #endif
52
53 if (outputStream & EStdOut)
54 fprintf(stdout, "%s", s);
55 }
56
57 void TInfoSinkBase::append(int count, char c)
58 {
59 if (outputStream & EString) {
60 checkMem(count);
61 sink.append(count, c);
62 }
63
64 #ifdef _WIN32
65 if (outputStream & EDebugger) {
66 char str[2];
67 str[0] = c;
68 str[1] = '\0';
69 OutputDebugString(str);
70 }
71 #endif
72
73 if (outputStream & EStdOut)
74 fprintf(stdout, "%c", c);
75 }
76
77 void TInfoSinkBase::append(const TPersistString& t)
78 {
79 if (outputStream & EString) {
80 checkMem(t.size());
81 sink.append(t);
82 }
83
84 #ifdef _WIN32
85 if (outputStream & EDebugger)
86 OutputDebugString(t.c_str());
87 #endif
88
89 if (outputStream & EStdOut)
90 fprintf(stdout, "%s", t.c_str());
91 }
92
93 void TInfoSinkBase::append(const TString& t)
94 {
95 if (outputStream & EString) {
96 checkMem(t.size());
97 sink.append(t.c_str());
98 }
99
100 #ifdef _WIN32
101 if (outputStream & EDebugger)
102 OutputDebugString(t.c_str());
103 #endif
104
105 if (outputStream & EStdOut)
106 fprintf(stdout, "%s", t.c_str());
107 }