mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-03 13:20:26 +02:00
reformat comments
* module/language/elisp/bindings.scm: * module/language/elisp/compile-tree-il.scm: * module/language/elisp/lexer.scm: * module/language/elisp/parser.scm: * module/language/elisp/runtime.scm: * module/language/elisp/runtime/function-slot.scm: * module/language/elisp/runtime/macro-slot.scm: * module/language/elisp/runtime/value-slot.scm: Reformat comments.
This commit is contained in:
parent
372b11fc73
commit
27b9476a8d
8 changed files with 478 additions and 450 deletions
|
@ -2,19 +2,20 @@
|
|||
|
||||
;;; Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
;;;
|
||||
;;; This library is free software; you can redistribute it and/or
|
||||
;;; modify it under the terms of the GNU Lesser General Public
|
||||
;;; License as published by the Free Software Foundation; either
|
||||
;;; version 3 of the License, or (at your option) any later version.
|
||||
;;; This library is free software; you can redistribute it and/or modify
|
||||
;;; it under the terms of the GNU Lesser General Public License as
|
||||
;;; published by the Free Software Foundation; either version 3 of the
|
||||
;;; License, or (at your option) any later version.
|
||||
;;;
|
||||
;;; This library is distributed in the hope that it will be useful,
|
||||
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
;;; This library is distributed in the hope that it will be useful, but
|
||||
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
;;; Lesser General Public License for more details.
|
||||
;;;
|
||||
;;; You should have received a copy of the GNU Lesser General Public
|
||||
;;; License along with this library; if not, write to the Free Software
|
||||
;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
;;; 02110-1301 USA
|
||||
|
||||
;;; Code:
|
||||
|
||||
|
@ -22,10 +23,11 @@
|
|||
#:use-module (language elisp runtime)
|
||||
#:use-module (system base compile))
|
||||
|
||||
; This module contains the function-slots of elisp symbols. Elisp built-in
|
||||
; functions are implemented as predefined function bindings here.
|
||||
;;; This module contains the function-slots of elisp symbols. Elisp
|
||||
;;; built-in functions are implemented as predefined function bindings
|
||||
;;; here.
|
||||
|
||||
; Equivalence and equalness predicates.
|
||||
;;; Equivalence and equalness predicates.
|
||||
|
||||
(built-in-func eq (lambda (a b)
|
||||
(elisp-bool (eq? a b))))
|
||||
|
@ -33,7 +35,7 @@
|
|||
(built-in-func equal (lambda (a b)
|
||||
(elisp-bool (equal? a b))))
|
||||
|
||||
; Number predicates.
|
||||
;;; Number predicates.
|
||||
|
||||
(built-in-func floatp (lambda (num)
|
||||
(elisp-bool (and (real? num)
|
||||
|
@ -55,7 +57,7 @@
|
|||
(built-in-func zerop (lambda (num)
|
||||
(elisp-bool (prim = num 0))))
|
||||
|
||||
; Number comparisons.
|
||||
;;; Number comparisons.
|
||||
|
||||
(built-in-func = (lambda (num1 num2)
|
||||
(elisp-bool (prim = num1 num2))))
|
||||
|
@ -83,16 +85,16 @@
|
|||
|
||||
(built-in-func abs (@ (guile) abs))
|
||||
|
||||
; Number conversion.
|
||||
;;; Number conversion.
|
||||
|
||||
(built-in-func float (lambda (num)
|
||||
(if (exact? num)
|
||||
(exact->inexact num)
|
||||
num)))
|
||||
|
||||
; TODO: truncate, floor, ceiling, round.
|
||||
;;; TODO: truncate, floor, ceiling, round.
|
||||
|
||||
; Arithmetic functions.
|
||||
;;; Arithmetic functions.
|
||||
|
||||
(built-in-func 1+ (@ (guile) 1+))
|
||||
|
||||
|
@ -106,9 +108,10 @@
|
|||
|
||||
(built-in-func % (@ (guile) modulo))
|
||||
|
||||
; TODO: / with correct integer/real behaviour, mod (for floating-piont values).
|
||||
;;; TODO: / with correct integer/real behaviour, mod (for floating-piont
|
||||
;;; values).
|
||||
|
||||
; Floating-point rounding operations.
|
||||
;;; Floating-point rounding operations.
|
||||
|
||||
(built-in-func ffloor (@ (guile) floor))
|
||||
|
||||
|
@ -118,7 +121,7 @@
|
|||
|
||||
(built-in-func fround (@ (guile) round))
|
||||
|
||||
; List predicates.
|
||||
;;; List predicates.
|
||||
|
||||
(built-in-func consp
|
||||
(lambda (el)
|
||||
|
@ -141,7 +144,7 @@
|
|||
(lambda (el)
|
||||
(elisp-bool (null? el))))
|
||||
|
||||
; Accessing list elements.
|
||||
;;; Accessing list elements.
|
||||
|
||||
(built-in-func car
|
||||
(lambda (el)
|
||||
|
@ -191,7 +194,7 @@
|
|||
|
||||
(built-in-func length (@ (guile) length))
|
||||
|
||||
; Building lists.
|
||||
;;; Building lists.
|
||||
|
||||
(built-in-func cons (@ (guile) cons))
|
||||
|
||||
|
@ -236,7 +239,7 @@
|
|||
(prim cons i result)
|
||||
(iterate (prim - i sep) (prim cons i result)))))))))))
|
||||
|
||||
; Changing lists.
|
||||
;;; Changing lists.
|
||||
|
||||
(built-in-func setcar
|
||||
(lambda (cell val)
|
||||
|
@ -248,7 +251,7 @@
|
|||
(prim set-cdr! cell val)
|
||||
val))
|
||||
|
||||
; Accessing symbol bindings for symbols known only at runtime.
|
||||
;;; Accessing symbol bindings for symbols known only at runtime.
|
||||
|
||||
(built-in-func symbol-value
|
||||
(lambda (sym)
|
||||
|
@ -286,8 +289,8 @@
|
|||
(elisp-bool (prim not
|
||||
(eq? void (reference-variable function-slot-module sym))))))
|
||||
|
||||
; Function calls. These must take care of special cases, like using symbols
|
||||
; or raw lambda-lists as functions!
|
||||
;;; Function calls. These must take care of special cases, like using
|
||||
;;; symbols or raw lambda-lists as functions!
|
||||
|
||||
(built-in-func apply
|
||||
(lambda (func . args)
|
||||
|
@ -308,13 +311,13 @@
|
|||
(lambda (func . args)
|
||||
(myapply func args))))
|
||||
|
||||
; Throw can be implemented as built-in function.
|
||||
;;; Throw can be implemented as built-in function.
|
||||
|
||||
(built-in-func throw
|
||||
(lambda (tag value)
|
||||
(prim throw 'elisp-exception tag value)))
|
||||
|
||||
; Miscellaneous.
|
||||
;;; Miscellaneous.
|
||||
|
||||
(built-in-func not
|
||||
(lambda (x)
|
||||
|
|
|
@ -2,32 +2,34 @@
|
|||
|
||||
;;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
|
||||
;;;
|
||||
;;; This library is free software; you can redistribute it and/or
|
||||
;;; modify it under the terms of the GNU Lesser General Public
|
||||
;;; License as published by the Free Software Foundation; either
|
||||
;;; version 3 of the License, or (at your option) any later version.
|
||||
;;; This library is free software; you can redistribute it and/or modify
|
||||
;;; it under the terms of the GNU Lesser General Public License as
|
||||
;;; published by the Free Software Foundation; either version 3 of the
|
||||
;;; License, or (at your option) any later version.
|
||||
;;;
|
||||
;;; This library is distributed in the hope that it will be useful,
|
||||
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
;;; This library is distributed in the hope that it will be useful, but
|
||||
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
;;; Lesser General Public License for more details.
|
||||
;;;
|
||||
;;; You should have received a copy of the GNU Lesser General Public
|
||||
;;; License along with this library; if not, write to the Free Software
|
||||
;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
;;; 02110-1301 USA
|
||||
|
||||
;;; Code:
|
||||
|
||||
(define-module (language elisp runtime macro-slot)
|
||||
#:use-module (language elisp runtime))
|
||||
|
||||
; This module contains the macro definitions of elisp symbols. In contrast to
|
||||
; the other runtime modules, those are used directly during compilation, of
|
||||
; course, so not really in runtime. But I think it fits well to the others
|
||||
; here.
|
||||
;;; This module contains the macro definitions of elisp symbols. In
|
||||
;;; contrast to the other runtime modules, those are used directly
|
||||
;;; during compilation, of course, so not really in runtime. But I think
|
||||
;;; it fits well to the others here.
|
||||
|
||||
; The prog1 and prog2 constructs can easily be defined as macros using progn
|
||||
; and some lexical-let's to save the intermediate value to return at the end.
|
||||
;;; The prog1 and prog2 constructs can easily be defined as macros using
|
||||
;;; progn and some lexical-let's to save the intermediate value to
|
||||
;;; return at the end.
|
||||
|
||||
(built-in-macro prog1
|
||||
(lambda (form1 . rest)
|
||||
|
@ -41,7 +43,7 @@
|
|||
(lambda (form1 form2 . rest)
|
||||
`(progn ,form1 (prog1 ,form2 ,@rest))))
|
||||
|
||||
; Define the conditionals when and unless as macros.
|
||||
;;; Define the conditionals when and unless as macros.
|
||||
|
||||
(built-in-macro when
|
||||
(lambda (condition . thens)
|
||||
|
@ -51,9 +53,10 @@
|
|||
(lambda (condition . elses)
|
||||
`(if ,condition nil (progn ,@elses))))
|
||||
|
||||
; Impement the cond form as nested if's. A special case is a (condition)
|
||||
; subform, in which case we need to return the condition itself if it is true
|
||||
; and thus save it in a local variable before testing it.
|
||||
;;; Impement the cond form as nested if's. A special case is a
|
||||
;;; (condition) subform, in which case we need to return the condition
|
||||
;;; itself if it is true and thus save it in a local variable before
|
||||
;;; testing it.
|
||||
|
||||
(built-in-macro cond
|
||||
(lambda (. clauses)
|
||||
|
@ -77,7 +80,7 @@
|
|||
(progn ,@(cdr cur))
|
||||
,rest))))))))
|
||||
|
||||
; The and and or forms can also be easily defined with macros.
|
||||
;;; The and and or forms can also be easily defined with macros.
|
||||
|
||||
(built-in-macro and
|
||||
(case-lambda
|
||||
|
@ -107,7 +110,7 @@
|
|||
,var
|
||||
,(iterate (car tail) (cdr tail)))))))))))
|
||||
|
||||
; Define the dotimes and dolist iteration macros.
|
||||
;;; Define the dotimes and dolist iteration macros.
|
||||
|
||||
(built-in-macro dotimes
|
||||
(lambda (args . body)
|
||||
|
@ -150,15 +153,15 @@
|
|||
(list (caddr args))
|
||||
'())))))))))
|
||||
|
||||
; Exception handling. unwind-protect and catch are implemented as macros (throw
|
||||
; is a built-in function).
|
||||
;;; Exception handling. unwind-protect and catch are implemented as
|
||||
;;; macros (throw is a built-in function).
|
||||
|
||||
; catch and throw can mainly be implemented directly using Guile's
|
||||
; primitives for exceptions, the only difficulty is that the keys used
|
||||
; within Guile must be symbols, while elisp allows any value and checks
|
||||
; for matches using eq (eq?). We handle this by using always #t as key
|
||||
; for the Guile primitives and check for matches inside the handler; if
|
||||
; the elisp keys are not eq?, we rethrow the exception.
|
||||
;;; catch and throw can mainly be implemented directly using Guile's
|
||||
;;; primitives for exceptions, the only difficulty is that the keys used
|
||||
;;; within Guile must be symbols, while elisp allows any value and
|
||||
;;; checks for matches using eq (eq?). We handle this by using always #t
|
||||
;;; as key for the Guile primitives and check for matches inside the
|
||||
;;; handler; if the elisp keys are not eq?, we rethrow the exception.
|
||||
|
||||
(built-in-macro catch
|
||||
(lambda (tag . body)
|
||||
|
@ -180,8 +183,8 @@
|
|||
((guile-primitive throw) ,dummy-key ,elisp-key
|
||||
,value))))))))))
|
||||
|
||||
; unwind-protect is just some weaker construct as dynamic-wind, so
|
||||
; straight-forward to implement.
|
||||
;;; unwind-protect is just some weaker construct as dynamic-wind, so
|
||||
;;; straight-forward to implement.
|
||||
|
||||
(built-in-macro unwind-protect
|
||||
(lambda (body . clean-ups)
|
||||
|
@ -192,7 +195,7 @@
|
|||
(lambda () ,body)
|
||||
(lambda () ,@clean-ups))))
|
||||
|
||||
; Pop off the first element from a list or push one to it.
|
||||
;;; Pop off the first element from a list or push one to it.
|
||||
|
||||
(built-in-macro pop
|
||||
(lambda (list-name)
|
||||
|
|
|
@ -2,22 +2,23 @@
|
|||
|
||||
;;; Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
;;;
|
||||
;;; This library is free software; you can redistribute it and/or
|
||||
;;; modify it under the terms of the GNU Lesser General Public
|
||||
;;; License as published by the Free Software Foundation; either
|
||||
;;; version 3 of the License, or (at your option) any later version.
|
||||
;;; This library is free software; you can redistribute it and/or modify
|
||||
;;; it under the terms of the GNU Lesser General Public License as
|
||||
;;; published by the Free Software Foundation; either version 3 of the
|
||||
;;; License, or (at your option) any later version.
|
||||
;;;
|
||||
;;; This library is distributed in the hope that it will be useful,
|
||||
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
;;; This library is distributed in the hope that it will be useful, but
|
||||
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
;;; Lesser General Public License for more details.
|
||||
;;;
|
||||
;;; You should have received a copy of the GNU Lesser General Public
|
||||
;;; License along with this library; if not, write to the Free Software
|
||||
;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
;;; 02110-1301 USA
|
||||
|
||||
;;; Code:
|
||||
|
||||
(define-module (language elisp runtime value-slot))
|
||||
|
||||
; This module contains the value-slots of elisp symbols.
|
||||
;;; This module contains the value-slots of elisp symbols.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue