Skip to content

Commit

Permalink
Merge pull request #161 from aldorlang/pab/rebase-2024-06
Browse files Browse the repository at this point in the history
Pab/rebase 2024 06
  • Loading branch information
pbroadbery authored Jun 30, 2024
2 parents 6196ec7 + 032a20e commit ab66f65
Show file tree
Hide file tree
Showing 179 changed files with 2,617 additions and 809 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
/build
/run_j
/build-2
/.idea
8 changes: 8 additions & 0 deletions aldor/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,17 @@
/.metadata
/workspace

/.idea
*.iml
/out

Makefile
a.out

/.idea
*.iml
/out/

.#*
\#*

Expand Down
3 changes: 2 additions & 1 deletion aldor/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ am__DIST_COMMON = $(srcdir)/Makefile.in \
$(top_srcdir)/lib/axldem/src/al/Makefile.in \
$(top_srcdir)/lib/axllib/src/al/Makefile.in AUTHORS \
amaux/compile amaux/config.guess amaux/config.sub \
amaux/install-sh amaux/ltmain.sh amaux/missing amaux/ylwrap
amaux/depcomp amaux/install-sh amaux/ltmain.sh amaux/missing \
amaux/ylwrap
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
Expand Down
2 changes: 1 addition & 1 deletion aldor/aldor/lib/java/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SUBDIRS=src test

@BUILD_JAVA_TRUE@JAVA_TARGET = src/foamj.jar
@BUILD_JAVA_TRUE@JAVA_TARGET = src/foamj.jar src/foamj-sources.jar

datalibdir = $(datadir)/lib
datalib_DATA = $(JAVA_TARGET)
2 changes: 1 addition & 1 deletion aldor/aldor/lib/java/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = src test
@BUILD_JAVA_TRUE@JAVA_TARGET = src/foamj.jar
@BUILD_JAVA_TRUE@JAVA_TARGET = src/foamj.jar src/foamj-sources.jar
datalibdir = $(datadir)/lib
datalib_DATA = $(JAVA_TARGET)
all: all-recursive
Expand Down
24 changes: 18 additions & 6 deletions aldor/aldor/lib/java/src/Makefile.in
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
# ..From autoconf
@SET_MAKE@

AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
VPATH = @srcdir@
abs_top_builddir = @abs_top_builddir@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
builddir = @builddir@
abs_builddir = @abs_builddir@
abs_top_srcdir = @abs_top_srcdir@
subdir = aldor/lib/java/src

include $(top_srcdir)/mk/step.mk
$(call am_define_steps, JAVAC JAVAJAR JAVASRC)

defaultTarget: all

.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
Expand All @@ -23,23 +30,28 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
buildfiles := $(shell cd $(srcdir); find foamj -name \*.java)

outdir := $(abs_builddir)/classes
jarfile := $(abs_builddir)/foamj.jar
jarfile := foamj.jar
sourcejarfile := foamj-sources.jar

# Build directly to a .jar file (easier than tracking .class files)
$(jarfile): $(buildfiles)
mkdir -p $(outdir)
(cd $(srcdir); javac -g -d $(outdir) $(buildfiles))
(wd=$$(pwd); cd $(outdir); jar cf $@ .)
@mkdir -p $(outdir)
$(AM_V_JAVAC) (cd $(srcdir); javac -g -d $(outdir) $(buildfiles))
$(AM_V_JAVAJAR) (wd=$$(pwd); cd $(outdir); jar cf $(abs_builddir)/$@ .)

$(sourcejarfile): $(buildfiles)
$(AM_V_JAVASRC) \
cd $(srcdir); jar cf $(abs_builddir)/$@ $(shell cd $(srcdir); find . -type f)

all: $(jarfile)
echo $<
all: $(jarfile) $(sourcejarfile)

#
# :: Automake requires this little lot
#
mostlyclean:
rm -rf $(outdir)
rm -f $(jarfile)
rm -f $(sourcejarfile)

clean: mostlyclean

Expand Down
4 changes: 4 additions & 0 deletions aldor/aldor/lib/java/src/foamj/Clos.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public Word asWord() {
return this;
}

public Object toPtr() {
return this;
}

@Override
public Value toValue() {
return this;
Expand Down
2 changes: 1 addition & 1 deletion aldor/aldor/lib/java/src/foamj/Fn.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ public String getName() {
public String toString() {
return "Fn-" + name;
}
}
}
8 changes: 5 additions & 3 deletions aldor/aldor/lib/java/src/foamj/Foam.java
Original file line number Diff line number Diff line change
Expand Up @@ -357,18 +357,18 @@ public static Word osMemMap(Word w1) {
}

public static void fiRaiseException(Word w) {
throw new RuntimeException(w.toString());
throw new RuntimeException(stringToJavaString(w));
}

public static float arrToSFlo(Object o) {
char[] arr = (char[]) o;
return new Float(arrToString(arr));
return Float.parseFloat(arrToString(arr));

}

