Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Michael Klose committed Apr 21, 2017
2 parents e133cd3 + 941de00 commit 86f6f0b
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 40 deletions.
29 changes: 17 additions & 12 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
Changes of tre-0.8 relative to tre-0.7:
* WITHOUT-HEAD, WITHOUT-TAIL: New functions.
* PHP: AREF returns NIL for undefined indexes instead of breaking with an
error message.

Changes of tre-0.7 relative to tre-0.6:
* (%NEW): Accidentally converted to (%NEW NIL) – fixed.
* PHP: Debugged property and associative array functions.
* JS: Methods are also available as functions whose identifier is
($ class-name "-" method-name).

Changes of tre-0.6 relative to tre-0.5:
* PHP: PROPERTY-NAMES fixed for associative arrays.
* PHP: ASSOC-ARRAY? test if first key is a string.
* Curly brackets {} denote MAKE-OBJECT if the first element
is a string or keyword.
* MAKE-OBJECT, NEW, {}: Also takes keywords whose symbol names
are converted to downcase as property names.
* JS/PHP: COPY-PROPERTIES, MERGE-PROPERTIES, UPDATE-PROPERTIES:
New functions.
* Curly brackets {} denote MAKE-OBJECT if the first element is a string or
keyword.
* MAKE-OBJECT, NEW, {}: Also takes keywords whose symbol names are converted
to downcase as property names.
* JS/PHP: COPY-PROPERTIES, MERGE-PROPERTIES, UPDATE-PROPERTIES: New
functions.

Changes of tre-0.5 relative to tre-0.4:
* LOG-MESSAGE returns its argument if logging has been
switched off.
* LOG-MESSAGE returns its argument if logging has been switched off.
* LML: Attribute names must be keywords.
* PHP: NEW create a native object when used witout arguments.
* PHP: PROPERTY-NAME, PROPERTY-ALIST, ALIST-PROPERTIES,
MAKE-OBJECT: New core functions.
* PHP: PROPERTY-NAME, PROPERTY-ALIST, ALIST-PROPERTIES, MAKE-OBJECT: New
core functions.
* PHP: ARRAY? returns T for indexed arrays only.
* JS/PHP: ASSOC-ARRAY?: New predicate.
* JS/PHP: JSON-ENCODE, JSON-DECODE added.
Expand All @@ -32,8 +38,7 @@ Changes of tre-0.4 relative to tre-0.3:
RELEASES:

Changes of tre-0.3 relative to tre-0.2:
* JS: PROPERTY-NAME, PROPERTY-ALIST, ALIST-PROPERTIES: New
core functions.
* JS: PROPERTY-NAME, PROPERTY-ALIST, ALIST-PROPERTIES: New core functions.
* JS: PROPERTY-REMOVE: New core codegen macro.
* JS: NEW returns an empty object when used without arguments.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
(fn head? (x head &key (test #'equal))
(funcall test head (subseq x 0 (length head))))

(fn without-head (x head)
(? (head? x head)
(subseq x (length head))
x))
4 changes: 2 additions & 2 deletions environment/stage4/main.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
(env-load "stage4/define-tree-filter.lisp")
(env-load "stage4/destructive-arith.lisp")
(env-load "stage4/intersect.lisp")
(env-load "stage4/tail-p.lisp")
(env-load "stage4/head.lisp")
(env-load "stage4/tail.lisp")
(env-load "stage4/repeat-while-changes.lisp")
(env-load "stage4/expander.lisp")
(env-load "stage4/macrolet.lisp")
Expand All @@ -26,7 +27,6 @@
(env-load "stage4/sort.lisp")
(env-load "stage4/split.lisp" :cl)
(env-load "stage4/split.tests.lisp")
(env-load "stage4/head-p.lisp")
(env-load "stage4/trim.lisp")
(env-load "stage4/trim.tests.lisp")
(env-load "stage4/define-slot-setter.lisp")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@
tlen (length tail))
(unless (< xlen tlen)
(funcall test tail (subseq x (- xlen tlen))))))

