|
From: <ba...@us...> - 2006-09-18 00:15:11
|
Revision: 367
http://svn.sourceforge.net/cadcdev/?rev=367&view=rev
Author: bardtx
Date: 2006-09-17 17:14:59 -0700 (Sun, 17 Sep 2006)
Log Message:
-----------
kos: More example fixes, some by me, some from here:
https://sourceforge.net/mailarchive/forum.php?thread_id=10927199&forum_id=2046
Modified Paths:
--------------
kos/examples/dreamcast/basic/exec/Makefile
kos/examples/dreamcast/basic/exec/exec.c
kos/examples/dreamcast/kgl/basic/vfzclip/vfzclip.c
kos/examples/dreamcast/kgl/demos/tunnel/menu.cpp
kos/examples/dreamcast/lua/basic/lua.c
kos/examples/dreamcast/sound/hello-mp3/Makefile
kos/examples/dreamcast/sound/hello-ogg/Makefile
Modified: kos/examples/dreamcast/basic/exec/Makefile
===================================================================
--- kos/examples/dreamcast/basic/exec/Makefile 2006-09-18 00:05:50 UTC (rev 366)
+++ kos/examples/dreamcast/basic/exec/Makefile 2006-09-18 00:14:59 UTC (rev 367)
@@ -26,7 +26,7 @@
$(SUBTARGET): $(SUBOBJS)
$(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o sub.elf $(KOS_START) \
$(SUBOBJS) $(OBJEXTRA) $(KOS_LIBS)
- $(KOS_OBJCOPY) -O binary sub.elf $(SUBTARGET)
+ $(KOS_OBJCOPY) -O binary -R .stack sub.elf $(SUBTARGET)
# You can safely remove the next two targets if you don't use a ROMDISK
romdisk.img: $(SUBTARGET)
Modified: kos/examples/dreamcast/basic/exec/exec.c
===================================================================
--- kos/examples/dreamcast/basic/exec/exec.c 2006-09-18 00:05:50 UTC (rev 366)
+++ kos/examples/dreamcast/basic/exec/exec.c 2006-09-18 00:14:59 UTC (rev 367)
@@ -10,6 +10,8 @@
extern uint8 romdisk[];
KOS_INIT_ROMDISK(romdisk);
+#define false (1 == 0)
+
int main(int argc, char **argv) {
file_t f;
void *subelf;
Modified: kos/examples/dreamcast/kgl/basic/vfzclip/vfzclip.c
===================================================================
--- kos/examples/dreamcast/kgl/basic/vfzclip/vfzclip.c 2006-09-18 00:05:50 UTC (rev 366)
+++ kos/examples/dreamcast/kgl/basic/vfzclip/vfzclip.c 2006-09-18 00:14:59 UTC (rev 367)
@@ -11,6 +11,9 @@
#define SDIFF 0.001f
+#define true (1 == 1)
+#define false (1 == 0)
+
CVSID("$Id");
/*
Modified: kos/examples/dreamcast/kgl/demos/tunnel/menu.cpp
===================================================================
--- kos/examples/dreamcast/kgl/demos/tunnel/menu.cpp 2006-09-18 00:05:50 UTC (rev 366)
+++ kos/examples/dreamcast/kgl/demos/tunnel/menu.cpp 2006-09-18 00:14:59 UTC (rev 367)
@@ -38,6 +38,13 @@
memcpy(madd->pformat, pformat, strlen(pformat)+1);
printf("[i**]menu->add = %d\n", strlen(pformat)+1);
}
+
+// lvalue cast fix for C++, as proposed by Jim Ursetto
+// http://sourceforge.net/mailarchive/message.php?msg_id=9293303
+template <typename T, typename X> inline T& lvalue_cast(X& x) {
+ return *( reinterpret_cast<T*>(&x) ); // *((T *)& x)
+}
+
void Menu::add(float min, float max, float amt, float* pval, char *pformat) {
Menuitem_t* madd;
if (mlist == NULL) {
@@ -56,7 +63,7 @@
uf2i.f = min; madd->min = uf2i.i;
uf2i.f = max; madd->max = uf2i.i;
uf2i.f = amt; madd->amt = uf2i.i;
- (float *)madd->pvalue = (float *)pval;
+ lvalue_cast<float *>(madd->pvalue) = pval;
madd->pformat = (char*) malloc(strlen(pformat)+1);
memcpy(madd->pformat, pformat, strlen(pformat)+1);
printf("[f**]menu->add = %d\n", strlen(pformat)+1);
Modified: kos/examples/dreamcast/lua/basic/lua.c
===================================================================
--- kos/examples/dreamcast/lua/basic/lua.c 2006-09-18 00:05:50 UTC (rev 366)
+++ kos/examples/dreamcast/lua/basic/lua.c 2006-09-18 00:14:59 UTC (rev 367)
@@ -34,9 +34,6 @@
static lua_Hook old_linehook = NULL;
static lua_Hook old_callhook = NULL;
-int errno = 0;
-int _impure_ptr = 0;
-
static void userinit (void) {
lua_baselibopen(L);
lua_iolibopen(L);
Modified: kos/examples/dreamcast/sound/hello-mp3/Makefile
===================================================================
--- kos/examples/dreamcast/sound/hello-mp3/Makefile 2006-09-18 00:05:50 UTC (rev 366)
+++ kos/examples/dreamcast/sound/hello-mp3/Makefile 2006-09-18 00:14:59 UTC (rev 367)
@@ -11,8 +11,7 @@
-rm -f romdisk.o romdisk.img
$(TARGET): $(OBJS)
- $(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o $(TARGET) $(KOS_START) \
- $(OBJS) $(DATAOBJS) $(OBJEXTRA) -L$(KOS_BASE)/lib -lmp3 -lm -lkallisti -lgcc
+ kos-cc -o $(TARGET) $(OBJS) $(DATAOBJS) $(OBJEXTRA) -lmp3 -lm
romdisk.img:
$(KOS_GENROMFS) -f romdisk.img -d romdisk -v
Modified: kos/examples/dreamcast/sound/hello-ogg/Makefile
===================================================================
--- kos/examples/dreamcast/sound/hello-ogg/Makefile 2006-09-18 00:05:50 UTC (rev 366)
+++ kos/examples/dreamcast/sound/hello-ogg/Makefile 2006-09-18 00:14:59 UTC (rev 367)
@@ -18,9 +18,8 @@
# You can choose a decoder to test below. Tremor is the integer-only
# version, and oggvorbisplay is the full FP version.
$(TARGET): $(OBJS)
- $(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o $(TARGET) $(KOS_START) \
- $(OBJS) $(DATAOBJS) $(OBJEXTRA) -L$(KOS_BASE)/lib -ltremor -lm -lkallisti -lgcc
-# $(OBJS) $(DATAOBJS) $(OBJEXTRA) -L$(KOS_BASE)/lib -loggvorbisplay -lm -lkallisti -lgcc
+ kos-cc -o $(TARGET) $(OBJS) $(DATAOBJS) $(OBJEXTRA) -ltremor -lm
+# kos-cc -o $(TARGET) $(OBJS) $(DATAOBJS) $(OBJEXTRA) -loggvorbisplay -lm
romdisk.img:
$(KOS_GENROMFS) -f romdisk.img -d romdisk -v
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|