Root/
Source at commit 284 created 13 years 10 months ago. By blackosx, Amended my mistake by updating the Default theme images in the trunk. Now put them back as they were.. (Sorry) | |
---|---|
1 | /*␊ |
2 | * Copyright (c) 1999-2003 Apple Computer, Inc. All rights reserved.␊ |
3 | *␊ |
4 | * @APPLE_LICENSE_HEADER_START@␊ |
5 | * ␊ |
6 | * Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights␊ |
7 | * Reserved. This file contains Original Code and/or Modifications of␊ |
8 | * Original Code as defined in and that are subject to the Apple Public␊ |
9 | * Source License Version 2.0 (the "License"). You may not use this file␊ |
10 | * except in compliance with the License. Please obtain a copy of the␊ |
11 | * License at http://www.apple.com/publicsource and read it before using␊ |
12 | * this file.␊ |
13 | * ␊ |
14 | * The Original Code and all software distributed under the License are␊ |
15 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER␊ |
16 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,␊ |
17 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,␊ |
18 | * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the␊ |
19 | * License for the specific language governing rights and limitations␊ |
20 | * under the License.␊ |
21 | * ␊ |
22 | * @APPLE_LICENSE_HEADER_END@␊ |
23 | */␊ |
24 | /* ␊ |
25 | * Mach Operating System␊ |
26 | * Copyright (c) 1990 Carnegie-Mellon University␊ |
27 | * Copyright (c) 1989 Carnegie-Mellon University␊ |
28 | * All rights reserved. The CMU software License Agreement specifies␊ |
29 | * the terms and conditions for use and redistribution.␊ |
30 | */␊ |
31 | ␊ |
32 | /*␊ |
33 | * ␉␉␉INTEL CORPORATION PROPRIETARY INFORMATION␊ |
34 | *␊ |
35 | *␉This software is supplied under the terms of a license agreement or ␊ |
36 | *␉nondisclosure agreement with Intel Corporation and may not be copied ␊ |
37 | *␉nor disclosed except in accordance with the terms of that agreement.␊ |
38 | *␊ |
39 | *␉Copyright 1988, 1989 Intel Corporation␊ |
40 | */␊ |
41 | ␊ |
42 | /*␊ |
43 | * Copyright 1993 NeXT, Inc.␊ |
44 | * All rights reserved.␊ |
45 | */␊ |
46 | ␊ |
47 | #include "libsaio.h"␊ |
48 | #include "bootstruct.h"␊ |
49 | ␊ |
50 | extern int␉vprf(const char * fmt, va_list ap);␊ |
51 | ␊ |
52 | bool gVerboseMode;␊ |
53 | bool gErrors;␊ |
54 | ␊ |
55 | /*␊ |
56 | * write one character to console␊ |
57 | */␊ |
58 | void putchar(int c)␊ |
59 | {␊ |
60 | ␉if ( c == '\t' )␊ |
61 | ␉{␊ |
62 | ␉␉for (c = 0; c < 8; c++) putc(' ');␊ |
63 | ␉␉return;␊ |
64 | ␉}␊ |
65 | ␊ |
66 | ␉if ( c == '\n' )␊ |
67 | {␊ |
68 | ␉␉putc('\r');␊ |
69 | }␊ |
70 | ␊ |
71 | ␉putc(c);␊ |
72 | }␊ |
73 | ␊ |
74 | int getc()␊ |
75 | {␊ |
76 | int c = bgetc();␊ |
77 | ␊ |
78 | if ((c & 0xff) == 0)␊ |
79 | return c;␊ |
80 | else␊ |
81 | return (c & 0xff);␊ |
82 | }␊ |
83 | ␊ |
84 | // Read and echo a character from console. This doesn't echo backspace␊ |
85 | // since that screws up higher level handling␊ |
86 | ␊ |
87 | int getchar()␊ |
88 | {␊ |
89 | ␉register int c = getc();␊ |
90 | ␊ |
91 | ␉if ( c == '\r' ) c = '\n';␊ |
92 | ␊ |
93 | ␉if ( c >= ' ' && c < 0x7f) putchar(c);␊ |
94 | ␉␊ |
95 | ␉return (c);␊ |
96 | }␊ |
97 | ␊ |
98 | int printf(const char * fmt, ...)␊ |
99 | {␊ |
100 | va_list ap;␊ |
101 | ␉va_start(ap, fmt);␊ |
102 | ␉if (bootArgs->Video.v_display == VGA_TEXT_MODE)␊ |
103 | ␉␉prf(fmt, ap, putchar, 0);␊ |
104 | ␉else␊ |
105 | ␉␉vprf(fmt, ap);␊ |
106 | ␉va_end(ap);␊ |
107 | return 0;␊ |
108 | }␊ |
109 | ␊ |
110 | int verbose(const char * fmt, ...)␊ |
111 | {␊ |
112 | va_list ap;␊ |
113 | ␊ |
114 | if (gVerboseMode)␊ |
115 | {␊ |
116 | ␉␉va_start(ap, fmt);␊ |
117 | ␉␉if (bootArgs->Video.v_display == VGA_TEXT_MODE)␊ |
118 | ␉␉␉prf(fmt, ap, putchar, 0);␊ |
119 | ␉␉else␊ |
120 | ␉␉␉vprf(fmt, ap);␊ |
121 | va_end(ap);␊ |
122 | }␊ |
123 | return(0);␊ |
124 | }␊ |
125 | ␊ |
126 | int error(const char * fmt, ...)␊ |
127 | {␊ |
128 | va_list ap;␊ |
129 | gErrors = true;␊ |
130 | va_start(ap, fmt);␊ |
131 | ␉if (bootArgs->Video.v_display == VGA_TEXT_MODE)␊ |
132 | ␉␉prf(fmt, ap, putchar, 0);␊ |
133 | else␊ |
134 | ␉␉vprf(fmt, ap);␊ |
135 | ␉va_end(ap);␊ |
136 | return(0);␊ |
137 | }␊ |
138 | ␊ |
139 | void stop(const char * fmt, ...)␊ |
140 | {␊ |
141 | ␉va_list ap;␊ |
142 | ␊ |
143 | ␉printf("\n");␊ |
144 | ␉va_start(ap, fmt);␊ |
145 | ␉if (bootArgs->Video.v_display == VGA_TEXT_MODE) {␊ |
146 | ␉␉prf(fmt, ap, putchar, 0);␊ |
147 | ␉} else {␊ |
148 | ␉␉vprf(fmt, ap);␊ |
149 | ␉}␊ |
150 | ␉va_end(ap);␊ |
151 | ␉printf("\nThis is a non recoverable error! System HALTED!!!");␊ |
152 | ␉halt();␊ |
153 | ␉while (1);␊ |
154 | }␊ |
155 | ␊ |
156 | /** Print a "Press a key to continue..." message and wait for a key press. */␊ |
157 | void pause() ␊ |
158 | {␊ |
159 | printf("Press a key to continue...");␊ |
160 | getc();␊ |
161 | }␊ |
162 |