[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/pam d2dd6a9796 05/16: Add functions to report free and
From: |
ELPA Syncer |
Subject: |
[elpa] externals/pam d2dd6a9796 05/16: Add functions to report free and live index lists |
Date: |
Wed, 20 Sep 2023 12:59:09 -0400 (EDT) |
branch: externals/pam
commit d2dd6a9796c313e353818ab8e9543c40bc03e36e
Author: Onnie Lynn Winebarger <owinebar@gmail.com>
Commit: Onnie Lynn Winebarger <owinebar@gmail.com>
Add functions to report free and live index lists
---
table-allocation-manager.el | 27 ++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/table-allocation-manager.el b/table-allocation-manager.el
index 6c49ba6466..c608083432 100644
--- a/table-allocation-manager.el
+++ b/table-allocation-manager.el
@@ -2,7 +2,7 @@
;; Copyright (C) 2023 Onnie Lynn Winebarger
-;; Author: Onnie Lynn Winebarger <owinebar@>
+;; Author: Onnie Lynn Winebarger <owinebar@gmail.com>
;; Keywords: lisp, tools
;; This program is free software; you can redistribute it and/or modify
@@ -30,6 +30,8 @@
(eval-when-compile
(require 'cl-lib))
+(require 'queue)
+
(cl-defstruct (tam--table (:constructor tam--table-create (size))
(:copier tam--copy-table))
"Table with explicitly managed allocation"
@@ -93,8 +95,9 @@
"Get slot IDX of TBL"
(tam--slot-contents (aref (tam--table-slots tbl) idx)))
-(defun tam-store (tbl obj)
- "Store OBJ in TBL. Returns index or nil if table is full."
+(defun tam-allocate (tbl obj)
+ "Allocate slot in TBL with contents OBJ.
+Returns index or nil if table is full."
(let ((slot (tam--table-first-free tbl))
idx)
(when (not (tam-table-full tbl))
@@ -143,6 +146,24 @@ Signals an error if IDX is not in use."
(setf (tam--slot-contents slot) nil)
obj))
+(defun tam-table-free-list (tbl)
+ "Return list of free indices in TBL"
+ (let ((s (tam--table-first-free tbl))
+ (q (queue-create)))
+ (while s
+ (queue-enqueue q (tam--slot-index s))
+ (setq s (tam--slot-next s)))
+ (queue-all q)))
+
+(defun tam-table-live-list (tbl)
+ "Return list of live indices in TBL"
+ (let ((s (tam--table-first-used tbl))
+ (q (queue-create)))
+ (while s
+ (queue-enqueue q (tam--slot-index s))
+ (setq s (tam--slot-next s)))
+ (queue-all q)))
+
(provide 'table-allocation-manager)
;;; table-allocation-manager.el ends here
- [elpa] branch externals/pam created (now 0dcaa2cc9c), ELPA Syncer, 2023/09/20
- [elpa] externals/pam 40b679999a 01/16: Initial commit, ELPA Syncer, 2023/09/20
- [elpa] externals/pam 2804ad6832 04/16: First successfully byte-compiled version, ELPA Syncer, 2023/09/20
- [elpa] externals/pam adcdd8d6aa 03/16: Ignore byte-compiled files and others, ELPA Syncer, 2023/09/20
- [elpa] externals/pam 1eb72029e8 02/16: Update README.md, ELPA Syncer, 2023/09/20
- [elpa] externals/pam d2dd6a9796 05/16: Add functions to report free and live index lists,
ELPA Syncer <=
- [elpa] externals/pam 7b072b5457 07/16: Added API documentation to header., ELPA Syncer, 2023/09/20
- [elpa] externals/pam 21cf632947 13/16: Added documentation strings to struct fields, ELPA Syncer, 2023/09/20
- [elpa] externals/pam bc654b6d68 14/16: Change data structures to primitive representation., ELPA Syncer, 2023/09/20
- [elpa] externals/pam 0dcaa2cc9c 16/16: Provide two versions for tam-release, one with and one without finalization., ELPA Syncer, 2023/09/20
- [elpa] externals/pam fe28ad02db 06/16: Fixed tam-allocate and tam-free functions., ELPA Syncer, 2023/09/20
- [elpa] externals/pam c74c0e06b5 12/16: Improve tam-create-pool docstring, ELPA Syncer, 2023/09/20
- [elpa] externals/pam acb2a6cbbb 11/16: Add object pool management, ELPA Syncer, 2023/09/20
- [elpa] externals/pam cbc1727fea 08/16: Fixed some issues with tam-table-used and tam-table-size., ELPA Syncer, 2023/09/20
- [elpa] externals/pam 15106c6acd 15/16: Define tam-already-free error symbol, ELPA Syncer, 2023/09/20
- [elpa] externals/pam 0f1f5cf265 10/16: Use cl-loop instead of queue package, ELPA Syncer, 2023/09/20