[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/type-hierarchy 0393bfdc912 1/3: Make type hierarchy textual repr
From: |
Andrea Corallo |
Subject: |
feature/type-hierarchy 0393bfdc912 1/3: Make type hierarchy textual representation a table |
Date: |
Mon, 19 Feb 2024 11:49:39 -0500 (EST) |
branch: feature/type-hierarchy
commit 0393bfdc912912e3368b786d062894f3069d210b
Author: Andrea Corallo <acorallo@gnu.org>
Commit: Andrea Corallo <acorallo@gnu.org>
Make type hierarchy textual representation a table
* etc/syncdoc-type-hierarchy.el (syncdoc-make-type-table): New function.
(syncdoc-update-type-hierarchy): Make use of.
* doc/lispref/type_hierarchy.txt: Regenerate.
---
doc/lispref/type_hierarchy.txt | 169 ++++++-----------------------------------
etc/syncdoc-type-hierarchy.el | 25 ++++--
2 files changed, 42 insertions(+), 152 deletions(-)
diff --git a/doc/lispref/type_hierarchy.txt b/doc/lispref/type_hierarchy.txt
index 2ffee0b6a85..f68218b507a 100644
--- a/doc/lispref/type_hierarchy.txt
+++ b/doc/lispref/type_hierarchy.txt
@@ -1,147 +1,22 @@
- +--------------------+
- | bignum |
- +--------------------+
- |
- |
- v
- +-------------+ +--------------------+ +----------------------+
+--------+
- | fixnum | --> | integer | --> | integer-or-marker |
<-- | marker |
- +-------------+ +--------------------+ +----------------------+
+--------+
- | |
|
- | |
|
- v |
|
- +-------------+ +--------------------+ |
|
- | float | --> | number | |
|
- +-------------+ +--------------------+ |
|
- | |
|
- | |
|
- v |
|
- +--------------------+ |
| +------------------+ +--------------------+
+----------+ +--------+
- | number-or-marker |
<-----+----------------------------+ | tree-sitter-node | |
tree-sitter-parser | | user-ptr | | window |
- +--------------------+ |
+------------------+ +--------------------+
+----------+ +--------+
- | |
| |
| |
- | |
| |
| |
- v v
v v
v v
- +-------------+
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+----------------------------+
- | font-entity | --> |
| <-- | overlay |
- +-------------+ |
| +----------------------------+
- +-------------+ |
| +----------------------------+
- | font-object | --> |
| <-- | process |
- +-------------+ |
| +----------------------------+
- +-------------+ |
| +----------------------------+
- | font-spec | --> |
| <-- | structure |
- +-------------+ |
atom
| +----------------------------+
- +-------------+ |
| +----------------------------+
- | frame | --> |
| <-- | terminal |
- +-------------+ |
| +----------------------------+
- +-------------+ |
| +----------------------------+
- | hash-table | --> |
| <-- | thread |
- +-------------+ |
| +----------------------------+
- +-------------+ |
| +----------------------------+
- | mutex | --> |
| <-- | tree-sitter-compiled-query |
- +-------------+
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+----------------------------+
- | ^ ^
^ ^ ^ ^
^
- | | |
| | | |
|
- v | |
| | | |
|
- +--------------------+ | +----------------------+
| | +--------+ +-------+
+---------+
- +--------------------> | t | | | window-configuration |
| | | buffer | | class |
| condvar |
- | +--------------------+ | +----------------------+
| | +--------+ +-------+
+---------+
- | +--------------------+ |
| |
- | | byte-code-function | |
| |
- | +--------------------+ |
| |
- | | |
| |
- | | |
| |
- | v |
| |
- | +--------------------+ |
| |
- | | compiled-function | |
| |
- | +--------------------+ |
| |
- | | |
| |
- | | |
| |
- | v |
| |
- | +--------------------+ |
| |
- | +> | function | -+
| |
- | | +--------------------+
| |
- | | ^
| |
- | |
+--------------------------------------------------+--------------+------------------------+
- | |
| | |
- | | +--------------------+
| | |
- | | | subr-primitive |
| | |
- | | +--------------------+
| | |
- | | |
| | |
- | | |
| | |
- | | v
| | |
- | | +--------------------+
| | |
- | +- | subr |
<-----------------------------+----+ | |
- | +--------------------+
| | | |
- | +--------------------+
| | | |
- | | keyword | -+
| | | |
- | +--------------------+ |
| | | |
- | | |
| | | |
- | | |
| | | |
- | v |
| | | |
- | +--------------------+ |
| | | |
- | | symbol-with-pos | |
| | | |
- | +--------------------+ |
| | | |
- | | |
| | | |
- | | +----+
| | | |
- | v |
| | | |
- | +--------------------+ |
| | | |
- | +> | symbol |
------+-----------------------+ | | |
- | | +--------------------+ |
| | |
- | | ^ |
| | |
- | | +--------------------------+
| | |
- | |
| | |
- | | +--------------------+
| | |
- | | | null | -+
| | |
- | | +--------------------+ |
| | |
- | | | |
| | |
- | | | |
| | |
- | | v |
| | |
- | | +--------------------+ |
| | |
- | +- | boolean | |
| | |
- | +--------------------+ |
| | |
- | +--------------------+ |
| | |
- | | cons | |
| | |
- | +--------------------+ |
| | |
- | | |
| | |
- | | |
| | |
- | v |
| | |
- | +--------------------+ |
| | |
- | | list | <+
| | |
- | +--------------------+
| | |
- | |
| | |
- | |
| | |
- | v
| | |
- | +--------------------+
| | |
- +--------------------- | sequence |
| | |
- +--------------------+
| | |
- ^
| | |
- +------------------------+
| | |
- |
| | |
- | +--------------------+
| | |
- | | subr-native-elisp |
-----------------------------------+ | |
- | +--------------------+
| |
- |
| |
- |
+-------------------------------------------+ |
- | |
|
- | +--------------------+ |
|
- | | bool-vector | |
|
- | +--------------------+ |
|
- | | |
|
- | | |
|
- | v |
|
- | +-------------+ +-------------------------------------------------+
|
- | | string | --> | array |
|
- | +-------------+ +-------------------------------------------------+
|
- | ^ | ^
|
- | | | |
|
- | | | |
|
- | +--------------------+ | +----------------------+
|
- | | vector | | | char-table |
|
- | +--------------------+ | +----------------------+
|
- | |
|
- +----------------------------------------------+
|
-
|
- +--------------------+
|
- | module-function |
----------------------------------------------------------------------+
- +--------------------+
+| Type | Derived Types
|
+|-------------------+----------------------------------------------------------|
+| t | sequence atom
|
+| sequence | list array
|
+| atom | class structure tree-sitter-compiled-query
|
+| | tree-sitter-node tree-sitter-parser user-ptr font-object
|
+| | font-entity font-spec condvar mutex thread terminal
|
+| | hash-table frame buffer function window process
|
+| | window-configuration overlay integer-or-marker
|
+| | number-or-marker symbol array
|
+| number | float integer
|
+| number-or-marker | marker number
|
+| integer | bignum fixnum
|
+| symbol | keyword boolean symbol-with-pos
|
+| array | vector bool-vector char-table string
|
+| list | null cons
|
+| integer-or-marker | integer marker
|
+| compiled-function | byte-code-function
|
+| function | subr module-function compiled-function
|
+| boolean | null
|
+| subr | subr-native-elisp subr-primitive
|
+| symbol-with-pos | keyword
|
diff --git a/etc/syncdoc-type-hierarchy.el b/etc/syncdoc-type-hierarchy.el
index eebb092abae..cd0cae2f954 100644
--- a/etc/syncdoc-type-hierarchy.el
+++ b/etc/syncdoc-type-hierarchy.el
@@ -35,6 +35,7 @@
;;; Code:
(require 'cl-lib)
+(require 'org-table)
(eval-and-compile
(defconst syncdoc-lispref-dir (concat (file-name-directory
@@ -55,6 +56,23 @@
(goto-char (point-max))
(insert "}\n"))
+(defun syncdoc-make-type-table (file)
+ (with-temp-file file
+ (insert "|Type| Derived Types|\n|-\n")
+ (cl-loop for (type . children) in cl--type-hierarchy
+ do (insert "|" (symbol-name type) " |")
+ do (cl-loop with x = 0
+ for child in children
+ for child-len = (length (symbol-name child))
+ when (> (+ x child-len 2) 60)
+ do (progn
+ (insert "|\n||")
+ (setq x 0))
+ do (insert (symbol-name child) " ")
+ do (cl-incf x (1+ child-len)) )
+ do (insert "\n"))
+ (org-table-align)))
+
(defun syncdoc-update-type-hierarchy ()
"Update the type hierarchy representation used by the elisp manual."
(interactive)
@@ -63,10 +81,7 @@
(call-process-region nil nil "dot" t (current-buffer) nil "-Tjpg" "-o"
(expand-file-name "type_hierarchy.jpg"
syncdoc-lispref-dir)))
- (with-temp-buffer
- (syncdoc-insert-dot-content "TB")
- (call-process-region nil nil "graph-easy" t (current-buffer) nil "--output"
- (expand-file-name "type_hierarchy.txt"
- syncdoc-lispref-dir))))
+ (syncdoc-make-type-table (expand-file-name "type_hierarchy.txt"
+ syncdoc-lispref-dir)))
;;; syncdoc-type-hierarchy.el ends here