From a80af90142526d5b026a89fdbac205e93e19d25a Mon Sep 17 00:00:00 2001 From: Ole Loots Date: Tue, 1 Mar 2011 19:27:34 +0000 Subject: Implemented OS detection routines provided by GS svn path=/trunk/netsurf/; revision=11873 --- atari/findfile.c | 16 +++++++++----- atari/osspec.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++---- atari/osspec.h | 23 ++++++++++++++++++-- atari/plot/font_vdi.c | 3 ++- 4 files changed, 90 insertions(+), 12 deletions(-) diff --git a/atari/findfile.c b/atari/findfile.c index da44ab5e4..5001050a6 100755 --- a/atari/findfile.c +++ b/atari/findfile.c @@ -55,18 +55,24 @@ char *url_to_path(const char *url) char *path; /* return the absolute path including leading / */ - if( atari_sysinfo.gdosversion > TOS4VER ) { + if( sys_type() & SYS_MINT ) { path = strdup(url_path + (FILE_SCHEME_PREFIX_LEN - 1)); } else { /* do not include / within url_path */ - path = strdup(url_path + (FILE_SCHEME_PREFIX_LEN)); - int l = strlen(path); - int i; - for( i = 0; i 0 ){ atari_sysinfo.small_sfont_pxh = out[0]; + } + atari_sysinfo.aes_max_win_title_len = 79; + if (sys_type() & (SYS_MAGIC|SYS_NAES|SYS_XAAES)) { + if (sys_NAES()) { + atari_sysinfo.aes_max_win_title_len = 127; + } + if (sys_XAAES()) { + atari_sysinfo.aes_max_win_title_len = 200; + } } } @@ -36,7 +86,7 @@ int tos_getcookie(long tag, long * value) COOKIE * cptr; long oldsp; - if( atari_sysinfo.gdosversion > TOS4VER ){ + if( atari_sysinfo.gemdos_version > TOS4VER ){ return( Getcookie(tag, value) ); } @@ -45,7 +95,9 @@ int tos_getcookie(long tag, long * value) do { if( cptr->c == tag ){ if(cptr->v != 0 ){ - *value = cptr->v; + if( value != NULL ){ + *value = cptr->v; + } return( C_FOUND ); } } @@ -86,7 +138,7 @@ char * gdos_realpath(const char * path, char * rpath) if( rpath == NULL ){ return( NULL ); } - if( atari_sysinfo.gdosversion > TOS4VER ){ + if( sys_type() & SYS_MINT ){ return( realpath(path, rpath) ); } diff --git a/atari/osspec.h b/atari/osspec.h index b6c8ea545..8d484146c 100644 --- a/atari/osspec.h +++ b/atari/osspec.h @@ -24,20 +24,39 @@ typedef struct { long v; } COOKIE; +/* System type detection added by [GS] */ +#define SYS_TOS 0x0001 +#define SYS_MAGIC 0x0002 +#define SYS_MINT 0x0004 +#define SYS_GENEVA 0x0010 +#define SYS_NAES 0x0020 +#define SYS_XAAES 0x0040 +/* detect the system type, AES + kernel */ +#define sys_type() (_systype_v ? _systype_v : _systype()) +#define sys_MAGIC() ((sys_type() & SYS_MAGIC) != 0) +#define sys_NAES() ((sys_type() & SYS_NAES) != 0) +#define sys_XAAES() ((sys_type() & SYS_XAAES) != 0) + + typedef struct { - unsigned short gdosversion; + unsigned short gemdos_version; + unsigned short gdos_FSMC; + unsigned short systype; unsigned short small_sfont_pxh; unsigned short medium_sfont_pxh; unsigned short large_sfont_pxh; bool sfont_monospaced; + short aes_max_win_title_len; } NS_ATARI_SYSINFO; extern NS_ATARI_SYSINFO atari_sysinfo; +extern unsigned short _systype_v; -#define TOS4VER 0x03000 /* this is assumed to be the last single tasking OS */ +#define TOS4VER 0x03300 /* this is assumed to be the last single tasking OS */ void init_os_info(void); int tos_getcookie( long tag, long * value ); void fix_path(char * path); char * gdos_realpath(const char * path, char * rpath); +unsigned short _systype (void); #endif \ No newline at end of file diff --git a/atari/plot/font_vdi.c b/atari/plot/font_vdi.c index d5cdc4eac..baaed2741 100755 --- a/atari/plot/font_vdi.c +++ b/atari/plot/font_vdi.c @@ -210,7 +210,8 @@ static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t leng } else { vst_color( self->vdi_handle, BLACK ); } - if( atari_sysinfo.gdosversion > 0x03000 ){ + + if( atari_sysinfo.gdos_FSMC ){ v_ftext( self->vdi_handle, x, y, (char*)&textcpy ); } else { v_gtext( self->vdi_handle, x, y, (char*)&textcpy ); -- cgit v1.2.3