Skip to content

Commit

Permalink
samples: Remove XReboot and return status from main()
Browse files Browse the repository at this point in the history
  • Loading branch information
Libbers authored and JayFoxRox committed Oct 21, 2019
1 parent 3d5504d commit 54d50a4
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 33 deletions.
5 changes: 2 additions & 3 deletions samples/hello++/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ class NumberClass{
int getValue() { return hiddenValue; };
};

int main() {
int main(void) {
XVideoSetMode(640, 480, 32, REFRESH_DEFAULT);

int ret = pb_init();
if (ret != 0) {
Sleep(2000);
return -1;
return 1;
}

pb_show_debug_screen();
Expand All @@ -33,6 +33,5 @@ int main() {
}

pb_kill();

return 0;
}
7 changes: 3 additions & 4 deletions samples/hello/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <windows.h>
#include "stdio.h"

void main(void)
int main(void)
{
XVideoSetMode(640, 480, 32, REFRESH_DEFAULT);

Expand All @@ -14,8 +14,7 @@ void main(void)
case 0: break;
default:
Sleep(2000);
XReboot();
return;
return 1;
}

pb_show_debug_screen();
Expand All @@ -26,5 +25,5 @@ void main(void)
}

pb_kill();
XReboot();
return 0;
}
6 changes: 3 additions & 3 deletions samples/httpd/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static void packet_timer(void *arg)
sys_timeout(PKT_TMR_INTERVAL, packet_timer, NULL);
}

void main(void)
int main(void)
{
sys_sem_t init_complete;
const ip4_addr_t *ip;
Expand Down Expand Up @@ -77,7 +77,7 @@ void main(void)
NULL, nforceif_init, ethernet_input);
if (!g_pnetif) {
debugPrint("netif_add failed\n");
return;
return 1;
}

netif_set_default(g_pnetif);
Expand Down Expand Up @@ -105,5 +105,5 @@ void main(void)
http_server_netconn_init();
while (1) NtYieldExecution();
Pktdrv_Quit();
return;
return 0;
}
6 changes: 3 additions & 3 deletions samples/httpd_bsd/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static void packet_timer(void *arg)
sys_timeout(PKT_TMR_INTERVAL, packet_timer, NULL);
}

void main(void)
int main(void)
{
XVideoSetMode(640,480,32,REFRESH_DEFAULT);
sys_sem_t init_complete;
Expand Down Expand Up @@ -76,7 +76,7 @@ void main(void)
NULL, nforceif_init, ethernet_input);
if (!g_pnetif) {
debugPrint("netif_add failed\n");
return;
return 1;
}

netif_set_default(g_pnetif);
Expand All @@ -103,5 +103,5 @@ void main(void)

http_server_bsd();
Pktdrv_Quit();
return;
return 0;
}
4 changes: 3 additions & 1 deletion samples/led/main.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <hal/led.h>
#include <windows.h>

void main(void)
int main(void)
{
// Set front LEDs to shine green, red and then turned off in a repeating pattern.
XSetCustomLED(XLED_GREEN, XLED_RED, XLED_OFF, XLED_OFF);
Expand All @@ -12,4 +12,6 @@ void main(void)
while(1) {
Sleep(1000);
}

return 0;
}
7 changes: 3 additions & 4 deletions samples/mesh/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static void draw_arrays(unsigned int mode, int start, int count);
static void draw_indices(void);

/* Main program function */
void main(void)
int main(void)
{
uint32_t *p;
int i, status;
Expand All @@ -78,8 +78,7 @@ void main(void)
if ((status = pb_init())) {
debugPrint("pb_init Error %d\n", status);
Sleep(2000);
XReboot();
return;
return 1;
}

pb_show_front_screen();
Expand Down Expand Up @@ -267,7 +266,7 @@ void main(void)
MmFreeContiguousMemory(alloc_vertices);
pb_show_debug_screen();
pb_kill();
XReboot();
return 0;
}

/* Construct a viewport transformation matrix */
Expand Down
7 changes: 3 additions & 4 deletions samples/sdl/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,18 +364,17 @@ void demo(void)
SDL_VideoQuit();
}

void main(void)
int main(void)
{
XVideoSetMode(640, 480, 32, REFRESH_DEFAULT);
if (pb_init() != 0)
{
Sleep(2000);
XReboot();
return;
return 1;
}

pb_show_debug_screen();
demo();
pb_kill();
XReboot();
return 0;
}
5 changes: 3 additions & 2 deletions samples/sdl_ttf/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
const extern int SCREEN_WIDTH;
const extern int SCREEN_HEIGHT;

void main() {
int main(void) {
int initialized_pbkit = -1;
int initialized_SDL = -1;
int initialized_TTF = -1;
Expand Down Expand Up @@ -136,5 +136,6 @@ void main() {
if (initialized_pbkit == 0) {
pb_kill();
}
return;

return 0;
}
7 changes: 3 additions & 4 deletions samples/triangle/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static void set_attrib_pointer(unsigned int index, unsigned int format, unsigned
static void draw_arrays(unsigned int mode, int start, int count);

/* Main program function */
void main(void)
int main(void)
{
uint32_t *p;
int i, status;
Expand All @@ -58,8 +58,7 @@ void main(void)
if ((status = pb_init())) {
debugPrint("pb_init Error %d\n", status);
Sleep(2000);
XReboot();
return;
return 1;
}

pb_show_front_screen();
Expand Down Expand Up @@ -162,7 +161,7 @@ void main(void)
MmFreeContiguousMemory(alloc_vertices);
pb_show_debug_screen();
pb_kill();
HalReturnToFirmware(HalQuickRebootRoutine);
return 0;
}

/* Construct a viewport transformation matrix */
Expand Down
10 changes: 5 additions & 5 deletions samples/winapi_filefind/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ int mount_drive_c ()
return 0;
}

int main()
int main(void)
{
XVideoSetMode(640, 480, 32, REFRESH_DEFAULT);
int ret = pb_init();
if (ret != 0) {
Sleep(2000);
return -1;
return 1;
}

pb_show_debug_screen();

// Mount C:
ret = mount_drive_c();
if (ret != 0) {
return ret;
return 1;
}

debugPrint("Content of C:\\\n");
Expand All @@ -50,7 +50,7 @@ int main()
if (hFind == INVALID_HANDLE_VALUE) {
debugPrint("FindFirstHandle() failed!\n");
Sleep(5000);
return -1;
return 1;
}

do {
Expand Down Expand Up @@ -79,5 +79,5 @@ int main()
}

pb_kill();
XReboot();
return 0;
}

0 comments on commit 54d50a4

Please sign in to comment.