allowed class and class extension nesting inside a class

This commit is contained in:
hyunghwan.chung
2018-10-08 06:51:31 +00:00
parent e7265f44bc
commit 9ad9299dea
11 changed files with 193 additions and 73 deletions

View File

@ -4,8 +4,26 @@ class Apex(nil)
class(#limited) Error(Apex)
{
pooldic Code
{
ENOERR := #\E0.
EGENERIC := #\E1.
ENOIMPL := #\E2.
ESYSERR := #\E3.
EINTERN := #\E4.
ESYSMEM := #\E5.
EOOMEM := #\E6.
EINVAL := #\E7.
ENOENT := #\E8.
EPERM := #\E12.
ERANGE := #\E20.
ELIMIT := #\E9999.
## add more items...
}
}
(*
pooldic Error.Code
{
ENOERR := #\E0.
@ -21,8 +39,8 @@ pooldic Error.Code
ERANGE := #\E20.
ELIMIT := #\E9999.
(* add more items... *)
}
## add more items...
} *)
(*pooldic Error.Code2
{

View File

@ -231,6 +231,19 @@ class Socket(Object) from 'sck'
## the internal representation used by various modules. (e.g. sck)
var(#get) handle := -1.
## TODO: generate these family and type from the C header
pooldic Family
{
INET := 2.
INET6 := 10.
}
pooldic Type
{
STREAM := 1.
DGRAM := 2.
}
method(#primitive) open(family, type, proto).
## map the open primitive again with a different name for strict internal use only.
## this method is supposed to be used to handle an accepted socket in server sockets.
@ -284,19 +297,6 @@ class Socket(Object) from 'sck'
}
}
(* TODO: generate these family and type from the C header *)
pooldic Socket.Family
{
INET := 2.
INET6 := 10.
}
pooldic Socket.Type
{
STREAM := 1.
DGRAM := 2.
}
class SyncSocket(Socket)
{
var iosem, tmoutsem, sg.

View File

@ -12,6 +12,20 @@ class System(Apex)
{
var(#class) asyncsg.
pooldic Log
{
## -----------------------------------------------------------
## defines log levels
## these items must follow defintions in moo.h
## -----------------------------------------------------------
DEBUG := 1.
INFO := 2.
WARN := 4.
ERROR := 8.
FATAL := 16.
}
method(#class) addAsyncSemaphore: sem
{
^self.asyncsg addSemaphore: sem
@ -124,24 +138,7 @@ class System(Apex)
s signalAfterSecs: secs nanosecs: nanosecs.
s wait.
}
}
pooldic System.Log
{
## -----------------------------------------------------------
## defines log levels
## these items must follow defintions in moo.h
## -----------------------------------------------------------
DEBUG := 1.
INFO := 2.
WARN := 4.
ERROR := 8.
FATAL := 16.
}
extend System
{
## the following methods may not look suitable to be placed
## inside a system dictionary. but they are here for quick and dirty
## output production from the moo code.

View File

@ -15,6 +15,38 @@ class X11(Object) from 'x11'
var event_loop_sem, event_loop_proc.
var llevent_blocks.
class Exception(System.Exception)
{
}
class Point(Object)
{
var(#get,#set) x := 0, y := 0.
}
class Dimension(Object)
{
var(#get,#set) width := 0, height := 0.
}
class Rectangle(Object)
{
var(#get,#set)
x := 0,
y := 0,
width := 0,
height := 0.
}
extend Point
{
method print
{
x dump.
y dump.
}
}
method(#primitive,#liberal) _open_display(name).
method(#primitive) _close_display.
method(#primitive) _get_fd.
@ -47,29 +79,6 @@ class X11(Object) from 'x11'
}
}
class X11.Exception(System.Exception)
{
}
class X11.Point(Object)
{
var(#get,#set) x := 0, y := 0.
}
class X11.Dimension(Object)
{
var(#get,#set) width := 0, height := 0.
}
class X11.Rectangle(Object)
{
var(#get,#set)
x := 0,
y := 0,
width := 0,
height := 0.
}
## ---------------------------------------------------------------------------
## Event
## ---------------------------------------------------------------------------