Skip to content

Commit

Permalink
version 4.0.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
ab25cq committed Apr 28, 2018
1 parent 2b30ac5 commit ba280eb
Show file tree
Hide file tree
Showing 78 changed files with 4,130 additions and 4,126 deletions.
29 changes: 29 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,33 @@

version 4.0.0

スレッドを追加しました。詳しくはThreadクラスの解説を読んでください。

def allocSize(): int でヒープから取得するメモリのサイズを指定できるようになりました。主に拡張ライブラリで使います。

allocatedSize()スペシャルメソッドを追加しました。オブジェクトのヒープから取得したメモリのサイズを返します。主に拡張ライブラリ使うもので特にユーザーは使うことがないでしょう。

headOfmemory()スペシャルメソッドを追加しました。オブジェクトのヒープから取得したメモリの先頭サイズを返します。主に拡張ライブラリで使うもので特にユーザーは使うことがないでしょう。

クラスファイルの仕様が変更されてます。コンパイルされたクラスファイルは再度コンパイルが必要になってます。再コンパイルをお願いします。

UShortのboxingのbugをfix

version 4.0.0

Threads were added. For details, please read the explanation of Thread class.

def allocSize (): int allows you to specify the size of the memory to get from the heap. We mainly use it in extension library.

The allocatedSize () special method was added. Returns the size of the memory retrieved from the heap of the object.
    It mainly uses extended libraries, so users will not use them in particular.

The headOfmemory () special method was added. Returns the starting size of the memory obtained from the heap of the object. It is mainly used for extended libraries, so users will not use them in particular.

The specification of the class file has been changed. Compiled class files need to be recompiled again. Please recompile.

Fixed boxing bug of UShort

version 3.7.6

Multi line stringを入れました。
Expand Down
18 changes: 17 additions & 1 deletion Command.clcl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ include "File.clcl"

class System
{
typedef pid_t int;
typedef wait_status int;
typedef wait_option int;
typedef tcflag_t int;
Expand Down Expand Up @@ -198,6 +197,8 @@ class System

def system(str:String): static native int throws Exception;
def pipe(read_fd:pointer@int, write_fd:pointer@int): static native throws Exception;
def popen(command:String, type:String): static native pointer@FILE throws Exception;
def pclose(stream:pointer@FILE): static native int;
def fork(block_:lambda()): static native pid_t throws Exception;
def dup2(fd1:int, fd2:int): static native int throws Exception;
def execvp(method_name:String, params:List<String>): static native throws Exception;
Expand Down Expand Up @@ -985,6 +986,21 @@ dynamic_class Command
}
}

def popen(command:String, rcode:pointer@int):static String throws Exception {
result := "";
fp:pointer@FILE = popen(command, "r");

while(!feof(fp)) {
buf := Buffer(System.BUFSIZ);
fgets(buf, System.BUFSIZ, fp);
result.append(buf.toString());
}

rcode->int = pclose(fp);

return result;
}

def cd():static {
path := p"\{getenv("HOME")}"
path.chdir();
Expand Down
1 change: 1 addition & 0 deletions Container.clcl
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,7 @@ module MEqualableList
}

def join():String {
println("join2");
return self.join("");
}

Expand Down
39 changes: 15 additions & 24 deletions File.clcl
Original file line number Diff line number Diff line change
Expand Up @@ -164,30 +164,6 @@ class System
def put_fun_to_hash_for_native_method(path:String, fun_name:String, native_method:pointer): static native;
}

class timespec
{
tv_sec: time_t;
tv_nsec: long;

def initialize() {
self.tv_sec = 0;
self.tv_nsec = 0.to_long;
}

def minus(right:timespec):timespec {
result:timespec = new timespec();

result.tv_sec = self.tv_sec - right.tv_sec;
result.tv_nsec = self.tv_nsec - right.tv_nsec;

return result;
}

def toString():String {
return sprintf("%lu.%09lu sec", array { self.tv_sec.toULong, self.tv_nsec.toULong });
}
}

class tm
{
tm_sec:int;
Expand Down Expand Up @@ -823,3 +799,18 @@ class Clover
return ts2.minus(ts1);
}
}


class String
{
def write(file_name:String) {
File.write(file_name, self.toBuffer());
}
}

