NetSurf
osspec.c
Go to the documentation of this file.
1/*
2 * Copyright 2010 <ole@monochrom.net>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#include <sys/types.h>
20#include <limits.h>
21#include <stdlib.h>
22#include <unistd.h>
23#include <stdbool.h>
24#include <stdio.h>
25#include <string.h>
26#include <support.h>
27#include <mint/osbind.h>
28#include <mint/cookie.h>
29
30#include "utils/log.h"
31#include "atari/osspec.h"
32#include "atari/gemtk/gemtk.h"
33
34#ifndef PATH_MAX
35#define PATH_MAX 1024
36#endif
37
39
40void init_os_info(void)
41{
42 int16_t out[4];
43 long cookie_FSMC = 0;
44
45 atari_sysinfo.gemdos_version = Sversion();
46
47 if( tos_getcookie (C_FSMC, &cookie_FSMC ) == C_FOUND ) {
49 } else {
51 }
55 /* todo: detect if system font is monospaced */
57 if( appl_xgetinfo(AES_LARGEFONT, &out[0], &out[1], &out[2], &out[3] ) > 0 ){
59 }
60 if( appl_xgetinfo(AES_SMALLFONT, &out[0], &out[1], &out[2], &out[3] ) > 0 ){
62 }
64 if (sys_type() & (SYS_MAGIC|SYS_NAES|SYS_XAAES)) {
65 if (sys_NAES()) {
67 }
68 if (sys_XAAES()) {
70 }
71 }
72}
73
74
75/* exported interface documented in atari/osspec.h */
76int tos_getcookie(long tag, long * value)
77{
78 COOKIE * cptr;
79
80 if( atari_sysinfo.gemdos_version > TOS4VER ){
81 return( Getcookie(tag, value) );
82 }
83
84 cptr = (COOKIE*)Setexc(0x0168, -1L);
85 if(cptr != NULL) {
86 do {
87 if( cptr->c == tag ){
88 if(cptr->v != 0 ){
89 if( value != NULL ){
90 *value = cptr->v;
91 }
92 return( C_FOUND );
93 }
94 }
95 } while( (cptr++)->c != 0L );
96 }
97 return( C_NOTFOUND );
98}
99
100/*
101
102 a fixed version of realpath() which returns valid
103 paths for TOS which have no U: drive
104
105*/
106
107char *gemdos_realpath(const char * path, char * rpath)
108{
109 char work[PATH_MAX+1];
110 char * r;
111
112 if (rpath == NULL) {
113 return (NULL);
114 }
115
116 // Check if the path is already absolute:
117 if(path[1] == ':'){
118 strcpy(rpath, path);
119 return(rpath);
120 }
121
122 NSLOG(netsurf, INFO, "realpath in: %s\n", path);
123 r = realpath(path, work);
124 if (r != NULL) {
125 unx2dos((const char *)r, rpath);
126 NSLOG(netsurf, INFO, "realpath out: %s\n", rpath);
127 return(rpath);
128 } else {
129 NSLOG(netsurf, INFO, "realpath out: NULL!\n");
130 }
131 return (NULL);
132}
char * realpath(const char *f, char *buf)
Definition: gui.cpp:230
#define NSLOG(catname, level, logmsg, args...)
Definition: log.h:116
char * gemdos_realpath(const char *path, char *rpath)
Definition: osspec.c:107
void init_os_info(void)
Definition: osspec.c:40
int tos_getcookie(long tag, long *value)
Definition: osspec.c:76
#define PATH_MAX
Definition: osspec.c:35
NS_ATARI_SYSINFO atari_sysinfo
Definition: osspec.c:38
Interface to utility string handling.
Definition: osspec.h:22
long v
Definition: osspec.h:24
long c
Definition: osspec.h:23
unsigned short gdos_FSMC
Definition: osspec.h:29
unsigned short small_sfont_pxh
Definition: osspec.h:31
unsigned short medium_sfont_pxh
Definition: osspec.h:32
unsigned short large_sfont_pxh
Definition: osspec.h:33
bool sfont_monospaced
Definition: osspec.h:34
unsigned short gemdos_version
Definition: osspec.h:28
short aes_max_win_title_len
Definition: osspec.h:35
static nserror path(const struct redraw_context *ctx, const plot_style_t *pstyle, const float *p, unsigned int n, const float transform[6])
Plots a path.
Definition: plot.c:821