From: John Hodge Date: Wed, 14 May 2014 09:42:51 +0000 (+0800) Subject: Merge branch 'master' of git://github.com/thepowersgang/acess2 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=bc856d707899a00153bb1575f1c05867177dfe41;hp=f011187bed9e3093bc38f5793db4c66d6af3e324;p=tpg%2Facess2.git Merge branch 'master' of git://github.com/thepowersgang/acess2 --- diff --git a/BuildConf/x86/Makefile.cfg b/BuildConf/x86/Makefile.cfg index 6559146e..3989363a 100644 --- a/BuildConf/x86/Makefile.cfg +++ b/BuildConf/x86/Makefile.cfg @@ -2,14 +2,14 @@ # Acess2 Build Configuration # -CC = i586-elf-gcc -CXX = i586-elf-g++ +CC = i686-elf-gcc +CXX = i686-elf-g++ #CC = clang -m32 -LD = i586-elf-ld +LD = i686-elf-ld #CC = gcc #LD = ld AS = nasm -#OBJDUMP = i586-elf-objdump +#OBJDUMP = i686-elf-objdump OBJDUMP = objdump RM = @rm -f STRIP = strip diff --git a/Externals/core.mk b/Externals/core.mk index bc7a5b80..6c23a33b 100644 --- a/Externals/core.mk +++ b/Externals/core.mk @@ -73,7 +73,14 @@ $(DIR)/%: patches/% PATCHED_FILES := $(addprefix $(DIR)/,$(PATCHES)) -_patch: $(DIR) $(PATCHED_FILES) $(wildcard patches/UNIFIED.patch) ifneq ($(wildcard patches/UNIFIED.patch),) +$(DIR)/_unified_applied: $(wildcard patches/UNIFIED.patch) cd $(DIR) && patch -p1 < ../patches/UNIFIED.patch + touch $@ +UNIFIED_TARGET=$(DIR)/_unified_applied +else +UNIFIED_TARGET= endif + +_patch: $(DIR) $(PATCHED_FILES) $(UNIFIED_TARGET) + diff --git a/Externals/curl/Makefile b/Externals/curl/Makefile new file mode 100644 index 00000000..e0c5eefa --- /dev/null +++ b/Externals/curl/Makefile @@ -0,0 +1,14 @@ +# +# Acess2 External: libcurl +# - Makefile and patches by John Hodge (thePowersGang) +# + +DEPS := +TARBALL_PATTERN := curl-*.tar.bz2 +TARBALL_TO_DIR_L := %.tar.bz2 +TARBALL_TO_DIR_R := % +PATCHES := config.sub +CONFIGURE_ARGS = LIBS=-lpsocket + +include ../common_automake.mk + diff --git a/Externals/curl/patches/config.sub.patch b/Externals/curl/patches/config.sub.patch new file mode 100644 index 00000000..83801547 --- /dev/null +++ b/Externals/curl/patches/config.sub.patch @@ -0,0 +1,7 @@ +--- bochs-2.6.2_orig/config.sub 2013-06-17 11:39:39.670720710 +0800 ++++ bochs-2.6.2/config.sub 2013-06-17 11:48:09.149384231 +0800 +@@ -1356,2 +1356,3 @@ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ ++ | -acess2 \ + | -aos* | -aros* \ + diff --git a/Externals/netsurf/Makefile b/Externals/netsurf/Makefile index d4140c3f..5b69f5d8 100644 --- a/Externals/netsurf/Makefile +++ b/Externals/netsurf/Makefile @@ -12,7 +12,12 @@ NOBDIR = yes include ../core.mk -_build: - cd $(BDIR) && CC=$(HOST)-gcc TARGET=sdl make +.PHONY: _check_local_deps + +_build: _check_local_deps + cd $(BDIR) && CC=$(HOST)-gcc TARGET=framebuffer make + +_check_local_deps: + @gperf --help >/dev/null || (echo "ERROR: netsurf's build system requires gperf"; false) diff --git a/Externals/netsurf/patches/UNIFIED.patch b/Externals/netsurf/patches/UNIFIED.patch index e9456313..f59d7c17 100644 --- a/Externals/netsurf/patches/UNIFIED.patch +++ b/Externals/netsurf/patches/UNIFIED.patch @@ -108,3 +108,15 @@ diff -ru .orig/netsurf-full-3.0//src/libparserutils-0.1.2/src/utils/vector.c net { if (vector == NULL || vector->current_item < 0) return NULL; +diff -ru .orig/netsurf-full-3.0//src/libnsfb-0.1.2/Makefile netsurf-full-3.0//src/libnsfb-0.1.0/Makefile +--- .orig/netsurf-full-3.0//src/libnsfb-0.1.0/Makefile 2013-04-20 02:06:57.000000000 +0800 ++++ netsurf-full-3.0//src/libnsfb-0.1.0/Makefile 2013-07-01 22:22:45.246689992 +0800 +@@ -31,5 +31,5 @@ + # surfaces not detectable via pkg-config + NSFB_ABLE_AVAILABLE := no +-NSFB_LINUX_AVAILABLE := yes ++NSFB_LINUX_AVAILABLE := no + + # Flags and setup for each support library + NSFB_ABLE_AVAILABLE := no + diff --git a/Usermode/Applications/axwin4_src/Notes.txt b/Usermode/Applications/axwin4_src/Notes.txt new file mode 100644 index 00000000..638f0db9 --- /dev/null +++ b/Usermode/Applications/axwin4_src/Notes.txt @@ -0,0 +1,41 @@ +Layers: + +IPC / Client management + +Renderers +Window Management +> "WM_CreateWindow(Parent, Class, Name)" +Window Drawing +> "WD_Fill" +> "WD_Blit" +> "WD_LockSurface" +> "WD_UnlockSurface" +Decorations +> ".InitWindow" +> ".Render" ++ "WM_SetBorder" +Compositing +> Dirty rectangling, use 2DCmd to selectively blit +> Request kernel/server buffers if possible + + +Server-side rendering primitives: + # Apply to regions, rendered in fixed order, each has an ID +> Auto-scaling bitmaps + - Control backed by an image with three five regions per axis + Edge Fixed, Fill, Center Fixed, Fill, Edge Fixed + - Definition is via two pixel counts (edge width, fill width), rest is derived + - Command to switch backing image to another already provided +> Tiling bitmaps + filled rects +> Text (single line) +> Canvas (Takes drawing commands, draws to internal buffer) +> Shared buffer (of an unspecified pixel format) + +=== Config options === +- Root App +- Display device (- = stdout) +- Keyboard device (- = stdin) +- Mouse device +- Pipe suffix, port number, etc. +- Key bindings + diff --git a/Usermode/Applications/axwin4_src/Server/IWindow.cpp b/Usermode/Applications/axwin4_src/Server/IWindow.cpp new file mode 100644 index 00000000..4243e33a --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/IWindow.cpp @@ -0,0 +1,15 @@ +/* + * + */ +#include + +namespace AxWin { + + +IWindow::IWindow(const std::string &name): + m_name(name) +{ +} + +} // namespace AxWin + diff --git a/Usermode/Applications/axwin4_src/Server/Makefile b/Usermode/Applications/axwin4_src/Server/Makefile new file mode 100644 index 00000000..47a936c4 --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/Makefile @@ -0,0 +1,8 @@ + +include ../../Makefile.cfg + +CPPFLAGS := -Iinclude/ +OBJ := IWindow.o +BIN := AxWinServer + +include ../../Makefile.tpl diff --git a/Usermode/Applications/axwin4_src/Server/include/IRegion.hpp b/Usermode/Applications/axwin4_src/Server/include/IRegion.hpp new file mode 100644 index 00000000..8208aa57 --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/include/IRegion.hpp @@ -0,0 +1,32 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * IRegion.hpp + * - Representation of a primitive region in a window (part of the window render list) + */ +#ifndef _IREGION_HPP_ +#define _IREGION_HPP_ + +#include +#include +#include "CRect.hpp" + +namespace AxWin { + +class IRegion +{ +protected: + CWindow& m_parentWindow; +public: + virtual IRegion(CWindow& parent, const ::AxWin::Rect& position); + virtual ~IRegion(); + + virtual void Redraw(const ::AxWin::Rect& area) = 0; + virtual bool SetAttr(unsigned int Index, const IPCAttrib& Value) = 0; +}; + +}; + +#endif + diff --git a/Usermode/Applications/axwin4_src/Server/include/IVideo.hpp b/Usermode/Applications/axwin4_src/Server/include/IVideo.hpp new file mode 100644 index 00000000..aa4fc52b --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/include/IVideo.hpp @@ -0,0 +1,28 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * IVideo.hpp + * - Graphics backend abstraction + */ +#ifndef _IVIDEO_HPP_ +#define _IVIDEO_HPP_ + +namespace AxWin { + +class IVideo +{ +public: + virtual ~IVideo(); + + // Allocate a new hardware surface + IHWSurface& AllocateHWSurface(uint16_t Width, uint16_t Height); + + // Request redraw of backbuffer + void Flip(); +}; + +}; + +#endif + diff --git a/Usermode/Applications/axwin4_src/Server/include/IWindow.hpp b/Usermode/Applications/axwin4_src/Server/include/IWindow.hpp new file mode 100644 index 00000000..6d91cc19 --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/include/IWindow.hpp @@ -0,0 +1,35 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * IWindow.hpp + * - Window abstract base class + */ +#ifndef _IWINDOW_HPP_ +#define _IWINDOW_HPP_ + +#include +#include +#include "CRect.hpp" + +namespace AxWin { + +class IWindow +{ +public: + virtual IWindow(const ::std::string &name); + virtual ~IWindow(); + + virtual void Repaint() = 0; + + virtual void MouseButton(int ButtonID, int X, int Y, bool Down); + virtual void MouseMove(int NewX, int NewY); + virtual void KeyEvent(uint32_t Scancode, const ::std::string &Translated, bool Down); +protected: + const ::std::string m_name; +}; + +} // namespace AxWin + +#endif + diff --git a/Usermode/Applications/axwin4_src/Server/main.cpp b/Usermode/Applications/axwin4_src/Server/main.cpp new file mode 100644 index 00000000..3953e07c --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/main.cpp @@ -0,0 +1,41 @@ +/* + */ +#include +#include +#include + +using namespace AxWin; + +// === CODE === +int main(int argc, char *argv[]) +{ + // - Load configuration (from file and argv) + // - Open graphics + Graphics::Open(/*config.m_displayDevice*/); + // - Open input + // - Initialise compositor structures + // - Prepare global hotkeys + // - Bind IPC channels + // - Start root child process (from config) + + // - Event loop + for( ;; ) + { + int nfd = 0; + fd_set rfds; + + Input::FillSelect(&nfd, &rfds); + IPC::FillSelect(&nfd, &rfds); + + // TODO: Timer events + int64_t timeout = Timing::GetTimeToNextEvent(); + int rv = ::_SysSelect(nfd, &rfds, NULL, &rfds, NULL, 0); + + Timing::CheckEvents(); + + Input::HandleSelect(&rfds); + IPC::HandleSelect(&rfds); + } + return 0; +} + diff --git a/Usermode/Libraries/libc.so_src/ctype.c b/Usermode/Libraries/libc.so_src/ctype.c index d5a5e97a..18a199c6 100644 --- a/Usermode/Libraries/libc.so_src/ctype.c +++ b/Usermode/Libraries/libc.so_src/ctype.c @@ -22,23 +22,40 @@ int isalnum(int ch) { return isalpha(ch) || isdigit(ch); } -int toupper(int ch) { - if('a'<=ch && ch <='z') - return ch - 'a' + 'A'; - return ch; +int isxdigit(int ch) { + if('0'<=ch&&ch<='9') return 1; + if('a'<=ch&&ch<='f') return 1; + if('F'<=ch&&ch<='F') return 1; + return 0; } -int tolower(int ch) { - if('A'<=ch && ch <='Z') - return ch - 'A' + 'a'; - return ch; + +int isupper(int ch) { + if('A'<=ch && ch <='Z') return 1; + return 0; +} + +int islower(int ch) { + if('a'<=ch && ch <='z') return 1; + return 0; +} + +int ispunct(int ch) { + if( isprint(ch) && !isspace(ch) && !isalnum(ch) ) + return 1; + return 0; } int isprint(int ch ) { - if( ch < ' ' ) return 0; - if( ch > 'z' ) return 0; + if( ' ' <= ch && ch <= 'z' ) return 1; return 1; } +int isgraph(int ch) { + // Anything but space + if( ' ' < ch && ch <= 'z' ) return 1; + return 0; +} + int isspace(int ch) { if(ch == ' ') return 1; if(ch == '\t') return 1; @@ -47,12 +64,17 @@ int isspace(int ch) { return 0; } -int isxdigit(int ch) { - if('0'<=ch&&ch<='9') return 1; - if('a'<=ch&&ch<='f') return 1; - if('F'<=ch&&ch<='F') return 1; - return 0; +int toupper(int ch) { + if('a'<=ch && ch <='z') + return ch - 'a' + 'A'; + return ch; } +int tolower(int ch) { + if('A'<=ch && ch <='Z') + return ch - 'A' + 'a'; + return ch; +} + // C99 int isblank(int ch) { diff --git a/Usermode/Libraries/libc.so_src/errno.c b/Usermode/Libraries/libc.so_src/errno.c index d651ccc6..f5a142a8 100644 --- a/Usermode/Libraries/libc.so_src/errno.c +++ b/Usermode/Libraries/libc.so_src/errno.c @@ -51,7 +51,12 @@ EXPORT char *strerror(int errnum) case EFBIG: return "File too big"; case E2BIG: return "Value too big"; case EALREADY: return "Operation was no-op"; + case ENOSPC: return "No space left on the device"; + case EAFNOSUPPORT: return "Address family not supported"; + case EADDRINUSE: return "Address already in use"; + case ETIMEDOUT: return "Operation timed out"; + case EINTERNAL: return "Internal error"; } _SysDebug("strerror: errnum=%i unk", errnum); diff --git a/Usermode/Libraries/libc.so_src/include_exp/ctype.h b/Usermode/Libraries/libc.so_src/include_exp/ctype.h index 75e4ce88..69067e87 100644 --- a/Usermode/Libraries/libc.so_src/include_exp/ctype.h +++ b/Usermode/Libraries/libc.so_src/include_exp/ctype.h @@ -14,21 +14,27 @@ extern "C" { extern int isalpha(int ch); extern int isdigit(int ch); - extern int isalnum(int ch); +extern int isxdigit(int ch); -extern int toupper(int ch); -extern int tolower(int ch); +extern int islower(int ch); +extern int isupper(int ch); +extern int ispunct(int ch); extern int isprint(int ch); +extern int isgraph(int ch); extern int isspace(int ch); -extern int isxdigit(int ch); +extern int iscntrl(int ch); // C99 extern int isblank(int ch); +// Conversions +extern int toupper(int ch); +extern int tolower(int ch); + #ifdef __cplusplus } #endif diff --git a/Usermode/Libraries/libc.so_src/include_exp/errno.enum.h b/Usermode/Libraries/libc.so_src/include_exp/errno.enum.h index 5813cc56..be8c882a 100755 --- a/Usermode/Libraries/libc.so_src/include_exp/errno.enum.h +++ b/Usermode/Libraries/libc.so_src/include_exp/errno.enum.h @@ -30,12 +30,15 @@ enum libc_eErrorNumbers { EAGAIN, // Try again EALREADY, // Operation was a NOP + ENOSPC, // (POSIX) No space left on device EFBIG, // File too large E2BIG, // Argument list too large // psockets EAFNOSUPPORT, + EADDRINUSE, // Specified addres is already in use + ETIMEDOUT, EINTERNAL // Internal Error }; diff --git a/Usermode/Libraries/libc.so_src/include_exp/stdio.h b/Usermode/Libraries/libc.so_src/include_exp/stdio.h index ed1fce58..b2cb8574 100644 --- a/Usermode/Libraries/libc.so_src/include_exp/stdio.h +++ b/Usermode/Libraries/libc.so_src/include_exp/stdio.h @@ -94,7 +94,7 @@ extern FILE *open_memstream(char **bufferptr, size_t *lengthptr); extern FILE *fdopen(int fd, const char *modes); extern FILE *tmpfile(void); extern int fclose(FILE *fp); -extern void fflush(FILE *fp); +extern int fflush(FILE *fp); extern off_t ftell(FILE *fp); extern off_t ftello(FILE *fp); extern int fseek(FILE *fp, long int amt, int whence); diff --git a/Usermode/Libraries/libc.so_src/include_exp/string.h b/Usermode/Libraries/libc.so_src/include_exp/string.h index 7ef1bc7a..028ed27e 100644 --- a/Usermode/Libraries/libc.so_src/include_exp/string.h +++ b/Usermode/Libraries/libc.so_src/include_exp/string.h @@ -29,6 +29,7 @@ extern char *strrchr(const char *str, int character); extern char *strstr(const char *str1, const char *str2); extern size_t strcspn(const char *haystack, const char *reject); extern size_t strspn(const char *haystack, const char *accept); +extern char *strpbrk(const char *haystack, const char *accept); extern char *strtok(char *str, const char *delim); extern char *strtok_r(char *str, const char *delim, char **saveptr); diff --git a/Usermode/Libraries/libc.so_src/stdio.c b/Usermode/Libraries/libc.so_src/stdio.c index 1bb90cd9..7969f4c4 100644 --- a/Usermode/Libraries/libc.so_src/stdio.c +++ b/Usermode/Libraries/libc.so_src/stdio.c @@ -374,22 +374,23 @@ int _fflush_int(FILE *fp) return ret; } -EXPORT void fflush(FILE *fp) +EXPORT int fflush(FILE *fp) { if( !fp || fp->FD == FD_NOTOPEN ) - return ; + return EBADF; // Nothing to do for memory files if( fp->FD == FD_MEMFILE ) - return ; + return 0; // Memory streams, update pointers if( fp->FD == FD_MEMSTREAM ) { *fp->BufPtr = fp->Buffer; *fp->LenPtr = fp->BufferPos; - return ; + return 0; } _fflush_int(fp); + return 0; } EXPORT void clearerr(FILE *fp) diff --git a/Usermode/Libraries/libc.so_src/string.c b/Usermode/Libraries/libc.so_src/string.c index aa79ec96..0757c24a 100644 --- a/Usermode/Libraries/libc.so_src/string.c +++ b/Usermode/Libraries/libc.so_src/string.c @@ -369,6 +369,19 @@ EXPORT size_t strspn(const char *haystack, const char *accept) return ret; } +EXPORT char *strpbrk(const char *haystack, const char *accept) +{ + while( *haystack ) + { + for( int i = 0; accept[i]; i ++ ) + { + if( accept[i] == *haystack ) + return (char*)haystack; + } + } + return NULL; +} + char *strtok(char *str, const char *delim) { static char *__saveptr; diff --git a/Usermode/Libraries/libposix.so_src/include_exp/endian.h b/Usermode/Libraries/libposix.so_src/include_exp/endian.h new file mode 100644 index 00000000..a70ec0d7 --- /dev/null +++ b/Usermode/Libraries/libposix.so_src/include_exp/endian.h @@ -0,0 +1,11 @@ +/* + */ +#ifndef _LIBPOSIX_ENDIAN_H_ +#define _LIBPOSIX_ENDIAN_H_ + +#define __LITTLE_ENDIAN 0 +#define __BIG_ENDIAN 0 +#define __BYTE_ORDER __LITTLE_ENDIAN + +#endif + diff --git a/Usermode/Libraries/libposix.so_src/include_exp/regex.h b/Usermode/Libraries/libposix.so_src/include_exp/regex.h new file mode 100644 index 00000000..a830286c --- /dev/null +++ b/Usermode/Libraries/libposix.so_src/include_exp/regex.h @@ -0,0 +1,36 @@ +/* + * Acess2 POSIX Emulation Library + * - By John Hodge (thePowersGang) + * + * regex.h + * - POSIX regular expression support + */ +#ifndef _LIBPOSIX_REGEX_H_ +#define _LIBPOSIX_REGEX_H_ + +typedef struct { + void *unused; +} regex_t; + +typedef size_t regoff_t; + +typedef struct { + regoff_t rm_so; + regoff_t rm_eo; +} regmatch_t; + +extern int regcomp(regex_t *preg, const char *regex, int cflags); +extern int regexec(const regex_t *preg, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags); +extern size_t regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size); +extern void regfree(regex_t *preg); + +enum { + REG_BADBR = 1, + REG_BADPAT, + REG_BADRPT, +}; + + +#endif + + diff --git a/Usermode/Libraries/libposix.so_src/include_exp/strings.h b/Usermode/Libraries/libposix.so_src/include_exp/strings.h new file mode 100644 index 00000000..9c4114d9 --- /dev/null +++ b/Usermode/Libraries/libposix.so_src/include_exp/strings.h @@ -0,0 +1,14 @@ +/* + * Acess2 POSIX Emulation Library + * - By John Hodge (thePowersGang) + * + * strings.h + * - BSD's verison of string.h + */ +#ifndef _LIBPOSIX_STRINGS_H_ +#define _LIBPOSIX_STRINGS_H_ + + + +#endif + diff --git a/Usermode/Libraries/libposix.so_src/include_exp/unistd.h b/Usermode/Libraries/libposix.so_src/include_exp/unistd.h index 6519b3b7..10c4779f 100644 --- a/Usermode/Libraries/libposix.so_src/include_exp/unistd.h +++ b/Usermode/Libraries/libposix.so_src/include_exp/unistd.h @@ -71,6 +71,10 @@ extern int chmod(const char *path, mode_t mode); extern int unlink(const char *pathname); +#define F_OK 00 +#define R_OK 04 +#define W_OK 02 +#define X_OK 01 extern int access(const char *pathname, int mode); extern pid_t setsid(void); @@ -93,6 +97,7 @@ extern unsigned int alarm(unsigned int seconds); extern char *crypt(const char *key, const char *salt); // - pty.c +extern int isatty(int fd); extern char *ttyname(int fd); extern int ttyname_r(int fd, char *buf, size_t buflen); diff --git a/Usermode/Libraries/libposix.so_src/unistd.c b/Usermode/Libraries/libposix.so_src/unistd.c index 3af7bcbc..dca29630 100644 --- a/Usermode/Libraries/libposix.so_src/unistd.c +++ b/Usermode/Libraries/libposix.so_src/unistd.c @@ -292,3 +292,21 @@ int ttyname_r(int fd, char *buf, size_t buflen) return ENOTIMPL; } + +int isatty(int fd) +{ + if( fd < 0 ) { + errno = EBADF; + return 0; + } + + int type = _SysIOCtl(fd, DRV_IOCTL_TYPE, NULL); + if( type == -1 ) + return 0; + if( type != DRV_TYPE_TERMINAL ) { + errno = ENOTTY; + // NOTE: Pre POSIX 2001, EINVAL was returned + return 0; + } + return 1; +}