diff --git a/README.md b/README.md index 54eec2d..756c5db 100644 --- a/README.md +++ b/README.md @@ -338,10 +338,10 @@ The following constants are defined by default: Name | PHP constant ------- | ------------ -dirsep | DIRECTORY_SEPARATOR -homedir | $_SERVER['HOME'] -ln | PHP_EOL -pi | M_PI +DIRSEP | DIRECTORY_SEPARATOR +HOME | $_SERVER['HOME'] +EOL | PHP_EOL +PI | M_PI ## Extending diff --git a/mad/calc.mad b/mad/calc.mad index 6e6ef80..4ddd44a 100644 --- a/mad/calc.mad +++ b/mad/calc.mad @@ -41,14 +41,14 @@ ((first cmd) args)))))) ;; Define a file for readline and load it -(def readlineFile (str homedir "calc_history")) +(def readlineFile (str HOME "calc_history")) (readlineLoad readlineFile) ;; Main loop: Read input from user, add it to readline, and parse it (def mainLoop (fn () (let (inp (readline "> ")) (do (readlineAdd inp) (readlineSave readlineFile) - (print (str (parseInput inp) "\n")) + (print (str (parseInput inp) EOL)) true)))) ;; Run it diff --git a/src/Lib/IO.php b/src/Lib/IO.php index 5acaca3..146fb67 100644 --- a/src/Lib/IO.php +++ b/src/Lib/IO.php @@ -8,8 +8,8 @@ class IO implements ILib { public function register(Env $env): void { - $env->set('dirsep', \DIRECTORY_SEPARATOR); - $env->set('homedir', $_SERVER['HOME'] . \DIRECTORY_SEPARATOR); + $env->set('DIRSEP', \DIRECTORY_SEPARATOR); + $env->set('HOME', $_SERVER['HOME'] . \DIRECTORY_SEPARATOR); $env->set('wd', new CoreFunc('wd', 'Get the current working directory.', 0, 0, fn () => getcwd() . \DIRECTORY_SEPARATOR diff --git a/src/Lib/Math.php b/src/Lib/Math.php index f1f92b3..ca0ab60 100644 --- a/src/Lib/Math.php +++ b/src/Lib/Math.php @@ -10,7 +10,7 @@ class Math implements ILib { // Constants - $env->set('pi', \M_PI); + $env->set('PI', \M_PI); // Basic arithmetic diff --git a/src/Lib/Strings.php b/src/Lib/Strings.php index d94643b..49791e5 100644 --- a/src/Lib/Strings.php +++ b/src/Lib/Strings.php @@ -9,7 +9,7 @@ class Strings implements ILib { public function register(Env $env): void { - $env->set('ln', \PHP_EOL); + $env->set('EOL', \PHP_EOL); $env->set('trim', new CoreFunc('trim', 'Remove whitespace from beginning and end of string.', 1, 1, fn (string $a) => trim($a)