(fn without-tail (x tail)
(? (tail? x tail)
(subseq x 0 (- (length x) (length tail)))
x))
2 changes: 1 addition & 1 deletion environment/transpiler/targets/javascript/class.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
(apply #'generic-defmember class-name names))

(fn js-emit-method (class-name x)
(!= ($ '~meth- class-name '- x.)
(!= ($ class-name '- x.)
(. `((%%native ,x.) #',!)
`(fn ,! ,.x.
(%thisify ,class-name
Expand Down
3 changes: 1 addition & 2 deletions environment/transpiler/targets/javascript/core/string.lisp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
(js-type-predicate %string? "string")

(fn string? (x)
(| (%string? x)
(instanceof x (%%native "String"))))
(%string? x))

(fn string-concat (&rest x)
(alet (make-array)
Expand Down
3 changes: 2 additions & 1 deletion environment/transpiler/targets/php/core.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

(defvar *php-core-native*
,(apply #'+ (@ [fetch-file (+ "environment/transpiler/targets/php/core/native/" _ ".php")]
'("settings"
'("remove-magic-quotes"
"settings"
"error"
"character"
"cons"
Expand Down
3 changes: 2 additions & 1 deletion environment/transpiler/targets/php/core/array.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@

(fn aref (a k)
(? (is_array a)
(%aref a k)
(& (%aref-defined? a k)
(%aref a k))
(href a k)))

(fn (= aref) (v a k)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# From somewhere in the official PHP documentation comments.
if (get_magic_quotes_gpc ()) {
$vars = array (&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
while (list ($key, $val) = each ($vars)) {
foreach ($val as $k => $v) {
unset ($vars[$key][$k]);
$sk = stripslashes ($k);
if (is_array ($v)) {
$vars[$key][$sk] = $v;
$vars[] = &$vars[$key][$sk];
} else
$vars[$key][$sk] = stripslashes ($v);
}
}
unset ($vars);
}
19 changes: 1 addition & 18 deletions environment/transpiler/targets/php/toplevel.lisp
Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
(fn php-prologue ()
(with-string-stream out
(format out "<?php // tré revision ~A~%" *tre-revision*)
(format out (+ "if (get_magic_quotes_gpc ()) {~%"
" $vars = array (&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);~%"
" while (list ($key, $val) = each ($vars)) {~%"
" foreach ($val as $k => $v) {~%"
" unset ($vars[$key][$k]);~%"
" $sk = stripslashes ($k);~%"
" if (is_array ($v)) {~%"
" $vars[$key][$sk] = $v;~%"
" $vars[] = &$vars[$key][$sk];~%"
" } else~%"
" $vars[$key][$sk] = stripslashes ($v);~%"
" }~%"
" }~%"
" unset ($vars);~%"
"}~%"))
(php-print-native-core out)))
(format nil "<?php // tré revision ~A~%~A" *tre-revision* *php-core-native*))

(fn php-epilogue ()
(format nil "?>~%"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(defvar *delayed-constructors* nil)

(fn generic-defclass (constructor-maker class-name args &body body)
(fn generic-defclass (constructor-maker class-name args &body body) ; TODO: Check if base classes are defined.
(with (cname (? (cons? class-name)
class-name.
class-name)
Expand Down
6 changes: 4 additions & 2 deletions make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ BINDIR="/usr/local/bin/"
basic_clean ()
{
echo "Cleaning..."
rm -vf *.core compiled environment/transpiler/targets/c/native/$COMPILED_ENV image files.lisp
rm -rv compiled
rm -vf *.core environment/transpiler/targets/c/native/$COMPILED_ENV image files.lisp
rm -vf environment/_current-version
rm -vrf _nodejstests.log _phptests.log
rm -vf environment/_release-date
rm -vf _nodejstests.log _phptests.log
echo "Checking out last working core..."
git checkout -- boot-common.lisp
}
Expand Down

0 comments on commit 86f6f0b

Please sign in to comment.