Mercurial > sdl-ios-xcode
diff src/video/riscos/SDL_riscostask.c @ 1668:4da1ee79c9af SDL-1.3
more tweaking indent options
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 29 May 2006 04:04:35 +0000 |
parents | 782fd950bd46 |
children |
line wrap: on
line diff
--- a/src/video/riscos/SDL_riscostask.c Mon May 29 03:53:21 2006 +0000 +++ b/src/video/riscos/SDL_riscostask.c Mon May 29 04:04:35 2006 +0000 @@ -58,22 +58,22 @@ /* Local function */ -static int RISCOS_GetTaskName (char *task_name, size_t maxlen); +static int RISCOS_GetTaskName(char *task_name, size_t maxlen); /* Uncomment next line to copy mode changes/restores to stderr */ /* #define DUMP_MODE */ #ifdef DUMP_MODE #include "stdio.h" static void -dump_mode () +dump_mode() { - fprintf (stderr, "mode %d\n", stored_mode); + fprintf(stderr, "mode %d\n", stored_mode); if (stored_mode < -1 || stored_mode >= 256) { int blockSize = 0; int *storeBlock = (int *) stored_mode; while (blockSize < 5 || storeBlock[blockSize] != -1) { - fprintf (stderr, " %d\n", storeBlock[blockSize++]); + fprintf(stderr, " %d\n", storeBlock[blockSize++]); } } } @@ -86,13 +86,13 @@ *******************************************************************/ int -RISCOS_InitTask () +RISCOS_InitTask() { char task_name[32]; _kernel_swi_regs regs; int messages[4]; - if (RISCOS_GetTaskName (task_name, SDL_arraysize (task_name)) == 0) + if (RISCOS_GetTaskName(task_name, SDL_arraysize(task_name)) == 0) return 0; messages[0] = 9; /* Palette changed */ @@ -105,13 +105,13 @@ regs.r[2] = (unsigned int) task_name; regs.r[3] = (unsigned int) messages; - if (_kernel_swi (Wimp_Initialise, ®s, ®s) == 0) { + if (_kernel_swi(Wimp_Initialise, ®s, ®s) == 0) { wimp_version = regs.r[0]; task_handle = regs.r[1]; return 1; } #if !SDL_THREADS_DISABLED - main_thread = pthread_self (); + main_thread = pthread_self(); #endif return 0; @@ -124,23 +124,23 @@ **********************************************************************/ void -RISCOS_ExitTask () +RISCOS_ExitTask() { _kernel_swi_regs regs; if (stored_mode == -1) { /* Ensure cursor is put back to standard pointer shape if we have been running in a window */ - _kernel_osbyte (106, 1, 0); + _kernel_osbyte(106, 1, 0); } /* Ensure we end up back in the wimp */ - RISCOS_RestoreWimpMode (); + RISCOS_RestoreWimpMode(); /* Neatly exit the task */ regs.r[0] = task_handle; regs.r[1] = (unsigned int) 0x4b534154; - _kernel_swi (Wimp_CloseDown, ®s, ®s); + _kernel_swi(Wimp_CloseDown, ®s, ®s); task_handle = 0; } @@ -178,30 +178,30 @@ ***************************************************************************/ int -RISCOS_GetTaskName (char *task_name, size_t maxlen) +RISCOS_GetTaskName(char *task_name, size_t maxlen) { _kernel_swi_regs regs; task_name[0] = 0; /* Figure out a sensible task name */ - if (_kernel_swi (OS_GetEnv, ®s, ®s) == 0) { + if (_kernel_swi(OS_GetEnv, ®s, ®s) == 0) { char *command_line = (char *) regs.r[0]; - size_t len = SDL_strlen (command_line) + 1; - char *buffer = SDL_stack_alloc (char, len); + size_t len = SDL_strlen(command_line) + 1; + char *buffer = SDL_stack_alloc(char, len); char *env_var; char *p; - SDL_strlcpy (buffer, command_line, len); - p = SDL_strchr (buffer, ' '); + SDL_strlcpy(buffer, command_line, len); + p = SDL_strchr(buffer, ' '); if (p) *p = 0; - p = SDL_strrchr (buffer, '.'); + p = SDL_strrchr(buffer, '.'); if (p == 0) p = buffer; - if (stricmp (p + 1, "!RunImage") == 0) { + if (stricmp(p + 1, "!RunImage") == 0) { *p = 0; - p = SDL_strrchr (buffer, '.'); + p = SDL_strrchr(buffer, '.'); if (p == 0) p = buffer; } @@ -212,9 +212,9 @@ if (*p == '<') { // Probably in the form <appname$Dir> - char *q = SDL_strchr (p, '$'); + char *q = SDL_strchr(p, '$'); if (q == 0) - q = SDL_strchr (p, '>'); /* Use variable name if not */ + q = SDL_strchr(p, '>'); /* Use variable name if not */ if (q) *q = 0; p++; /* Move over the < */ @@ -222,49 +222,49 @@ if (*p) { /* Read variables that effect the RISC OS SDL engine for this task */ - len = SDL_strlen (p) + 18; /* 18 is larger than the biggest variable name */ - env_var = SDL_stack_alloc (char, len); + len = SDL_strlen(p) + 18; /* 18 is larger than the biggest variable name */ + env_var = SDL_stack_alloc(char, len); if (env_var) { char *env_val; /* See if a variable of form SDL$<dirname>$TaskName exists */ - SDL_strlcpy (env_var, "SDL$", len); - SDL_strlcat (env_var, p, len); - SDL_strlcat (env_var, "$TaskName", len); + SDL_strlcpy(env_var, "SDL$", len); + SDL_strlcat(env_var, p, len); + SDL_strlcat(env_var, "$TaskName", len); - env_val = SDL_getenv (env_var); + env_val = SDL_getenv(env_var); if (env_val) - SDL_strlcpy (task_name, env_val, maxlen); + SDL_strlcpy(task_name, env_val, maxlen); - SDL_strlcpy (env_var, "SDL$", len); - SDL_strlcat (env_var, p, len); - SDL_strlcat (env_var, "$BackBuffer", len); + SDL_strlcpy(env_var, "SDL$", len); + SDL_strlcat(env_var, p, len); + SDL_strlcat(env_var, "$BackBuffer", len); - env_val = SDL_getenv (env_var); + env_val = SDL_getenv(env_var); if (env_val) - riscos_backbuffer = atoi (env_val); + riscos_backbuffer = atoi(env_val); - SDL_strlcpy (env_var, "SDL$", len); - SDL_strlcat (env_var, p, len); - SDL_strlcat (env_var, "$CloseAction", len); + SDL_strlcpy(env_var, "SDL$", len); + SDL_strlcat(env_var, p, len); + SDL_strlcat(env_var, "$CloseAction", len); - env_val = SDL_getenv (env_var); - if (env_val && SDL_strcmp (env_val, "0") == 0) + env_val = SDL_getenv(env_var); + if (env_val && SDL_strcmp(env_val, "0") == 0) riscos_closeaction = 0; - SDL_stack_free (env_var); + SDL_stack_free(env_var); } if (!*task_name) - SDL_strlcpy (task_name, p, maxlen); + SDL_strlcpy(task_name, p, maxlen); } - SDL_stack_free (buffer); + SDL_stack_free(buffer); } if (task_name[0] == 0) - SDL_strlcpy (task_name, "SDL Task", maxlen); + SDL_strlcpy(task_name, "SDL Task", maxlen); return 1; } @@ -276,7 +276,7 @@ ******************************************************************/ void -RISCOS_StoreWimpMode () +RISCOS_StoreWimpMode() { _kernel_swi_regs regs; @@ -285,7 +285,7 @@ return; regs.r[0] = 1; - _kernel_swi (OS_ScreenMode, ®s, ®s); + _kernel_swi(OS_ScreenMode, ®s, ®s); if (regs.r[1] >= 0 && regs.r[1] < 256) stored_mode = regs.r[1]; else { @@ -297,7 +297,7 @@ while (blockSize < 5 || retBlock[blockSize] != -1) blockSize++; blockSize++; - storeBlock = (int *) SDL_malloc (blockSize * sizeof (int)); + storeBlock = (int *) SDL_malloc(blockSize * sizeof(int)); retBlock = (int *) regs.r[1]; for (j = 0; j < blockSize; j++) storeBlock[j] = retBlock[j]; @@ -305,8 +305,8 @@ stored_mode = (int) storeBlock; } #if DUMP_MODE - fprintf (stderr, "Stored "); - dump_mode (); + fprintf(stderr, "Stored "); + dump_mode(); #endif } @@ -317,7 +317,7 @@ *****************************************************************/ void -RISCOS_RestoreWimpMode () +RISCOS_RestoreWimpMode() { _kernel_swi_regs regs; @@ -326,21 +326,21 @@ return; #if DUMP_MODE - fprintf (stderr, "Restored"); - dump_mode (); + fprintf(stderr, "Restored"); + dump_mode(); #endif regs.r[0] = stored_mode; - _kernel_swi (Wimp_SetMode, ®s, ®s); + _kernel_swi(Wimp_SetMode, ®s, ®s); if (stored_mode < 0 || stored_mode > 256) { - SDL_free ((int *) stored_mode); + SDL_free((int *) stored_mode); } stored_mode = -1; /* Flush keyboard buffer to dump the keystrokes we've already polled */ regs.r[0] = 21; regs.r[1] = 0; /* Keyboard buffer number */ - _kernel_swi (OS_Byte, ®s, ®s); + _kernel_swi(OS_Byte, ®s, ®s); mouseInWindow = 0; @@ -353,13 +353,13 @@ *********************************************************************/ int -RISCOS_GetWimpVersion () +RISCOS_GetWimpVersion() { return wimp_version; } int -RISCOS_GetTaskHandle () +RISCOS_GetTaskHandle() { return task_handle; }