Skip to content

Commit

Permalink
Remove copyright notice and untabify.
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-strandh committed Sep 19, 2020
1 parent 568aff7 commit b2a7fdd
Show file tree
Hide file tree
Showing 3 changed files with 528 additions and 564 deletions.
58 changes: 23 additions & 35 deletions Code/Loop/for-as-across-clause.lisp
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
;;;; Copyright (c) 2014
;;;;
;;;; Robert Strandh ([email protected])
;;;;
;;;; all rights reserved.
;;;;
;;;; Permission is hereby granted to use this software for any
;;;; purpose, including using, modifying, and redistributing it.
;;;;
;;;; The software is provided "as-is" with no warranty. The user of
;;;; this software assumes any responsibility of the consequences.

(cl:in-package #:sicl-loop)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Expand All @@ -35,31 +23,31 @@
(multiple-value-bind (temp-vars dictionary)
(fresh-variables (var-spec clause))
(reinitialize-instance clause
:temp-vars temp-vars
:dictionary dictionary)))
:temp-vars temp-vars
:dictionary dictionary)))

;;; The FOR-AS-ACROSS clasue binds all the variables in the VAR-SPEC
;;; of the clause, so this method should return a list of all those
;;; variables.
(defmethod bound-variables ((clause for-as-across))
(mapcar #'car
(extract-variables (var-spec clause) nil)))
(extract-variables (var-spec clause) nil)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Parser

(define-parser for-as-across-parser
(consecutive (lambda (var type-spec across vector-form)
(declare (ignore across))
(make-instance 'for-as-across
:var-spec var
:type-spec type-spec
:vector-form vector-form))
'anything-parser
'optional-type-spec-parser
(keyword-parser 'across)
'anything-parser))
(declare (ignore across))
(make-instance 'for-as-across
:var-spec var
:type-spec type-spec
:vector-form vector-form))
'anything-parser
'optional-type-spec-parser
(keyword-parser 'across)
'anything-parser))

(add-for-as-subclause-parser 'for-as-across-parser)

Expand All @@ -74,28 +62,28 @@
(defmethod final-bindings ((clause for-as-across))
`((,(length-var clause) (length ,(form-var clause)))
,@(loop for (real-var) in (dictionary clause)
collect `(,real-var nil))))
collect `(,real-var nil))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Compute declarations.

(defmethod declarations ((clause for-as-across))
(loop with d-var-spec = (var-spec clause)
with d-type-spec = (type-spec clause)
for (variable type) in (extract-variables d-var-spec d-type-spec)
collect `(cl:type (or null ,type) ,variable)))
with d-type-spec = (type-spec clause)
for (variable type) in (extract-variables d-var-spec d-type-spec)
collect `(cl:type (or null ,type) ,variable)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Compute prologue-form.

(defmethod prologue-form ((clause for-as-across) end-tag)
`(progn ,(termination-form clause end-tag)
,(generate-assignments (var-spec clause)
`(aref ,(form-var clause)
,(index-var clause)))
(incf ,(index-var clause))))
,(generate-assignments (var-spec clause)
`(aref ,(form-var clause)
,(index-var clause)))
(incf ,(index-var clause))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
Expand All @@ -111,6 +99,6 @@

(defmethod step-form ((clause for-as-across))
`(progn ,(generate-assignments (var-spec clause)
`(aref ,(form-var clause)
,(index-var clause)))
(incf ,(index-var clause))))
`(aref ,(form-var clause)
,(index-var clause)))
(incf ,(index-var clause))))
Loading

0 comments on commit b2a7fdd

Please sign in to comment.