File: dsssl-flow.el

package info (click to toggle)
xemacs20 20.4-13
  • links: PTS
  • area: main
  • in suites: slink
  • size: 67,324 kB
  • ctags: 57,643
  • sloc: lisp: 586,197; ansic: 184,662; sh: 4,296; asm: 3,179; makefile: 2,021; perl: 1,059; csh: 96; sed: 22
file content (124 lines) | stat: -rw-r--r-- 4,009 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
;;; dsssl-flow.el --- DSSSL flow objects
;; Author: wmperry
;; Created: 1997/10/17 14:07:55
;; Version: 1.4
;; Keywords: 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Copyright (c) 1996, 1997 by William M. Perry <wmperry@cs.indiana.edu>
;;; Copyright (c) 1997 by Free Software Foundation, Inc.
;;;
;;; This file is part of GNU Emacs.
;;;
;;; GNU Emacs is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 2, or (at your option)
;;; any later version.
;;;
;;; GNU Emacs 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 General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Emacs; see the file COPYING.  If not, write to the
;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;;; Boston, MA 02111-1307, USA.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defstruct flow-object
  (type 'unknown :read-only t)		; Name of this flow object
  (properties nil)
  (children nil)
  (parent nil)
  )

(defstruct dsssl-flow-processor
  (name 'unknown :read-only t)		; Name of this processing backend
  (init nil)				; initialize the backend
  (handler nil)				; handle a single flow object
  (sizeof nil)				; get size of a single flow object
  (clean nil)				; cleanup instance of backend
  )

(defvar dsssl-flow-active-faces nil)
(defvar dsssl-flow-active-voices nil)
(make-variable-buffer-local 'dsssl-flow-active-faces)
(make-variable-buffer-local 'dsssl-flow-active-voices)

(defun dsssl-flow-display (flows processor)
  (let ((handler (dsssl-flow-processor-handler processor))
	(flow-stack (list flows))
	(content nil)
	(node nil)
	(last-object nil)
	)
    (while flow-stack
      (setq content (pop flow-stack))
      (dsssl-flow-progress-meter)
      ;; Handle the element's content
      (while content
	(dsssl-flow-progress-meter)
	(if (stringp (car content))
	    (dsssl-flow-handle-string-content (pop content))
	  (setq node (pop content))
	  ;; todo: collect all information about this flow object for faster
	  ;; lookup later.
	  (push (dsssl-flow-face-for-element node) dsssl-flow-active-faces)
	  (push (dsssl-flow-voice-for-element node) dsssl-flow-active-voices))
	  (case (flow-object-type node)
	    ;; Core DSSL components  basic flow object classes
	    (sequence			; 12.6.1
	     )
	    (display-group		; 12.6.2
	     )
	    (paragraph			; 12.6.6
	     )
	    (paragraph-break		; 12.6.7
	     )
	    (external-graphic		; 12.6.15
	     )
	    ;; DSSSL options required in DSSSL online
	    ;; Simple page flow object class
	    (simple-page-sequence	; 12.6.3
	     )
	    ;; Table flow object classes
	    (table			; 12.6.27.1
	     )
	    (table-part			; 12.6.27.2
	     )
	    (table-column		; 12.6.27.3
	     )
	    (table-row			; 12.6.27.5
	     )
	    (table-border		; 12.6.27.7
	     )
	    (table-cell			; 12.6.27.6
	     ;; Do we need to handle table-cell at this level, or is that
	     ;; something that the display backend needs to handle, and we
	     ;; just query that in the `table-row' processor?
	     )
	    ;; Online display flow object classes
	    (vertical-scroll		; 12.6.28.1
	     )
	    (multi-mode			; 12.6.28.2
	     )
	    (marginalia			; 12.6.28.4
	     )
	    ;; Emacs/W3 specific flow objects
	    (applet			; Wow, Java
	     )
	    (script			; Scripts
	     )
	    (form-element		; Any form element
	     )
	    ;; pinhead, flame, and cookie can now all be handled by
	    ;; a stud-muffing DSSSL stylesheet - hooray!

	    ;; Generic formatting - all things that can be fully specified
	    ;; by a CSS stylesheet.
	    (otherwise
	     ;; handle the content
	     (dsssl-flow-handle-content node)))))))

(provide 'dsssl-flow)