increased compatibility with classic TOS systems. (Getcookie() breaks on classic TOS systems.)

svn path=/trunk/netsurf/; revision=11446
This commit is contained in:
Ole Loots 2011-01-22 16:37:24 +00:00
parent 7e79d32bed
commit 3462356059
2 changed files with 42 additions and 0 deletions

View File

@ -20,6 +20,8 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <mint/osbind.h>
#include <mint/cookie.h>
#include <windom.h>
#include "desktop/cookies.h"
@ -34,6 +36,35 @@
#include "atari/misc.h"
extern void * h_gem_rsrc;
unsigned short gdosversion;
void init_os_info(void)
{
gdosversion = Sversion();
}
int tos_getcookie(long tag, long * value)
{
COOKIE * cptr;
long oldsp;
if( gdosversion > TOS4VER ){
return( Getcookie(tag, value) );
}
cptr = (COOKIE*)Setexc(0x0168, -1L);
if(cptr != NULL) {
do {
if( cptr->c == tag ){
if(cptr->v != NULL ){
*value = cptr->v;
return( C_FOUND );
}
}
} while( (cptr++)->c != 0L );
}
return( C_NOTFOUND );
}
void warn_user(const char *warning, const char *detail)
{
@ -47,6 +78,7 @@ void warn_user(const char *warning, const char *detail)
void die(const char *error)
{
printf("%s\n", error);
sleep( 3 );
exit(1);
}

View File

@ -19,6 +19,13 @@
#ifndef NS_ATARI_MISC_H
#define NS_ATARI_MISC_H
typedef struct {
long c;
long v;
} COOKIE;
#define TOS4VER 0x03000 /* this is assumed to be the last single tasking OS */
#define SBUF8_TO_LBUF8(sbuf,lbuf)\
lbuf[0] = (long)sbuf[0];\
lbuf[1] = (long)sbuf[1];\
@ -29,10 +36,13 @@
lbuf[6] = (long)sbuf[6];\
lbuf[7] = (long)sbuf[7];
struct gui_window * find_root_gui_window( WINDOW * win );
struct gui_window * find_cmp_window( COMPONENT * c );
OBJECT *get_tree( int idx );
char *get_rsc_string( int idx );
void gem_set_cursor( MFORM_EX * cursor );
void dbg_grect( char * str, GRECT * r );
void init_os_info(void);
int tos_getcookie( long tag, long * value );
#endif