class Buffer
{
def write(file_name:String) {
File.write(file_name, self);
}
}
83 changes: 83 additions & 0 deletions Fundamental.clcl
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,72 @@ module MWrapperClassBase
}
}

module MOperand
{
def add(right:SELF): SELF {
return self + right;
}

def sub(right:SELF): SELF {
return self - right;
}

def multiply(right:SELF): SELF {
return self * right;
}

def divide(right:SELF): SELF {
return self / right;
}

def mod(right:SELF): SELF {
return self % right;
}

def lshift(right:SELF): SELF {
return self << right;
}

def rshift(right:SELF): SELF {
return self >> right;
}

def and(right:SELF): SELF {
return self & right;
}

def xor(right:SELF): SELF {
return self ^ right;
}

def or(right:SELF): SELF {
return self | right;
}
}

module MOperandFloat
{
def add(right:SELF): SELF {
return self + right;
}

def sub(right:SELF): SELF {
return self - right;
}

def multiply(right:SELF): SELF {
return self * right;
}

def divide(right:SELF): SELF {
return self / right;
}
}

class Byte : unboxing byte
{
include MWrapperClassBase;
include MOperand;

value:byte;

Expand Down Expand Up @@ -326,6 +389,7 @@ class Byte : unboxing byte
class UByte : unboxing ubyte
{
include MWrapperClassBase;
include MOperand;

value:ubyte;

Expand Down Expand Up @@ -361,6 +425,7 @@ class UByte : unboxing ubyte
class Short : unboxing short
{
include MWrapperClassBase;
include MOperand;

value:short;

Expand Down Expand Up @@ -396,6 +461,10 @@ class Short : unboxing short
class UShort : unboxing ushort
{
include MWrapperClassBase;
include MOperand;
def add(right:UShort): UShort {
return self.to_ushort() + right.to_ushort();
}

value:ushort;

Expand Down Expand Up @@ -431,6 +500,7 @@ class UShort : unboxing ushort
class Integer : unboxing int
{
include MWrapperClassBase;
include MOperand;

value:int;

Expand Down Expand Up @@ -472,6 +542,7 @@ class Integer : unboxing int
class UInteger : unboxing uint
{
include MWrapperClassBase;
include MOperand;

value: uint;

Expand Down Expand Up @@ -507,6 +578,7 @@ class UInteger : unboxing uint
class Long : unboxing long
{
include MWrapperClassBase;
include MOperand;

value:long;

Expand Down Expand Up @@ -542,6 +614,7 @@ class Long : unboxing long
class ULong : unboxing ulong
{
include MWrapperClassBase;
include MOperand;

value: ulong;

Expand Down Expand Up @@ -577,6 +650,7 @@ class ULong : unboxing ulong
class Float : unboxing float
{
include MWrapperClassBase;
include MOperandFloat;

value: float;

Expand Down Expand Up @@ -608,6 +682,7 @@ class Float : unboxing float
class Double : unboxing double
{
include MWrapperClassBase;
include MOperandFloat;

value: double;

Expand Down Expand Up @@ -826,4 +901,12 @@ class Bool : unboxing bool
def equals(right:WildCard):bool {
return true;
}

def and(right:Bool):Bool {
return self && right;
}

def or(right:Bool) : Bool {
return self || right;
}
}
9 changes: 6 additions & 3 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ JIT=@JIT@
all: cclover2 clover2 $(INTERPRETER) SortableArray.oclcl
if which ctags > /dev/null; then if test $(OS) = DARWIN; then ctags src/*.c > /dev/null 2>&1; else ctags -R; fi; fi

cclover2: config.h src/compiler.o $(COMMON_OBJS) $(COMPILER_OBJS) $(OBJS) $(JIT_OBJS)
if test $(JIT) = 1; then $(CXX) -o cclover2 src/compiler.o $(COMMON_OBJS) $(COMPILER_OBJS) $(OBJS:src/class_clover_runtime.o=) $(JIT_OBJS) $(CFLAGS) $(LIBS) $(CXXFLAGS); else $(CC) -o cclover2 src/compiler.o $(COMMON_OBJS) $(COMPILER_OBJS) $(OBJS:src/class_clover_runtime.o=) $(CFLAGS) $(LIBS); fi
cclover2: config.h src/compiler.o $(COMMON_OBJS) $(COMPILER_OBJS) $(OBJS) $(JIT_OBJS) $(JIT_RUNTIME_OBJS)
if test $(JIT) = 1; then $(CXX) -o cclover2 src/compiler.o $(COMMON_OBJS) $(COMPILER_OBJS) $(OBJS:src/class_clover_runtime.o=) $(JIT_OBJS) $(JIT_RUNTIME_OBJS) $(CFLAGS) $(LIBS) $(CXXFLAGS); else $(CC) -o cclover2 src/compiler.o $(COMMON_OBJS) $(COMPILER_OBJS) $(OBJS:src/class_clover_runtime.o=) $(CFLAGS) $(LIBS); fi

src/script_ctime.o: config.h src/script_ctime.c
$(CC) -c -o src/script_ctime.o src/script_ctime.c $(CFLAGS:-O3=)
Expand Down Expand Up @@ -288,7 +288,7 @@ permission:
# clean
########################################################
clean:
rm -fR clover2 clover2.dSYM cclover2 cclover2.dSYM iclover2 iclover2.dSYM src/*.o config.log config.status *.stackdump autom4te.cache .DS_Store core.* a.out *.oclcl *.bc *.s *.o *.ocl code/*.ocl code/*.oclcl *.clm a.c src/*.dwo *.ll *.so.1.0.0 *.so *.class src/config.h moveVarDecls.hi moveVarDecls.o moveVarDecls
rm -fR clover2 clover2.dSYM cclover2 cclover2.dSYM iclover2 iclover2.dSYM src/*.o config.log config.status *.stackdump autom4te.cache .DS_Store core.* core a.out *.oclcl *.bc *.s *.o *.ocl code/*.ocl code/*.oclcl *.clm a.c src/*.dwo *.ll *.so.1.0.0 *.so *.class src/config.h moveVarDecls.hi moveVarDecls.o moveVarDecls
(cd examples/; make clean)

distclean: clean
Expand Down Expand Up @@ -390,6 +390,8 @@ test: parser
PWD=`pwd` ./cclover2 code/MapTest.clcl
PWD=`pwd` ./cclover2 code/SystemCallTest.clcl
PWD=`pwd` ./cclover2 code/ReflectionTest.clcl
PWD=`pwd` ./cclover2 code/AllocSize.clcl
PWD=`pwd` ./clover2 code/main.cl

if locale -a | grep ja_JP.utf8; then export LANG="ja_JP_utf8"; export LC_ALL="ja_JP.utf8"; PWD=`pwd` ./clover2 code/char.cl; else export LANG="C.UTF-8"; export LC_ALL="C.UTF-8"; PWD=`pwd` ./clover2 code/char.cl; fi

Expand All @@ -403,4 +405,5 @@ test: parser

PWD=`pwd` ./cclover2 code/reflection.cl && ./clover2 code/reflection.cl
PWD=`pwd` ./cclover2 code/MultiLineString.cl && ./clover2 code/MultiLineString.cl
PWD=`pwd` ./cclover2 code/thread.cl && ./clover2 code/thread.cl

6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# clover2 computer language

[![Build Status](https://travis-ci.org/ab25cq/clover2.svg?branch=master)](https://travis-ci.org/ab25cq/clover2)
version 3.7.6
version 4.0.0

サポートしている機能

Expand Down Expand Up @@ -87,6 +87,8 @@ version 3.7.6
"""
);

11. Threadをサポートします。

詳しくは、https://github.com/ab25cq/clover2/wikiをみてください。
(もしくはrepositoryに含まれるmanualディレクトリ以下のドキュメントを見てください)

Expand Down Expand Up @@ -201,6 +203,8 @@ FEATURES
"""
);

11. Threads are supported.

See clover2 wiki on github (Japanese and English) https://github.com/ab25cq/clover2/wiki

LICENSE is GPL-2.0. see LICENSE file
Expand Down
2 changes: 1 addition & 1 deletion String.clcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include "Reflection.clcl"
include "Thread.clcl"

class PcreOVec
{
Expand Down
Loading

0 comments on commit ba280eb

Please sign in to comment.