Chameleon

Chameleon Commit Details

Date:2011-05-30 21:45:55 (9 years 7 months ago)
Author:Evan Lojewski
Commit:925
Parents: 924
Message:Replaced getc calls with getchar. Slight makefile changes. removed types.h
Changes:
D/trunk/i386/modules/include/types.h
M/trunk/i386/boot2/resume.c
M/trunk/i386/boot2/boot.c
M/trunk/i386/boot2/gui.c
M/trunk/i386/libsa/libsa.h
M/trunk/Make.rules
M/trunk/i386/boot2/modules.c
M/trunk/i386/libsaio/saio_internal.h
M/trunk/i386/boot2/ramdisk.c
M/trunk/i386/boot2/options.c
M/trunk/i386/libsa/string.c
M/trunk/i386/libsaio/xml.c

File differences

trunk/i386/libsaio/xml.c
356356
357357
358358
359
359
360360
361361
362362
......
381381
382382
383383
384
384
385385
386386
387387
......
424424
425425
426426
427
427
428428
429429
430430
......
449449
450450
451451
452
452
453453
454454
455455
......
670670
671671
672672
673
673
674674
675675
676676
......
711711
712712
713713
714
714
715715
716716
717717
......
732732
733733
734734
735
735
736736
737737
738738
......
772772
773773
774774
775
775
776776
777777
778778
......
804804
805805
806806
807
807
808808
809809
810810
else
{
printf("ParseStringID error (0x%x)\n", *val);
getc();
getchar();
return -1;
}
}
else
{
printf("ParseStringIDREF error (0x%x)\n", *val);
getc();
getchar();
return -1;
}
}
else
{
printf("ParseIntegerID error (0x%x)\n", *val);
getc();
getchar();
return -1;
}
}
else
{
printf("ParseStringIDREF error (0x%x)\n", *val);
getc();
getchar();
return -1;
}
}
if(buffer[0] == '<')
{
printf("Warning integer is non existant\n");
getc();
getchar();
tmpTag = NewTag();
tmpTag->type = kTagTypeInteger;
tmpTag->string = 0;
else
{
printf("ParseTagInteger hex error (0x%x) in buffer %s\n", *val, buffer);
getc();
getchar();
return -1;
}
}
if (*val < '0' || *val > '9')
{
printf("ParseTagInteger decimal error (0x%x) in buffer %s\n", *val, buffer);
getc();
getchar();
return -1;
}
//printf("ParseTagData unimplimented\n");
//printf("Data: %s\n", buffer);
//getc();
//getchar();
// TODO: base64 decode
if (tmpTag == 0) return -1;
printf("ParseTagDate unimplimented\n");
getc();
getchar();
tmpTag->type = kTagTypeDate;
tmpTag->string = 0;
trunk/i386/libsaio/saio_internal.h
4949
5050
5151
52
5352
5453
5554
extern int ebiosEjectMedia(int biosdev);
extern void bios_putchar(int ch);
extern void putca(int ch, int attr, int repeat);
extern int getc(void);
extern void pause();
extern int readKeyboardStatus(void);
extern int readKeyboardShiftFlags(void);
trunk/i386/boot2/resume.c
119119
120120
121121
122
122
123123
124124
125125
......
143143
144144
145145
146
146
147147
148148
149149
printf ("Resuming from Encrypted image is unsupported.\n"
"Uncheck \"Use secure virtual memory\" in \"Security\" pane on system preferences.\n"
"Press any key to proceed with normal boot.\n");
getc ();
getchar ();
return;
}
// depends on NVRAM
if (!((long long)mem_base+allocSize<1024*bootInfo->extmem+0x100000))
{
printf ("Not enough space to restore image. Press any key to proceed with normal boot.\n");
getc ();
getchar ();
return;
}
trunk/i386/boot2/boot.c
186186
187187
188188
189
189
190190
191191
192192
......
351351
352352
353353
354
354
355355
356356
357357
bool dummyVal;
if (getBoolForKey(kWaitForKeypressKey, &dummyVal, &bootInfo->bootConfig) && dummyVal) {
printf("Press any key to continue...");
getc();
getchar();
}
usb_loop();
#if DEBUG
printf(" Default: %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n", gBootVolume, gBootVolume->biosdev, gBootVolume->part_no, gBootVolume->flags);
printf(" bt(0,0): %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n", gBIOSBootVolume, gBIOSBootVolume->biosdev, gBIOSBootVolume->part_no, gBIOSBootVolume->flags);
getc();
getchar();
#endif
useGUI = true;
trunk/i386/boot2/modules.c
1515
1616
1717
18
18
1919
2020
2121
......
8585
8686
8787
88
88
8989
9090
9191
......
179179
180180
181181
182
182
183183
184184
185185
......
287287
288288
289289
290
290
291291
292292
293293
......
349349
350350
351351
352
352
353353
354354
355355
......
358358
359359
360360
361
361
362362
363363
364364
......
886886
887887
888888
889
889
890890
891891
892892
......
912912
913913
914914
915
915
916916
917917
918918
......
930930
931931
932932
933
933
934934
935935
936936
......
971971
972972
973973
974
974
975975
976976
977977
......
11021102
11031103
11041104
1105
1105
11061106
11071107
11081108
......
11491149
11501150
11511151
1152
1152
11531153
11541154
11551155
#if CONFIG_MODULE_DEBUG
#define DBG(x...)printf(x);
#define DBGPAUSE()getc()
#define DBGPAUSE()getchar()
#else
#define DBG(x...)
#define DBGPAUSE()
else
{
// The module does not have a valid start function
printf("Unable to start %s\n", SYMBOLS_MODULE); getc();
printf("Unable to start %s\n", SYMBOLS_MODULE); getchar();
}
}
}
else // The module does not have a valid start function. This may be a library.
{
printf("WARNING: Unable to start %s\n", module);
getc();
getchar();
}
#else
else msglog("WARNING: Unable to start %s\n", module);
#if CONFIG_MODULE_DEBUG
verbose("Unable to locate symbol %s\n", name);
getc();
getchar();
#endif
if(strcmp(name, VOID_SYMBOL) == 0) return 0xFFFFFFFF;
else
{
verbose("Invalid mach magic 0x%X\n", ((struct mach_header*)binary)->magic);
//getc();
//getchar();
return NULL;
}
/*if(((struct mach_header*)binary)->filetype != MH_DYLIB)
{
printf("Module is not a dylib. Unable to load.\n");
getc();
getchar();
return NULL; // Module is in the incorrect format
}*/
else
{
printf("Unable to bind symbol %s\n", symbolName);
getc();
getchar();
}
segmentAddress += sizeof(void*);
else
{
printf("Unable to bind symbol %s\n", symbolName);
getc();
getchar();
}
segmentAddress += tmp + sizeof(void*);
else
{
printf("Unable to bind symbol %s\n", symbolName);
getc();
getchar();
}
segmentAddress += (immediate * sizeof(void*)) + sizeof(void*);
else
{
printf("Unable to bind symbol %s\n", symbolName);
getc();
getchar();
}
break;
}
#if CONFIG_MODULE_DEBUG
//print_hook_list();
//getc();
//getchar();
#endif
}
void dyld_stub_binder()
{
printf("ERROR: dyld_stub_binder was called, should have been take care of by the linker.\n");
getc();
getchar();
}
#else /* CONFIG_MODULES */
trunk/i386/boot2/gui.c
15791579
15801580
15811581
1582
1582
15831583
15841584
15851585
updateVRAM();
key = getc();
key = getchar();
if( key == kUpArrowkey )
if( currentline > 0 )
trunk/i386/boot2/ramdisk.c
290290
291291
292292
293
293
294294
295295
296296
......
303303
304304
305305
306
306
307307
308308
309309
setCursorPosition(0, 0, 1);
showInfoRAMDisk();
printf("\n\nPress any key to continue.\n");
getc();
getchar();
setActiveDisplayPage(0);
}
else
printf("\n?rd m <filename> - mount ramdisk image\n?rd u - unmount ramdisk image");
printf("\n?rd e - enable bt(0,0) alias\n?rd d - disable bt(0,0) alias");
printf("\n\nPress any key to continue.\n");
getc();
getchar();
setActiveDisplayPage(0);
}
}
trunk/i386/boot2/options.c
911911
912912
913913
914
914
915915
916916
917917
......
13831383
13841384
13851385
1386
1386
13871387
13881388
13891389
......
14501450
14511451
14521452
1453
1453
14541454
14551455
14561456
......
15011501
15021502
15031503
1504
1504
15051505
15061506
15071507
// reset cursor co-ords
gui.debug.cursor = pos( gui.screen.width - 160 , 10 );
}
key = getc();
key = getchar();
updateMenu( key, (void **) &menuBVR );
newShowPrompt = (gDeviceCount == 0) || (menuBVR->flags & kBVFlagNativeBoot);
printf("[Type %s%sq to quit viewer]", (line_offset > 0) ? "p for previous page, " : "", (*bp != '\1') ? "space for next page, " : "");
}
c = getc();
c = getchar();
if (c == 'q' || c == 'Q') {
break;
}
printf("Typical boot devices are 80 (First HD), 81 (Second HD)\n");
printf("Enter two-digit hexadecimal boot device [%02x]: ", bootdevice);
do {
key = getc();
key = getchar();
switch (key & kASCIIKeyMask) {
case kBackspaceKey:
if (digitsI > 0) {
bool promptForRescanOption(void)
{
printf("\nWould you like to enable media rescan option?\nPress ENTER to enable or any key to skip.\n");
if (getc() == kReturnKey) {
if (getchar() == kReturnKey) {
return true;
} else {
return false;
trunk/i386/modules/include/types.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#ifndef _TYPES_H_
#define _TYPES_H_
typedef unsigned char UInt8;
typedef signed char SInt8;
typedef unsigned short UInt16;
typedef signed short SInt16;
typedef unsigned int UInt32;
typedef signed int SInt32;
typedef unsigned long long UInt64;
typedef signed long long SInt64;
#endif /* _TYPES_H_ */
trunk/i386/libsa/libsa.h
9393
9494
9595
96
96
9797
9898
9999
extern int strncmp(const char * s1, const char * s2, size_t n);
extern char * strcpy(char * s1, const char * s2);
extern char * strncpy(char * s1, const char * s2, size_t n);
extern char * strlcpy(char * s1, const char * s2, size_t n);
extern size_t strlcpy(char * s1, const char * s2, size_t n);
extern char * strstr(const char *in, const char *str);
extern int atoi(const char * str);
extern int ptol(const char * str);
trunk/i386/libsa/string.c
165165
166166
167167
168
168
169169
170170
171
172171
173172
174173
175
174
176175
177176
178177
return ret;
}
char *
size_t
strlcpy(char * s1, const char * s2, size_t n)
{
register char *ret = s1;
while (n && (*s1++ = *s2++))
n--;
if (!n) *--s1=0;
return ret;
return strlen(s2);
}
char *
trunk/Make.rules
1616
1717
1818
19
20
21
19
20
2221
2322
24
25
26
2723
28
29
30
3124
3225
3326
......
7669
7770
7871
79
80
81
82
83
84
8572
8673
8774
8875
8976
90
91
92
93
94
95
96
9777
9878
9979
NASM = $(shell which nasm) -p $(SRCROOT)/autoconf.inc
# CFLAGS= -O $(MORECPP) -arch i386 -g
CFLAGS= $(CONFIG_OPTIMIZATION_LEVEL) $(MORECPP) -g -Wmost -Werror
CPPFLAGS = -fno-exceptions -fno-rtti
CFLAGS= $(CONFIG_OPTIMIZATION_LEVEL) -g -Wmost -Werror
CPPFLAGS = $(MORECPP) -g -Wmost -Werror -fno-exceptions -fno-rtti
DEFINES=
CONFIG = hd
#LIBDIR = libsa
#INC = -I. -I$(LIBDIR)
#
# Common makefile targets.
#
-MD -dependency-file $(OBJROOT)/$*.d
@md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d
#$(OBJROOT)/.s.o:
#@echo "\t[AS] $<"
#@cc $(CPPFLAGS) -c $(INC) -arch i386 -o $(OBJROOT)/$(@F) $<
# This breaks make, must use make all (FIXME)
$(OBJROOT)/boot2.o:
@echo "\t[AS] boot2.s"
@cc $(CPPFLAGS) -Wa,-n -c $(INC) -arch i386 -o $(OBJROOT)/$(@F) boot2.s \
-MD -dependency-file $*.d
@md -u $(OBJROOT)/Makedep -f -d $*.d
#$(OBJROOT)/boot_modules.o:
#@echo "\t[AS] boot_modules.s"
#@cc $(CPPFLAGS) -Wa,-n -c $(INC) -arch i386 -o $(OBJROOT)/$(@F) $(SYMROOT)/boot_modules.s \
# -MD -dependency-file $*.d
#@md -u $(OBJROOT)/Makedep -f -d $*.d
$(OBJROOT)/%.o: %.s
@echo "\t[AS] $<"

Archive Download the corresponding diff file

Revision: 925