Skip to content

Commit

Permalink
version 4.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ab25cq committed Jul 3, 2018
1 parent 6b2d933 commit 54651cf
Show file tree
Hide file tree
Showing 44 changed files with 913 additions and 127 deletions.
2 changes: 1 addition & 1 deletion CGI.clcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include "SystemCalls.clcl"
include "CLibrary.clcl"

class System
{
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@

version 4.5.0

Cに対するブリッジを入れました。関数と定数が取り込めます。

Bufferクラスはpointerクラスにunboxingされます。

version 4.5.0

I put a bridge for C. Functions and constants can be imported.

Buffer class is unboxing to pointer class

version 4.2.7

String.inesrtのバグを修正しました。
Expand Down
6 changes: 6 additions & 0 deletions CLibrary.clcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include "SystemCalls.clcl"

class System
{
def strcmp(x:pointer, y:pointer): int from libc.so.6
}
2 changes: 2 additions & 0 deletions ExtensionClassTest.cl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ExtensionClassTest.main();

22 changes: 22 additions & 0 deletions ExtensionClassTest.clcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

class ExtensionClassTest
{
ABC: static int from ExtensionTest.h

def getValue(x:int, y:int): int from libExtensionTest.so;
def getValue2(x:long, y:long): long from libExtensionTest.so;
def getStr(x:pointer, y:pointer): pointer@alloc from libExtensionTest.so;

def main():static {
Clover.test("Extension Test1", getValue(1, 2) == 3);
Clover.test("Extension Test2", getValue2(1l, 2l) == 3l);

str := getStr(b"ABC", b"DEF");

Clover.test("Extension Test3", strcmp(str, b"ABCDEF") == 0);

free(str);

Clover.test("Extension Test4", ABC == 123);
}
}
27 changes: 27 additions & 0 deletions ExtensionTest.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int getValue(int x, int y)
{
return x + y;
}

long getValue2(long x, long y)
{
return x + y;
}

char* getStr(char* x, char* y)
{
size_t len = strlen(x) + strlen(y) + 1;

char* result = calloc(1, len);

strcpy(result, x);
strcat(result, y);

return result;
}


6 changes: 6 additions & 0 deletions ExtensionTest.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef EXTENSION_TEST_H
#define EXTENSION_TEST_H

#define ABC 123

#endif
7 changes: 5 additions & 2 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ JIT=@JIT@
##########################################################
# main
##########################################################
all: cclover2 clover2 $(INTERPRETER) SortableArray.oclcl libclover2.so.1.0.0 jitcompile
all: cclover2 clover2 $(INTERPRETER) SortableArray.oclcl libclover2.so.1.0.0 jit-compile
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) $(JIT_RUNTIME_OBJS)
Expand Down Expand Up @@ -68,7 +68,7 @@ $(OBJ): src/*.h Makefile configure
#########################################################
# JIT compile
#########################################################
jitcompile:
jit-compile:
if test -e Clover.bc; then ./bclover2 Clover.bc; fi
if test -e PcreOVec.bc; then ./bclover2 PcreOVec.bc; fi
if test -e System.bc; then ./bclover2 System.bc; fi
Expand Down Expand Up @@ -553,6 +553,8 @@ test: parser

if test `uname` != Darwin; then gcc -shared -Wl,-soname=libExtTest.so.1 -o libExtTest.so.1.0.0 -I src/ -I . -I/usr/local/include -fPIC ext/hello.c; ln -fs libExtTest.so.1.0.0 libExtTest.so; PWD=`pwd` ./cclover2 ext.clcl && PWD=`pwd` ./clover2 ext.cl; fi

if test `uname` != Darwin; then gcc -shared -Wl,-soname=libExtensionTest.so.1 -o libExtensionTest.so.1.0.0 -fPIC ExtensionTest.c; ln -fs libExtensionTest.so.1.0.0 libExtensionTest.so; PWD=`pwd` ./cclover2 ExtensionClassTest.clcl && PWD=`pwd` ./clover2 ExtensionClassTest.cl; fi

PWD=`pwd` ./cclover2 code/getopt.cl && ./clover2 code/getopt.cl -a -b -c aaa xxxx gggg
PWD=`pwd` ./cclover2 code/getopt_long.cl && ./clover2 code/getopt_long.cl -a --break --clear aaa --delete=ggg xxx yyy zzz
PWD=`pwd` ./cclover2 code/getopt_long_only.cl && ./clover2 code/getopt_long_only.cl -add --break --clear aaa --delete=ggg xxx yyy zzz
Expand All @@ -566,6 +568,7 @@ test: parser
PWD=`pwd` ./cclover2 code/CloneTest.clcl
PWD=`pwd` ./cclover2 code/thread.cl
PWD=`pwd` ./cclover2 code/SocketTest.clcl
PWD=`pwd` ./cclover2 code/PointerTest3.clcl


PWD=`pwd` ./clover2 code/parser.cl
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# clover2 computer language

version 4.2.7
version 4.5.0

サポートしている機能

Expand Down
8 changes: 8 additions & 0 deletions code/PointerTest3.clcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class PointerTest3
{
def main(): static {
b:pointer = b"ABCDEF";

Clover.test("Pointer Test3", b->byte == 'A' && (b+1)->byte == 'B' && (b+2)->byte == 'C' && (b+3)->byte =='D');
}
}
5 changes: 5 additions & 0 deletions code/main.cl
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,8 @@ println("Omit Block Param Test");
OmitBlockParamTest.main();
println("ObjectCast");
ObjectCast.main();
println("ExtensionClassTest");
ExtensionClassTest.main();
println("PointerTest3");
PointerTest3.main();

47 changes: 47 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -4219,6 +4219,53 @@ fi
ac_cv_lib_rt=ac_cv_lib_rt_main
ac_fn_c_check_header_mongrel "$LINENO" "avcall.h" "ac_cv_header_avcall_h" "$ac_includes_default"
if test "x$ac_cv_header_avcall_h" = xyes; then :
$as_echo "#define HAVE_AVCALL_H 1" >>confdefs.h
else
exit
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lavcall" >&5
$as_echo_n "checking for main in -lavcall... " >&6; }
if ${ac_cv_lib_avcall_main+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lavcall $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
return main ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_avcall_main=yes
else
ac_cv_lib_avcall_main=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_avcall_main" >&5
$as_echo "$ac_cv_lib_avcall_main" >&6; }
if test "x$ac_cv_lib_avcall_main" = xyes; then :
LIBS="$LIBS -lavcall";
else
exit
fi
ac_cv_lib_avcall=ac_cv_lib_avcall_main
if which clang > /dev/null
Expand Down
3 changes: 3 additions & 0 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ AC_HAVE_LIBRARY(pcre, [ LIBS="$LIBS -lpcre"; ], [ eixt ])

AC_HAVE_LIBRARY(rt, [ LIBS="$LIBS -lrt"; ], [])

AC_CHECK_HEADER(avcall.h, [AC_DEFINE(HAVE_AVCALL_H,1)], [ exit ])
AC_HAVE_LIBRARY(avcall, [ LIBS="$LIBS -lavcall"; ], [ exit ])

AC_SUBST(LIBS)

if which clang > /dev/null
Expand Down
4 changes: 4 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

clover2 (4.5.0-1) unstable; urgency=medium

* I put a bridge for C. Functions and constants can be imported. Buffer class is unboxing to pointer class

clover2 (4.2.7-1) unstable; urgency=medium

* Fixed bug of String.insert.
Expand Down
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Section: unknown
Priority: optional
Maintainer: Daisuke Minato <[email protected]>
Build-Depends: debhelper (>= 9), autotools-dev, libpcre3-dev, libreadline-dev, clang, libreadline7
Standards-Version: 4.2.7
Standards-Version: 4.5.0
Homepage: https://github.com/ab25cq/clover2/wiki
Vcs-Git: https://github.com/ab25cq/clover2.git

Expand Down
6 changes: 3 additions & 3 deletions debian/files
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
clover2-dbgsym_4.2.7-1_amd64.deb debug extra
clover2_4.2.7-1_amd64.buildinfo unknown optional
clover2_4.2.7-1_amd64.deb unknown optional
clover2-dbgsym_4.5.0-1_amd64.deb debug extra
clover2_4.5.0-1_amd64.buildinfo unknown optional
clover2_4.5.0-1_amd64.deb unknown optional
8 changes: 4 additions & 4 deletions install_deb.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
#!/bin/bash

if test -e ../clover2_4.2.7-1_i386.deb
if test -e ../clover2_4.5.0-1_i386.deb
then
if dpkg -l | egrep ^clover2
then
sudo apt-get remove clover2
fi

sudo dpkg -i ../clover2_4.2.7-1_i386.deb
sudo dpkg -i ../clover2_4.5.0-1_i386.deb
fi

if test -e ../clover2_4.2.7-1_amd64.deb
if test -e ../clover2_4.5.0-1_amd64.deb
then
if dpkg -l | egrep ^clover2
then
sudo apt-get remove clover2
fi

sudo dpkg -i ../clover2_4.2.7-1_amd64.deb
sudo dpkg -i ../clover2_4.5.0-1_amd64.deb
fi
6 changes: 3 additions & 3 deletions make_deb.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

mv ../clover2 ../clover2-4.2.7
mv ../clover2 ../clover2-4.5.0

cd .

Expand All @@ -9,15 +9,15 @@ then
make distclean
fi

(rm ../clover2_4.2.7.orig.tar.gz; cd ..; tar cvfz clover2_4.2.7.orig.tar.gz clover2-4.2.7)
(rm ../clover2_4.5.0.orig.tar.gz; cd ..; tar cvfz clover2_4.5.0.orig.tar.gz clover2-4.5.0)

sudo dpkg-buildpackage -us -uc

sudo make uninstall

sudo rm -rf debian/clover2

mv ../clover2-4.2.7 ../clover2
mv ../clover2-4.5.0 ../clover2

cd .

Expand Down
2 changes: 2 additions & 0 deletions manual/Home-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ In ubuntu, Debian
```
Is required. $

You need libffcall1-dev afterwards.

## Compile

Please get the source code first.
Expand Down
2 changes: 2 additions & 0 deletions manual/Home.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ ubuntu, Debianでは

が必要です。

後追加でlibffcall1-devが必要となっています。

## コンパイル

まずはソースコードを入手してください。
Expand Down
3 changes: 2 additions & 1 deletion manual/_Sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* [ソースコード](usage#ソースコード)
* [オープンクラスとincludeとmixin-layersスタイルコーディング](usage#オープンクラスとincludeとmixin-layersスタイルコーディング)
* [クラスファイルの登録](usage#クラスファイルの登録)
* [クラスの自動コンパイル機能](usage#クラスの自動コンパイル機能)
* [クラスの循環参照](usage#クラスの循環参照)

#### [主な機能](feature) [→ feature English Page](feature-en)
Expand Down Expand Up @@ -62,6 +61,8 @@
* [メソッドのデフォルト引数](feature#メソッドのデフォルト引数)
* [同一クラスのメソッドとフィールドのself省略](feature#同一クラスのメソッドとフィールドのself省略)

* [C言語へのブリッジ](feature#C言語へのブリッジ)

#### [型推論](typing) [→ typing English Page](typing-en)

* [型推論](typing#型推論)
Expand Down
Loading

0 comments on commit 54651cf

Please sign in to comment.