public static double arrToDFlo(Object o) {
char[] arr = (char[]) o;
return new Double(arrToString(arr));
return Double.parseDouble(arrToString(arr));
}

public static int arrToSInt(Object o) {
Expand Down Expand Up @@ -542,9 +542,11 @@ public static Word javaStringToString(String s) {
public static String arrToString(char[] arr) {
String s = new String(arr);
int idx = s.indexOf("\0");

if (idx == -1) {
return s;
}

return s.substring(0, idx);
}
}
2 changes: 1 addition & 1 deletion aldor/aldor/lib/java/src/foamj/FoamHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ static public void setContext(FoamContext context) {
}

static public <T extends FoamClass> T instanceForClass(Class<T> clss) {
return contextForThread.get().instanceForClass(clss);
return contextForThread.get().instanceForClass(clss);
}
}
11 changes: 10 additions & 1 deletion aldor/aldor/lib/java/src/foamj/FoamJ.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ public Word asWord() {
return this;
}

public Object toPtr() {
return arr;
}

public String toString() {
return "A" + arr.toString() + "]";
}
Expand Down Expand Up @@ -60,6 +64,9 @@ public String toString() {
return obj.toString();
}

public Object toPtr() {
return obj;
}
}

/**
Expand Down Expand Up @@ -194,7 +201,9 @@ public Value toValue() {
}

static public class Bool extends AbstractValue implements Value, Word {
private boolean value;
public final static Bool TRUE = new Bool(true);
public final static Bool FALSE = new Bool(false);
private final boolean value;

public Bool(boolean b) {
this.value = b;
Expand Down
4 changes: 4 additions & 0 deletions aldor/aldor/lib/java/src/foamj/Record.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,8 @@ public Word asWord() {
public String toString() {
return "[R: " + id + "]";
}

public Object toPtr() {
return this;
}
}
10 changes: 9 additions & 1 deletion aldor/aldor/lib/java/src/foamj/Word.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public interface Word {

byte toByte();

Object toPtr();

public class U {
static public Object toArray(Word word) {
Expand All @@ -42,6 +43,13 @@ static public Object toArray(Word word) {
return word.toArray();
}

static public Object toPtr(Word word) {
if (word == null)
return null;
else
return word.toPtr();
}

static public <T> T toJavaObj(Word word) {
if (word == null)
return null;
Expand Down Expand Up @@ -70,7 +78,7 @@ public static <T> Word fromJavaObj(T t) {
}

public static Word fromBool(boolean b) {
return new Bool(b);
return b ? Bool.TRUE : Bool.FALSE;
}

public static Word fromChar(char c) {
Expand Down
1 change: 0 additions & 1 deletion aldor/aldor/lib/java/test/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ $(jarfile): $(buildfiles)
(cd $(outdir); jar cf $@ .)

all:
echo $<

#
# :: Automake requires this little lot
Expand Down
2 changes: 1 addition & 1 deletion aldor/aldor/lib/libfoam/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SUBDIRS = al

@BUILD_JAVA_TRUE@JAVA_TARGET = al/foam.jar
@BUILD_JAVA_TRUE@JAVA_TARGET = al/foam.jar al/foam-sources.jar

aldorsrcdir = $(top_srcdir)/aldor/src

Expand Down
2 changes: 1 addition & 1 deletion aldor/aldor/lib/libfoam/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = al
@BUILD_JAVA_TRUE@JAVA_TARGET = al/foam.jar
@BUILD_JAVA_TRUE@JAVA_TARGET = al/foam.jar al/foam-sources.jar
aldorsrcdir = $(top_srcdir)/aldor/src
runtime_CFLAGS = -I $(aldorsrcdir) -I ../../src
runtime_ALDOR = al/runtime.c
Expand Down
2 changes: 1 addition & 1 deletion aldor/aldor/lib/libfoamlib/al/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ libraryname := foamlib
exec_test_blacklist = $(library)

#AXLCDB := -W check -Csmax=0 -Fc -Zdb -Qno-cc
AXLFLAGS := -Z db -Q8 $(AXLCDB)
AXLFLAGS := -Q8 $(AXLCDB)

include $(top_srcdir)/lib/buildlib.mk
libraryincdir := $(top_srcdir)/aldor/lib/libfoamlib/al
Expand Down
3 changes: 3 additions & 0 deletions aldor/aldor/src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ libstruct_a_SOURCES = \
compcfg.c \
comsg.c \
comsgdb.c \
csig.c \
depdag.c \
dflow.c \
doc.c \
Expand Down Expand Up @@ -291,6 +292,8 @@ testsuite = \
test/test_jcode.c \
test/test_int.c \
test/test_list.c \
test/test_of_cprop.c \
test/test_of_peep.c \
test/test_ostream.c \
test/test_printf.c \
test/test_retyp.c \
Expand Down
Loading

0 comments on commit ab66f65

Please sign in to comment.