Merge branch 'master' of git://github.com/thepowersgang/acess2
authorJohn Hodge <[email protected]>
Wed, 14 May 2014 09:42:51 +0000 (17:42 +0800)
committerJohn Hodge <[email protected]>
Wed, 14 May 2014 09:42:51 +0000 (17:42 +0800)
26 files changed:
BuildConf/x86/Makefile.cfg
Externals/core.mk
Externals/curl/Makefile [new file with mode: 0644]
Externals/curl/patches/config.sub.patch [new file with mode: 0644]
Externals/netsurf/Makefile
Externals/netsurf/patches/UNIFIED.patch
Usermode/Applications/axwin4_src/Notes.txt [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/IWindow.cpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/Makefile [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/include/IRegion.hpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/include/IVideo.hpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/include/IWindow.hpp [new file with mode: 0644]
Usermode/Applications/axwin4_src/Server/main.cpp [new file with mode: 0644]
Usermode/Libraries/libc.so_src/ctype.c
Usermode/Libraries/libc.so_src/errno.c
Usermode/Libraries/libc.so_src/include_exp/ctype.h
Usermode/Libraries/libc.so_src/include_exp/errno.enum.h
Usermode/Libraries/libc.so_src/include_exp/stdio.h
Usermode/Libraries/libc.so_src/include_exp/string.h
Usermode/Libraries/libc.so_src/stdio.c
Usermode/Libraries/libc.so_src/string.c
Usermode/Libraries/libposix.so_src/include_exp/endian.h [new file with mode: 0644]
Usermode/Libraries/libposix.so_src/include_exp/regex.h [new file with mode: 0644]
Usermode/Libraries/libposix.so_src/include_exp/strings.h [new file with mode: 0644]
Usermode/Libraries/libposix.so_src/include_exp/unistd.h
Usermode/Libraries/libposix.so_src/unistd.c

index 6559146..3989363 100644 (file)
@@ -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
index bc7a5b8..6c23a33 100644 (file)
@@ -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 (file)
index 0000000..e0c5eef
--- /dev/null
@@ -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 (file)
index 0000000..8380154
--- /dev/null
@@ -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* \
+
index d4140c3..5b69f5d 100644 (file)
@@ -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)
 
 
index e945631..f59d7c1 100644 (file)
@@ -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 (file)
index 0000000..638f0db
--- /dev/null
@@ -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 (file)
index 0000000..4243e33
--- /dev/null
@@ -0,0 +1,15 @@
+/*
+ * 
+ */
+#include <IWindow.hpp>
+
+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 (file)
index 0000000..47a936c
--- /dev/null
@@ -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 (file)
index 0000000..8208aa5
--- /dev/null
@@ -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 <string>
+#include <vector>
+#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 (file)
index 0000000..aa4fc52
--- /dev/null
@@ -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 (file)
index 0000000..6d91cc1
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Acess2 GUI v4
+ * - By John Hodge (thePowersGang)
+ *
+ * IWindow.hpp
+ * - Window abstract base class
+ */
+#ifndef _IWINDOW_HPP_
+#define _IWINDOW_HPP_
+
+#include <string>
+#include <vector>
+#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 (file)
index 0000000..3953e07
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ */
+#include <ipc.hpp>
+#include <input.hpp>
+#include <timing.hpp>
+
+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;
+}
+
index d5a5e97..18a199c 100644 (file)
@@ -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) {
index d651ccc..f5a142a 100644 (file)
@@ -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);
index 75e4ce8..69067e8 100644 (file)
@@ -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
index 5813cc5..be8c882 100755 (executable)
@@ -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
 };
index ed1fce5..b2cb857 100644 (file)
@@ -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);
index 7ef1bc7..028ed27 100644 (file)
@@ -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);
index 1bb90cd..7969f4c 100644 (file)
@@ -374,22 +374,23 @@ int _fflush_int(FILE *fp)
        return ret;\r
 }\r
 \r
-EXPORT void fflush(FILE *fp)\r
+EXPORT int fflush(FILE *fp)\r
 {\r
        if( !fp || fp->FD == FD_NOTOPEN )\r
-               return ;\r
+               return EBADF;\r
        \r
        // Nothing to do for memory files\r
        if( fp->FD == FD_MEMFILE )\r
-               return ;\r
+               return 0;\r
        // Memory streams, update pointers\r
        if( fp->FD == FD_MEMSTREAM ) {\r
                *fp->BufPtr = fp->Buffer;\r
                *fp->LenPtr = fp->BufferPos;\r
-               return ;\r
+               return 0;\r
        }\r
        \r
        _fflush_int(fp);\r
+       return 0;\r
 }\r
 \r
 EXPORT void clearerr(FILE *fp)\r
index aa79ec9..0757c24 100644 (file)
@@ -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 (file)
index 0000000..a70ec0d
--- /dev/null
@@ -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 (file)
index 0000000..a830286
--- /dev/null
@@ -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 (file)
index 0000000..9c4114d
--- /dev/null
@@ -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
+
index 6519b3b..10c4779 100644 (file)
@@ -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);
 
index 3af7bcb..dca2963 100644 (file)
@@ -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;
+}

UCC git Repository :: git.ucc.asn.au