From 25726eced67129824b741ae3993d6e6d4e150d0b Mon Sep 17 00:00:00 2001 From: Vladimir Sedach Date: Sun, 30 Jan 2011 20:57:20 -0500 Subject: [PATCH] API for PS version and defined operators info. --- docs/reference.html | 11 +++++++++++ src/compiler.lisp | 8 +++++--- src/package.lisp | 3 ++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/docs/reference.html b/docs/reference.html index e805e27..c23ed6b 100644 --- a/docs/reference.html +++ b/docs/reference.html @@ -95,6 +95,8 @@
  • *PS-PRINT-PRETTY*
  • *INDENT-NUM-SPACES*
  • *PS-READ-FUNCTION*
  • +
  • *VERSION*
  • +
  • *DEFINED-OPERATORS*
  • @@ -182,6 +184,15 @@ pieces of code that will interface with Parenscript-generated JavaScript.

    +

    Newer versions of Parenscript may implement Common Lisp special + forms, functions or macros that were left unimplemented by earlier + versions. This can cause problems if your code provides + implementations for those forms itself. To help deal with + this, *DEFINED-OPERATORS* provides a list of special + forms, macros, and symbol macros defined by Parenscript + itself. *VERSION* is bound to the current release + version number of Parenscript.

    +

    Statements, expressions, and return

    In contrast to Lisp, where everything is an expression, diff --git a/src/compiler.lisp b/src/compiler.lisp index c5a4654..2fdef86 100644 --- a/src/compiler.lisp +++ b/src/compiler.lisp @@ -1,18 +1,20 @@ (in-package #:parenscript) (in-readtable :parenscript) +(defvar *version* 2.3 "Parenscript compiler version.") + (defparameter %compiling-reserved-forms-p% t "Used to issue warnings when replacing PS special operators or macros.") -(defvar *ps-defined-operators* () +(defvar *defined-operators* () "Special operators and macros defined by Parenscript. Replace at your own risk!") (defun defined-operator-override-check (name &rest body) - (when (and (not %compiling-reserved-forms-p%) (member name *ps-defined-operators*)) + (when (and (not %compiling-reserved-forms-p%) (member name *defined-operators*)) (warn 'simple-style-warning :format-control "Redefining Parenscript operator/macro ~A" :format-arguments (list name))) - `(progn ,(when %compiling-reserved-forms-p% `(pushnew ',name *ps-defined-operators*)) + `(progn ,(when %compiling-reserved-forms-p% `(pushnew ',name *defined-operators*)) ,@body)) (defvar *reserved-symbol-names* diff --git a/src/package.lisp b/src/package.lisp index 64e31b0..c2c6eb2 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -33,7 +33,8 @@ #:defpsmacro #:defmacro+ps #:import-macros-from-lisp - #:*ps-defined-operators* + #:*defined-operators* + #:*version* ;; gensym #:ps-gensym -- 2.11.4.GIT