id
int64
0
45.1k
file_name
stringlengths
4
68
file_path
stringlengths
14
193
content
stringlengths
32
9.62M
size
int64
32
9.62M
language
stringclasses
1 value
extension
stringclasses
6 values
total_lines
int64
1
136k
avg_line_length
float64
3
903k
max_line_length
int64
3
4.51M
alphanum_fraction
float64
0
1
repo_name
stringclasses
779 values
repo_stars
int64
0
882
repo_forks
int64
0
108
repo_open_issues
int64
0
90
repo_license
stringclasses
8 values
repo_extraction_date
stringclasses
146 values
sha
stringlengths
64
64
__index_level_0__
int64
0
45.1k
exdup_ids_cmlisp_stkv2
sequencelengths
1
47
25,917
cl-lib-clos-facets.asd
Bradford-Miller_CL-LIB/cl-lib-clos-facets.asd
;; Time-stamp: <2019-07-07 13:36:20 Bradford Miller(on Aragorn.local)> ;; This portion of CL-LIB Copyright (C) 2019 Bradford W. Miller ;; ;; 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.0 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 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, see <http://www.gnu.org/licenses/>. ;; miller - Brad Miller ([email protected]) ;; (defsystem :cl-lib-clos-facets ;; (:default-pathname "CL-LIB:packages;") ;; :members ((:cl-lib-essentials :type :system) ;; "clos-facets" ;; "clos-facet-defs" ;; ;; while debugging ;; "clos-facets-tests") ;; :rules ((:in-order-to :compile :all (:requires (:load :previous))) ;; (:in-order-to :compile ("clos-facet-defs" "clos-facets-tests") ;; (:caused-by (:compile "clos-facets")) ;; (:requires (:load "clos-facets"))))) (in-package :asdf) (defsystem :cl-lib-clos-facets :name "cl-lib-clos-facets" :serial t :depends-on (:cl-lib-essentials) :components ((:module "packages" :serial t :components ((:file "clos-facets") (:file "clos-facet-defs")))))
1,673
Common Lisp
.asd
34
46.323529
102
0.655426
Bradford-Miller/CL-LIB
1
0
1
LGPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
d52e8eb5e7bbdafc07cbe3da2c032372592dee115df6abf0e930875e2bd28aa5
25,917
[ -1 ]
25,919
cl-lib-essentials.asd
Bradford-Miller_CL-LIB/cl-lib-essentials.asd
;; Time-stamp: <2019-02-17 10:16:28 Bradford Miller(on Aragorn.local)> ;; This portion of CL-LIB Copyright (C) 2000-2017 Bradford W. Miller ;; ;; 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.0 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 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, see <http://www.gnu.org/licenses/>. ;; miller - Brad Miller ([email protected]) (now [email protected]) ;; new fractured cl-lib, with multiple defsystems for each package. So the "right ones" can be added as needed. ;; NB: ADSF discourages use of logical pathnames, so we've rewritten to only use relative pathnames here. ;;; For a History of recent changes, see the file cl-lib-news in this directory. (in-package :asdf) (defsystem :cl-lib-essentials :name "cl-lib-essentials" :components ((:module PACKAGE-DEF :pathname "functions" :components ((:file "cl-lib-defpackage"))) (:module "packages" :depends-on (PACKAGE-DEF) :components ((:file "initializations") #+5am (:file "initializations-tests"))) (:module "functions" :depends-on (PACKAGE-DEF "packages") :components ((:file "cl-lib-essentials") ;; moved here because of sbcl (:file "cl-extensions" :depends-on ("cl-lib-essentials")) (:file "clos-extensions" :depends-on ("cl-extensions")) ))))
1,930
Common Lisp
.asd
36
46.861111
111
0.680637
Bradford-Miller/CL-LIB
1
0
1
LGPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
f2ebfecb2cdd45f443dc3a174fc9699b6faf2a3a4998b955a46568dca2ca9018
25,919
[ -1 ]
25,920
cl-lib-transcripts.asd
Bradford-Miller_CL-LIB/cl-lib-transcripts.asd
;; Time-stamp: <2019-01-27 16:54:38 Bradford Miller(on Aragorn.local)> ;; This portion of CL-LIB Copyright (C) 2019 Bradford W. Miller ;; ;; 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.0 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 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, see <http://www.gnu.org/licenses/>. ;; miller - Brad Miller ([email protected]) ;; new fractured cl-lib, with multiple defsystems for each package. So the "right ones" can be added as needed. (in-package :asdf) (defsystem :cl-lib-transcripts :depends-on (:cl-lib-essentials) :components ((:module "packages" :serial t :components ((:file "transcripts")))))
1,151
Common Lisp
.asd
20
54.95
111
0.74911
Bradford-Miller/CL-LIB
1
0
1
LGPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
7180fdb1f2bfd96b1978d53cd254f00fcda971fbb49f58a7a46c8a00523699ee
25,920
[ -1 ]
25,921
cl-lib-reader.asd
Bradford-Miller_CL-LIB/cl-lib-reader.asd
;; Time-stamp: <2019-01-27 17:55:16 Bradford Miller(on Aragorn.local)> ;; This portion of CL-LIB Copyright (C) 2019 Bradford W. Miller ;; ;; 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.0 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 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, see <http://www.gnu.org/licenses/>. ;; miller - Brad Miller ([email protected]) ;; new fractured cl-lib, with multiple defsystems for each package. So the "right ones" can be added as needed. (in-package :asdf) (defsystem :cl-lib-reader :depends-on (:cl-lib-essentials) :components ((:module "packages" :serial t :components ((:file "reader")))))
1,141
Common Lisp
.asd
20
54.45
111
0.746858
Bradford-Miller/CL-LIB
1
0
1
LGPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
741687cfc82e65f76f7e7da25fec3b252bcd4e6f143c59ae1bb4d0b5503a3cac
25,921
[ -1 ]
25,922
cl-lib-resources.asd
Bradford-Miller_CL-LIB/cl-lib-resources.asd
;; Time-stamp: <2019-03-01 16:59:26 Bradford Miller(on Aragorn.local)> ;; This portion of CL-LIB Copyright (C) 2019 Bradford W. Miller ;; ;; 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.0 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 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, see <http://www.gnu.org/licenses/>. ;; miller - Brad Miller ([email protected]) ;; new fractured cl-lib, with multiple defsystems for each package. So the "right ones" can be added as needed. (in-package :asdf) (defsystem :cl-lib-resources :depends-on (:cl-lib-essentials) :components ((:module "packages" :serial t :components ((:file "resources") #+5am (:file "resources-tests")))))
1,189
Common Lisp
.asd
22
51.136364
111
0.740517
Bradford-Miller/CL-LIB
1
0
1
LGPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
42eadc0e8cbcba2bc5eed44394f5cb19508732169451e44367a4a4a43c6cff68
25,922
[ -1 ]
25,923
cl-lib-locatives.asd
Bradford-Miller_CL-LIB/cl-lib-locatives.asd
;; Time-stamp: <2019-01-27 16:49:11 Bradford Miller(on Aragorn.local)> ;; This portion of CL-LIB Copyright (C) 2019 Bradford W. Miller ;; ;; 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.0 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 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, see <http://www.gnu.org/licenses/>. ;; miller - Brad Miller ([email protected]) ;; new fractured cl-lib, with multiple defsystems for each package. So the "right ones" can be added as needed. (in-package :asdf) (defsystem :cl-lib-locatives :depends-on (:cl-lib-essentials) :components ((:module "packages" :serial t :components ((:file "locatives")))))
1,147
Common Lisp
.asd
20
54.75
111
0.748214
Bradford-Miller/CL-LIB
1
0
1
LGPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
d2110fc8b7d8dbb19457f9fc099ad5ee65a6623c4de42a9c919368b5e5e28e9d
25,923
[ -1 ]
25,924
cl-lib-all.asd
Bradford-Miller_CL-LIB/cl-lib-all.asd
;; Time-stamp: <2019-02-23 16:50:40 Bradford Miller(on Aragorn.local)> ;; This portion of CL-LIB Copyright (C) 2019 Bradford W. Miller ;; ;; 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.0 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 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, see <http://www.gnu.org/licenses/>. ;; miller - Brad Miller ([email protected]) ;; new fractured cl-lib, with multiple defsystems for each package. So the "right ones" can be added as needed. (in-package :asdf) (defsystem :cl-lib-all :depends-on ( :cl-lib-essentials :cl-lib #+lispworks :cl-lib-console :cl-lib-scheme-streams :cl-lib-queues :cl-lib-better-errors :cl-lib-prompt-and-read :cl-lib-locatives :cl-lib-resources :cl-lib-syntax :cl-lib-nregex :cl-lib-chart :cl-lib-transcripts :cl-lib-reader :cl-lib-clos-facets :cl-lib-lispdoc))
1,380
Common Lisp
.asd
19
67.526316
111
0.726331
Bradford-Miller/CL-LIB
1
0
1
LGPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
d719275491b4bd33ee8d7a1d4561dd434702814859567e9c4b73e5e876b77657
25,924
[ -1 ]
25,925
cl-lib-console.asd
Bradford-Miller_CL-LIB/cl-lib-console.asd
;; Time-stamp: <2019-02-23 15:25:25 Bradford Miller(on Aragorn.local)> ;; This portion of CL-LIB Copyright (C) 2019 Bradford W. Miller ;; ;; 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.0 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 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, see <http://www.gnu.org/licenses/>. ;; miller - Brad Miller ([email protected]) ;; new fractured cl-lib, with multiple defsystems for each package. So the "right ones" can be added as needed. (in-package :asdf) ;; NB: this package only currently works with lispworks! (defsystem :cl-lib-console :depends-on (:cl-lib-essentials) :components ((:module "packages" :serial t :components ((:file "popup-console")))))
1,207
Common Lisp
.asd
21
54.904762
111
0.749576
Bradford-Miller/CL-LIB
1
0
1
LGPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
03da5394704c885a08bab1272d348db233eaf6c622add6bcad8b9f2e9fcec72c
25,925
[ -1 ]
25,926
series.asd
Bradford-Miller_CL-LIB/packages/SERIES/series.asd
;;; -*- Mode: lisp -*- (defpackage #:series-system (:use #:common-lisp)) (in-package #:series-system) (asdf:defsystem series :description "See <http://series.sourceforge.net/>." :author "Richard C. Waters" :maintainer "See <http://series.sourceforge.net/>." :licence "MIT" :version "2.2.11" :serial t :components ((:file "s-package") (:file "s-code"))) (asdf:defsystem series-tests :depends-on (series) :components ((:file "s-test")))
494
Common Lisp
.asd
16
26.1875
56
0.622363
Bradford-Miller/CL-LIB
1
0
1
LGPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
0f0806b05539073a9b930926b7319ff3faa27ac4d813bafbd5a2c8ae67004e1f
25,926
[ -1 ]
25,927
readme-cl-lib.text
Bradford-Miller_CL-LIB/readme-cl-lib.text
;; Time-stamp: <2007-05-18 11:10:21 miller> ;; CVS: $Id: readme-cl-lib.text,v 1.1.1.1 2007/11/19 17:19:09 gorbag Exp $ ORIGINAL README: CL-LIB is a collection of lisp packages and routines that I've found useful over my Common Lisp code authoring career (since 1986) and in some cases derives from lisp code I have written during my Franz lisp and Zetalisp days prior to that (since 1982). :cl-lib is a compilable loadable system (once you load cl-lib/defsystem), and is compatible with allegro 4.1 thru 5.0 (the latest version I have) though it probably will work with later versions as well. I've also succesfully used it (the minimal-cl-lib) with MCL, versions 3.0 through version 5.0 (Again, the latest version I have), and Lispworks v4.1 through version 4.4.5 In particular, cl-lib has files that: Extend particular vendor lisps: extend allegro's defsystem with edit-system and provide example-modules (loadable but not compilable files); See the directory allego extend other lisps such as MCL, LispWorks in their respective directories A variety of library functions (see directory functions) that extend the massive library "built in" to common lisp, with other frequently reused code or markup. A series of separarable "packages" (see packages directory) that include: An initializations package similar to what was available on MIT lisp machine descendants. This lets you declare code to be run at certain prespecified times, either directly under programmer control, or during startup, before GC, etc. Some additional compatibility functions wrt processes between allegro and symbolics (see compatibility/process.lisp) re to dfa converter (re-to-dfa.lisp) (Regular Expression to Deterministic Finite Automaton) A version of lisp-machine resources for any CL (puts you in control of memeory management). See resources.lisp Even with modern GC, you may find structures that are "expensive" to initialize and are frequently reused can benefit from this code. It also may allow you to move the initialization cost to compile-time. A transcription package which makes it easy to convert your format statements to something that can be captured during a program run into a file, and optionally depend on a global debug level. Packages for specialized algorithms, including triangular matrices and charts, which are further described in their individual files. If you have any problems with these tools, I'd like to hear about it. In addition there are a variety of pd/freeware tools available in this directory the I **don't** maintain, but these files should point to the owner. 6/23/05 DIRECTORY ORGANIZATION UPDATE I've reorganized the directory and files (e.g., packages) to make certain tools easier to find and break out so the entire library doesn't need to be loaded. There are now subdirectories for each major lisp implementation with implementation specific functions and packages moved there. Other functions may have implementation dependencies, but will generally work in all implementations if loaded. There is a new subdirectory 'packages' for files that implement a packaged functionality (e.g., regular expression matching, or resources). There is another new subdirectory 'functions' for files that implement individual functions and macros (that is, each function or macro is in some sense stand-alone). This should make it easier to load only the functionality of interest for a particular project. In particular, each of the "packages" have their own defsystem, and routines that are necessary for anything are combined into functions/cl-lib-essentials.lisp, and loaded along with package information with (load-system :cl-lib-essentials).
3,690
Common Lisp
.cl
1
3,689
3,690
0.798645
Bradford-Miller/CL-LIB
1
0
1
LGPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
010b9807efd9a82234e626100f5e095be65d4534b437ecf7b375908e07e24e86
25,927
[ -1 ]
25,932
cl-lib-news
Bradford-Miller_CL-LIB/cl-lib-news
;; Time-stamp: <2022-01-31 12:53:27 gorbag> ;; 5.20f - 1/31/22 by miller Add remove-keyword-args - allows more ;; efficient removal of multiple keywords in one call ;; xxx - 9/ 6/21 by miller export functions in string.lisp ;; 5.19f - 2/ 8/21 by miller make remove-keyword-arg more robust to odd numbers of argument in argument-list ;; 5.18 - 1/ 3/20 by miller Fix some tests, make fast-union use #'eql as default predeicate ;; 5.17 -10/26/19 by miller Add lispworks specific (gc aware) code to resources ;; various fixes to the test suite ;; 5.16 - 2/18/19 by miller Start to add FiveAM tests to allow automated regression testing, particularly for ;; packages (rather than individual functions). FiveAM is NOT required ;; to use CL-LIB, however, if it is loaded, before CL-LIB is, ;; you will be able to run the regression ;; tests too. First cut: initializations.lisp ;; Additionally, port initializations.lisp to SBCL, add SBCL specific code to ;; interactive-lisp-p, getenv, get-compiled-function-name, make-keyword ;; ;; 5.15 - 1/27/19 by miller Add asdf (.asd) files to distro as developed for sbcl (ROSlisp). ;; 5.15p Add *debug-initializations* to initializations.lisp ;; 5.14f -12/16/11 by miller add detailed-version-reporter for 3.4.5 type versions numbers ;; 5.13p -11/16/11 by miller add *suppress-logs* to transcript package to ;; make it easy to override lower-level code while testing ;; 5.12p -11/10/11 by miller Have open-log-stream-for-module make sure it gets a valid module name ;; 5.13f -10/19/11 by miller Lispworks now has it's own true-list-p function so use that one on that platform ;; 5.11p - 5/16/11 by miller LispWorks 64-bit has different GC functions ;; 5.12f- 7/11/08 by miller de-alistify, dotted-list-p, dotted-list ;; 5.10p- 6/16/08 by miller comment out use of low package in locatives.lisp ;; 5.11f- 5/ 3/08 by miller same as 5.9p ;; 5.9p- 5/ 3/08 by miller Update licenses per file to GNU-3.0 if no prior (C) notice present ;; 5.8p- 5/ 2/08 by miller Transcripts: open-transcript-stream-p open-log-stream-p ;; 5.10f- 4/23/08 by miller export *keyword-package* in LW ;; 5.9f - 2/19/08 by miller New fn - tail-equalp (cl-list-fns.lisp) ;; 5.8f - 1/30/08 by miller New fn - key-value-list-p (keywords.lisp) ;; 5.7f - 11/22/07 by miller Add documentation strings to a number of functions and packages (lipdoc) ;; 5.7p - 11/22/07 by miller Add documentation strings to a number of functions and packages (lipdoc) ;; Add *quit-initialization-list*, and bind for LispWorks ;; 5.6f - 10/10/07 by miller Add getenv (cross-platform interface to getting environment variable values) ;; 5.5f - 7/12/07 by miller Enhance make-load-form-with-all-slots for ;; flexability, in particular to deal with slots ;; whose values are themselves structures (and ;; thus need to have make-load-form called). ;; 5.6p - 7/10/07 by miller Added write-log-header generic fn to transcripts ;; 5.4f - 3/28/07 by miller Added alistify to cl-list-fns ;; 5.3f - 3/13/07 by miller Added slot-for-initarg to clos-extensions ;; 5.2f - 2/01/07 by miller Added update-alist-alist; Enhanced ;; extract-keyword to return the whole binding ;; list for destructive modification if desired ;; 5.1f - 12/31/06 by miller Added remove-n and delete-n to list functions ;; 5.5p - 9/29/06 by miller A number of improvements to clos-facets, tests ;; now load under LispWorks, multiple values ;; partially implemented ;; 5.4p - 9/29/06 by miller Added LispDoc (Sven Van Caekenberghe) to ;; 5.3p - 7/28/06 by miller Make lispworks defsystem use CL_LIB_BASE to ;; determine where CL-LIB is installed; use ;; logical pathnames ;; 5.2p - 2/11/06 by miller preliminary version of facets ;; 5.1p - 7/12/05 by miller add interactive-lisp-p to cl-lib-essentials ;; change defaults for version printing, ;; etc. based on that. ;; 5.0fp - 6/24/05 by miller Reorganized directories. New popup-console ;; package for lispworks Make initializations ;; silent on lispworks in a delivered image ;;; Older entries ;; 4.46 - 1/ 9/03 by abm061 Bug fix to rlist-to-scheme-stream; stream ;; was not being correctly returned. ;; 4.45 - 12/18/02 by abm061 Have scheme-force return first-time-p as ;; second value, similarly have ss-tail ;; return second value if computed from ;; closure ;; 4.44 - 12/04/02 by abm061 Formatting, moved scheme-streams from ;; cl-extensions.lisp to their own file ;; 4.43 - 10/30/02 by abm061 Fix timestamp dropping ;; Update to latest version of series (2.2.5) ;; 4.42 - 8/29/02 by abm061 frame-pane (in cl-lib-extensions) already ;; defined in lispworks! ;; Reformat this file for 80col ;; 4.41 - 7/23/02 by abm061 remove-keyword-arg now returns multiple ;; values ;; 4.40 - 6/10/02 by abm061 Update locatives.lisp for Lispworks 4.2 ;; 4.39 - 6/07/02 by abm061 Finish port of initilizations.lisp for ;; Lispworks ;; 4.38 - 6/07/02 by miller New clim-extensions.lisp ;; 4.37 - 6/06/02 by abm061 resources.lisp not needed by LispWorks ;; 4.36 - 6/04/02 by abm061 Updated get-compiled-function-name for ;; LispWorks 4.2 ;; 4.35 - 6/03/02 by abm061 Updated initializations.lisp for LispWorks ;; 4.34 - 12/27/01 by miller Add an assert to scheme-force to make sure ;; it has a valid argument (to help debug ;; using code) ;; 4.33 - 12/03/01 by miller Change timestamp to use leading 0s for ;; day/month field for more consistent ;; results column-wise. ;; 4.32 - 11/30/01 by miller First part of a port to LispWorks, fixed a ;; problem lispworks has with #|| pairs that ;; span lines in initializations.lisp by ;; changing it to a #+hell-freezes-over ;; directive. ;; Port to lispworks of locatives and ;; defsystem construction of minimal-cl-lib ;; by [email protected] ;; 4.31 - 11/01/01 by miller Add Waters/Norviq queue operations ;; (queues.lisp) ;; 4.30 - 10/25/01 by miller Add prompt-and-read to minimal-cl-lib. ;; 4.29 - 9/ 7/01 by miller Fix calls to open-stream-p in transcripts ;; for MCL (doesn't like getting called on ;; NIL) ;; 4.28 - 9/ 7/01 by miller Add rlist-to-scheme-stream and ;; fake-scheme-delay to round out schemey ;; functions ;; 4.27 - 9/ 4/01 by miller Add tassert (transcript assert) a function ;; originating in TDS to the transcript ;; package. ;; 4.26 - 3/ 8/01 by miller Add some compatibility functions for ;; CLOS/MOP (MCL only) by Shannon Spires, ;; and reenable clos-extensions.lisp for MCL ;; in minimal version. ;; 4.25 - 3/ 7/01 by miller add some compatibility functions for ;; CLOS/MOP (MCL only) ;; 4.24 - 3/ 2/01 by miller add new timestamp features for FRED ;; (MCL only) ;; 4.23.1 - 4/ 6/00 by miller don't export NEQ in MCL (part of CCL). ;; 4.23 - 2/21/00 by miller port Minimal CL Lib to MCL 4.3 ;; 4.22.3 - 1/27/00 by miller Fix locatives under allegro 5.0.1 to ;; appropriately handle (locf *global*) forms. ;; 4.22.2 - 12/21/99 by miller Zero pad dates in the transcript ;; 4.22.1 - 12/21/99 by miller Additional exports on transcripts ;; 4.22 - 12/20/99 by miller Integrate transcripts package from TDS ;; 4.21 - 12/04/99 by miller command-line-arg from trains (may only be ;; useful in allegro, but lets one get ;; command line arguments by name). ;; 4.20 - 11/22/99 by miller fix toplevel:setq-default in allegro-stuff ;; in case toplevel isn't there! ;; 4.19 - 11/18/99 by miller fix so delayed-lep-init doesn't run when ;; lep hasn't started. ;; 4.18 - 12/ 2/98 by miller new module: charts for constructing chart ;; parsers and the like. ;; 4.17.2- 5/15/98 by miller fix another bug in ;; generate-inherited-slot-writer; mapcan ;; wasn't being called on list of response. ;; (spliced too deep) ;; 4.17.1- 5/14/98 by miller fix bug in generate-inherited-slot-writer; ;; didn't check that the slot was bound ;; before building the writer. ;; 4.17 - 5/13/98 by miller new function - remove-keyword-arg ;; 4.16 - 4/ 3/98 by miller ignore writer slots for objects that have ;; no :writer :accessor or :initarg ;; 4.15 - 2/ 9/98 by miller handle lists of structurses in structure ;; slot (clos object printer) ;; 4.14 - 2/ 4/98 by miller make clos object printer handle a hook fn ;; to determine when to quote ;; 4.13 - 2/ 3/98 by miller fixup clos object printer to deal with clos ;; objects in slots ;; 4.12 - 4/18/96 by miller updates to locatives package (allegro 4.3.1) ;; 4.11 - 4/17/96 by miller add defsys:release-system function for ;; allegro md-defsystem ;; 4.10 - 1/12/96 by miller file reorganization; allow for a more ;; minimal version to be built for apps. ;; 4.9 - 12/12/95 by miller export more of the clos helper code, add ;; something to list initargs for a class. ;; 4.8 - 7/ 7/95 by miller (allegro only), add foreign-syntax ;; defsystem module types. ;; 4.7 - 6/29/95 by miller add force-list (from tt). ;; 4.6 - 6/12/95 by miller add syntax.lisp, defines with-syntax and ;; add-syntax for readtable handling. ;; 4.5 - 2/21/95 by miller update reader to use clim when available. ;; 4.4 - 2/ 8/95 by miller patch allegro's map-system to only hit ;; things once. ;; 4.3 - 1/12/95 by miller have edit-system default to including ;; components. ;; 4.2 - 1/ 5/95 by miller fix random-state patch (use ;; tpl:setq-default) ;; 4.1 - 12/19/94 by miller add *supress-clim* variable to ;; prompt-and-read ;; 4.0 - 12/ 6/94 by miller What the hell, start a new version number ;; (and put newest version on top so you can ;; easily locate the last change). ;; Add clos-extensions.lisp. Basically, it's ;; useful to make-load-form using these ;; functions which will figure out the slots ;; and how to dump them for you. Like ;; make-load-form-saving-slots, but wraps ;; things up in one form and handles ;; inherited slots. ;; 3.30 - 8/27/92 by miller make allegro initialize *random-state* on warm boot ;; 3.31 - 9/25/92 by miller add indent methods for allegro (for the macros) ;; 3.32 - 9/28/92 by miller add describe-object method for allegro for hashtables to describe the contents ;; 3.33 - 9/28/92 by miller add :lep initialization list (runs after lep interface started). ;; 3.34 - 10/29/92 by miller update re-to-dfa for ascii (had symbolics character types for operators) ;; 3.35 - 11/12/92 by miller update parser error to return a file position when possible. ;; 3.36 - 11/16/92 by miller increase sleep before :lep initializations are run to 8 secs. ;; 3.37 - 11/20/92 by miller Add scheme stream model, and scheme force/delay (code by [email protected]) ;; 3.38 - 11/30/92 by miller Remove clim code from warn-or-error... just use more normal case. May want to recast in ;; terms of conditions (eventually). ;; 3.39 - 12/2/92 by miller export scheme-stream-p ;; 3.40 - 12/3/92 by miller new function: progfoo ;; 3.41 - 12/8/92 by miller add Dick Waters series package to cl-lib (also man pages supplied for fi:clman). ;; 3.42 - 12/10/92 by miller fix case sensitivity in macro-indent-rule (really a problem in fi/emacs, by my estimate, since ;; it's the function that's case sensitive, but easy to just coerce everything to lowercase here). ;; 3.43 - 12/31/92 by miller fix map-resource to use funcall instead of apply of user function. ;; 3.44 - 1/ 7/93 by miller add mv-progfoo; prog1 is to progfoo as multiple-value-prog1 is to mv-progfoo. ;; make ss-head and ss-tail handle non scheme-stream arguments by returning nil (allows cdr of ;; nil type metaphor to be handled consistant with normal lists). ;; 3.45 - 1/28/93 by miller minor enhancement to reader to eval expressions beginning with #\( <since that's what I ;; always type :-) ;; 3.46 - 2/ 8/93 by miller add with-rhyme macro (doesn't do anything, but is a nice "commentary" on specious code; no ;; reason so must be rhyme :-). ;; 3.47 - 2/15/93 by miller add get-compiled-function-name from example in email. ;; 3.48 - 2/26/93 by miller add fast-read-char and fast-read-file-char from [email protected] ;; 3.49 - 3/ 1/93 by miller add maplist-dotted-list for orthogonality ;; 3.50 - 3/ 2/93 by miller fix bug in above - was nconcing results instead of appending them. ;; 3.51 - 4/ 7/93 by miller have let-maybe do constant folding ;; 3.52 - 4/ 8/93 by miller add more logical functions: xor, eqv, nand and nor. Short circuit too! ;; 3.53 - 4/ 9/93 by miller integrate some of Mark K's new functions, eg. the query library. (already partly used from ;; earlier version) ;; 3.54 - 4/26/93 by miller No new code, just reorganization into essential and non-essential directories; the latter ;; not being loaded by the defsystem (not needed by Rhet, Shocker, etc.). Much duplicates ;; what's in Mark K's repository too. ;; 3.55 - 5/19/93 by miller patch to allegro #n# macro to handle common cases of ;; non-circular eq preservation inside classes. ;; 3.56 - 5/24/93 by miller add list-scheme-stream; an analogue to cl:list for scheme-streams. ;; 3.57 - 5/28/93 by miller reimplement the dotted-list functions for higher efficiency (avoid nreverse), and avoid consing. ;; 3.58 - 6/ 1/93 by miller reimplement fast-union, fast-intersection for even higher efficiency (no nreverse). ;; 3.59 - 6/ 4/93 by miller change resources to use defstruct and single get for efficiency. ;; 3.60 - 6/11/93 by miller add portable version of locatives (well, a simulation of them). ;; 3.61 - 6/14/93 by miller generalize above, translation table provided for allegro (now walks code). ;; 3.62 - 6/18/93 by miller add nregex code to cl-lib; more flexible (though slower) than re-to-dfa. ;; 3.63 - 6/18/93 by miller incorporate some suggestions by [email protected] into locative code. ;; 3.64 - 7/14/93 by miller put unwind-protect into raw-read-char code for allegro, so we don't get stuck in wrong mode ;; 3.65 - 8/ 4/93 by miller add :cl-lib to *features* ;; 3.66 - 10/20/93 by miller add raw-read-char-no-hang (for allegro) ;; 3.67 - 10/21/93 by miller add extra delay to the raw-read stuff since the :cbreak isn't synchronous (sigh). ;; 3.68 - 12/ 9/93 by miller add :lep feature if lep is present (for allegro), add while-not function ;; (I'd call it until, but series takes that). ;; 3.69 - 12/29/93 by miller add copy-array ;; 3.70 - 12/29/93 by miller update/improve resources code to define resource-specific (de)allocators, etc. ;; 3.71 - 1/ 4/94 by miller add triangular array support (triangular-matrices.lisp) ;; 3.72 - 1/ 5/94 by miller export copy-tarray, fix vanished taref-lower-tarray (overzealous kill?) ;; 3.73 - 1/ 7/94 by miller fix bug in copy-tarray; reused dimensions from original array, instead of copying it (a list). ;; 3.74 - 1/13/94 by miller fix bug in resources (code added in 3.70) that didn't properly splice in generated macro. ;; 3.75 - 1/14/94 by miller minor changes for compatiblity with allegro 4.2 final. ;; 3.76 - 1/31/94 by miller add back in some code to resrouces (e.g. map-foo) ;; 3.77 - 2/ 4/94 by miller make update-alist eval in ltr order; dotted list functions now only expand passed fn once. ;; 3.78 - 2/11/94 by miller separate error handling from cl-extensions into better-errors.lisp. Add clim hander for parse-error. ;; add new "check" function; an enhanced version of assert. ;; 3.79 - 4/ 6/94 by miller add prompt-and-read, prompt-for, and George Ferguson's popup-read-form and popup-error (clim only). ;; the former use the latter if clim is available to create a popup window. ;; 3.80 - 4/10/94 by miller port to MCL 2.0.1 ;; 3.81 - 4/25/94 by miller add load-once to minimize reloading of files outside a defsystem. ;; 3.82 - 5/ 2/94 by miller add new allegro single-writer multi-reader character stream, for async ipc. ;; 3.83 - 5/ 4/94 by miller export convert-to-presentation-type since it's generally useful for clim users. ;; 3.84 - 5/ 4/94 by miller also separate and export *default-presentation-type* for the above; define clear-load-once. ;; 3.85 - 5/ 4/94 by miller enhance 3.82's stream for better read-line performance, and handle stream-line-column and stream-start-line-p messages. ;; 3.86 - 5/ 5/94 by miller fix glitch in add-initialization when list not previously bound. ;; 3.87 - 5/ 6/94 by miller add clim-prompt-for-with-default ;; 3.88 - 5/ 9/94 by miller fix bug in stream-unread-char for string-io-stream. ;; 3.89 - 5/26/94 by miller change abort handler in clim prompt-and-read functions to see if an abort restart is present, ;; and if not, to simply return the values (NIL T). ;; 3.90 - 6/14/94 by miller don't have popup-read-form initially select the form, since the default then disappears. ;; 3.91 - 6/21/94 by miller make convert-to-presentation-type a generic function, handle satisfies by way of ;; convert-satisfies-to-presentation-type generic function (exported). ;; 3.92 - 6/22/94 by miller add string-io-stream-mw - a new multi-writer string-io-stream protocol. ;; 3.93 - 7/ 5/94 by miller fix bug in mw protocol (not fixing up current writer). ;; detect & error on empty record write in mw protocol. (terpri with no prior write). ;; 3.94 - 7/ 7/94 by miller fix off by one error in stream:stream-listen on string-io-streams ;; 3.95 - 7/12/94 by miller when closing string-io-stream, don't modify writer, just set eof-p to true. ;; 3.96 - 7/14/94 by martin no longer export occurs. ;; 3.97 - 7/21/94 by miller add stream:stream-input-available-p interface for streams. Calls stream-listen by default, but ;; if not interactive, always returns t (so you see the eof). ;; define, but don't implement flush-stream-buffer. ;; 3.98 - 8/ 2/94 by miller don't export lookup. ;; 3.99 - 11/17/94 by miller add md-defsystem for allegro, similar to example in manual: allows for ;; a development and master (release) directory. ;; 3.100- 11/21/94 by miller explicitly convert directory info to pathname in above. ;; ;; ;; suggestions/comments/complaints/contributions ;; welcome! Send them to [email protected] and mark ;; them FOR CL-LIB. ;; ;; NB: [email protected], [email protected], [email protected], ;; [email protected], "gorbag" in the timestamps and [email protected] all refer to ;; the same person (AFAIK). [email protected] is the best address to reach me at for ;; anything about this library; the other addresses are obsolete.
22,054
Common Lisp
.l
282
76.833333
148
0.600138
Bradford-Miller/CL-LIB
1
0
1
LGPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
71d0242711fb3d010813ed4aa4dc5d9a08b5156be6a90c1038a5c9b1750a8dd6
25,932
[ -1 ]
25,942
CL-LIB.html
Bradford-Miller_CL-LIB/CL-LIB.html
<html><head><title>CL-LIB</title></head><body><h3>API for package CL-LIB</h3> <blockquote>UNDOCUMENTED</blockquote> <p><b>*after-gc-initialization-list*</b>&nbsp;&nbsp;&nbsp;<i>variable</i></p> <blockquote>Initializations to be run after a gc</blockquote> <blockquote>Initial value: <tt>NIL</tt></blockquote> <p><b>*before-cold-initialization-list*</b>&nbsp;&nbsp;&nbsp;<i>variable</i></p> <blockquote>Initializations run just before saving a non-checkpointed world</blockquote> <blockquote>Initial value: <tt>(#S(CL-LIB-INITIALIZATIONS::INITIALIZATION :NAME "User Notification" :FORM (IF (CL-LIB-ESSENTIALS:INTERACTIVE-LISP-P) (FORMAT *ERROR-OUTPUT* "~2&--> Running Before-Cold Initializations~2%")) :FLAG NIL :RUN (:NORMAL)) #S(CL-LIB-INITIALIZATIONS::INITIALIZATION :NAME "Reset Cold Initializations" :FORM (CL-LIB-INITIALIZATIONS:RESET-INITIALIZATIONS (QUOTE CL-LIB-INITIALIZATIONS:*COLD-INITIALIZATION-LIST*)) :FLAG NIL :RUN (:NORMAL)))</tt></blockquote> <p><b>*cold-initialization-list*</b>&nbsp;&nbsp;&nbsp;<i>variable</i></p> <blockquote>Initializations run just after booting a non-checkpointed world</blockquote> <blockquote>Initial value: <tt>(#S(CL-LIB-INITIALIZATIONS::INITIALIZATION :NAME "User Notification" :FORM (IF (CL-LIB-ESSENTIALS:INTERACTIVE-LISP-P) (FORMAT *ERROR-OUTPUT* "~2&--> Running Cold Initializations~2%")) :FLAG T :RUN (:NORMAL)))</tt></blockquote> <p><b>*gc-initialization-list*</b>&nbsp;&nbsp;&nbsp;<i>variable</i></p> <blockquote>Initializations to be run before a gc</blockquote> <blockquote>Initial value: <tt>NIL</tt></blockquote> <p><b>*general-warning-list*</b>&nbsp;&nbsp;&nbsp;<i>variable</i></p> <blockquote>For Warn-Or-Error, if the function doesn't want it's own checklist.</blockquote> <blockquote>Initial value: <tt>NIL</tt></blockquote> <p><b>*initialization-keywords*</b>&nbsp;&nbsp;&nbsp;<i>variable</i></p> <blockquote>Alist of initialization-list keywords and the list itself. Third element, if present, is the default run time, :normal if absent. This can be overridden by the add-initialization function.</blockquote> <blockquote>Initial value: <tt>((:WARM CL-LIB-INITIALIZATIONS:*WARM-INITIALIZATION-LIST*) (:COLD CL-LIB-INITIALIZATIONS:*COLD-INITIALIZATION-LIST*) (:BEFORE-COLD CL-LIB-INITIALIZATIONS:*BEFORE-COLD-INITIALIZATION-LIST*) (:ONCE CL-LIB-INITIALIZATIONS:*ONCE-INITIALIZATION-LIST* :FIRST) (:GC CL-LIB-INITIALIZATIONS:*GC-INITIALIZATION-LIST*) (:AFTER-GC CL-LIB-INITIALIZATIONS:*AFTER-GC-INITIALIZATION-LIST*))</tt></blockquote> <p><b>*LOAD-FORM-QUOTE-P-FN*</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>*once-initialization-list*</b>&nbsp;&nbsp;&nbsp;<i>variable</i></p> <blockquote>Initializations to be run only once</blockquote> <blockquote>Initial value: <tt>NIL</tt></blockquote> <p><b>*suppress-clim*</b>&nbsp;&nbsp;&nbsp;<i>variable</i></p> <blockquote>Turn off clim i/o</blockquote> <blockquote>Initial value: <tt>NIL</tt></blockquote> <p><b>*warm-initialization-list*</b>&nbsp;&nbsp;&nbsp;<i>variable</i></p> <blockquote>Initializations run just after booting any world</blockquote> <blockquote>Initial value: <tt>(#S(CL-LIB-INITIALIZATIONS::INITIALIZATION :NAME "User Notification" :FORM (IF (CL-LIB-ESSENTIALS:INTERACTIVE-LISP-P) (FORMAT *ERROR-OUTPUT* "~2&--> Running Warm Initializations~2%")) :FLAG T :RUN (:NORMAL)) #S(CL-LIB-INITIALIZATIONS::INITIALIZATION :NAME "Announce cl-lib is on the job" :FORM (WHEN (AND CL-LIB-ESSENTIALS:*CL-LIB-VERSION-ANNOUNCE-P* (CL-LIB-ESSENTIALS:INTERACTIVE-LISP-P)) (CL-LIB-ESSENTIALS:REPORT-VERSION)) :FLAG T :RUN (:NORMAL)))</tt></blockquote> <p><b>*WARN-OR-ERROR-CLEANUP-INITIALIZATIONS*</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>add-initialization</b> name form &optional keywords initialization-list-name)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>The initialization form is given name name and added to the initialization list specified either by the keywords or passed directly. The keywords can also be used to change the default time to evaluate the initialization.</blockquote><p>(<b>add-syntax</b> name readtable-symbol)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Associate the name with the readtable-symbol, a quoted variable containing the readtable.</blockquote><p><b>AND-LIST</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>car-eq</b> x y)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Checks whether Y is eq to the car of X.</blockquote><p>(<b>cartesian-product</b> set1 set2)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Returns the cross product of two sets.</blockquote><p>(<b>check</b> vars operation assertion format-string &rest format-args)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>An enhanced version of assert, that takes an operation to perform on args, which can be refered to by the assertion as check.</blockquote><p>(<b>circular-list</b> &rest list)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Creates a circular list of the arguments. Handy for use with the list mapping functions. For example, (mapcar #'+ '(1 2 3 4 5) (circular-list 3)) --> (4 5 6 7 8) (mapcar #'+ '(1 2 3 4 5) (circular-list 0 1)) --> (1 3 3 5 5)</blockquote><p><b>CLEAR-LOAD-ONCE</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>COMMAND-LINE-ARG</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>comment</b> &rest anything)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Expands into nothing</blockquote><p>(<b>cond-binding-predicate-to</b> symbol &rest clauses)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>(cond-binding-predicate-to symbol . clauses) [macro] a COND-like macro. The clauses are exactly as in COND. In the body of a clause, the SYMBOL is lexically bound to the value returned by the test. Example: (cond-binding-predicate-to others ((member 'x '(a b c x y z)) (reverse others))) evaluates to (x y z)</blockquote><p><b>CONS-SCHEME-STREAM</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>copy-array</b>)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Returns an (exact) copy of the passed array, with same size, fill pointer (if there is one), adjustable quality, element type, and contents. Uses element-copier to copy elements (default #'identity).</blockquote><p><b>COPY-HASH-TABLE</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>cross-product</b> &rest lists)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Returns the cross product of a set of lists.</blockquote><p><b>CRUSH</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>defclass-x</b> type supertypes slots &rest stuff)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Extended defclass, also creates a TYPE-P function and MAKE-TYPE function, like defstuct did.</blockquote><p><b>DEFFLAG</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>DEFFLAGS</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>delete-initialization</b> name &optional keywords initialization-list-name)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Delete the initialization with name from either the list specified with the keywords, or passed as initialization-list-name.</blockquote><p>(<b>dequeue</b> q)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Queue is altered (by side effect) by removing the oldest element in queue. THe removed element is returned. When queue is empty, the results are undefined.</blockquote><p><b>DETERMINE-SLOT-INITIALIZERS</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>DETERMINE-SLOT-READERS</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>DETERMINE-SLOT-WRITERS</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>displace</b> list val)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Replaces LIST with VAL by destructively modifying the car and cdr of LIST. Warning: VAL must not share list structure with LIST or you'll be sorry.</blockquote><p>(<b>dofile</b> (var filename &optional return-form) &body body)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Opens the specified file for input, reads successive lines from the file, setting the specified variable <var> to each line. When end of file is reached, the value of <return-form> is returned.</blockquote><p>(<b>dosequence</b> (var sequence &optional result) &body body)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>(dosequence (var sequence &optional result) &body body) [macro] This macro is like DOLIST (q.v.), except that the iteration is over any sequence, not necessarily a list.</blockquote><p>(<b>dremove</b> item list)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Destructive remove which replaces the original list with the list that results when ITEM is deleted from LIST.</blockquote><p>(<b>elapsed-time-in-seconds</b> base now)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Returns the time in seconds that has elapsed between Base and Now. Just subtracts Base from Now to get elapsed time in internal time units, then divides by the number of internal units per second to get seconds.</blockquote><p>(<b>empty-queue-p</b> q)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Returns t if queue does not contain any elements and nil otherwise</blockquote><p>(<b>enqueue</b> q item)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Queue is altered (by side-effect) by adding the element item into queue. The return value (if any) is undefined.</blockquote><p>(<b>eqmemb</b> item list &key (test (function equal)))&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Checks whether ITEM is either equal to or a member of LIST.</blockquote><p>(<b>eqv</b> &rest predicates)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>True iff all predicates produce the same result according to eql, or passed :test (exclusive nor if binary)</blockquote><p>(<b>every-dotted-list</b> fn &rest lists)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Like normal Every, but handles dotted lists, and will apply the fn to the dotted arguments, unless they are (all) NIL.</blockquote><p><b>EXPLODE</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>extract-keyword</b> key arglist &optional default &key no-value)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Searches the arglist for keyword key, and returns the following mark, or the default if supplied. If no-value is non-nil, then if nothing follows the key it is returned.</blockquote><p>(<b>factorial</b> n)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Compute the factorial of an integer</blockquote><p><b>FAKE-SCHEME-DELAY</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>fast-intersection</b> list1 list2 predicate &key (test (function eql)) (key (function identity)))&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Like Intersection (but no support for test-not) should be faster because list1 and list2 must be sorted. Fast-Intersection is a variation on Merge that handles duplicates. Predicate is the sort predicate.</blockquote><p>(<b>fast-union</b> list1 list2 predicate &key (test (function eql)) (key (function identity)))&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Like Union (but no support for test-not) should be faster because list1 and list2 must be sorted. Fast-Union is a Merge that handles duplicates. Predicate is the sort predicate.</blockquote><p>(<b>flatten</b> l)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Flattens list L, i.e., returns a single list containing the same atoms as L but with any internal lists 'dissolved'. For example, (flatten '(a (b c) d)) ==> (a b c d) Recursively flattens components of L, according to the following rules: - an atom is already flattened. - a list whose CAR is also a list is flattened by appending the flattened CAR to the flattened CDR (this is what dissolves internal lists). - a list whose CAR is an atom is flattened by just flattening the CDR and CONSing the original CAR onto the result. These rules were chosen with some attention to minimizing CONSing.</blockquote><p><b>FORCE-LIST</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>force-string</b> thing)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Generates a string representation of Thing. This representation is the print name for symbols, otherwise whatever 'coerce' can do (which may be to generate an error sometimes).</blockquote><p><b>GENERATE-LEGAL-SLOT-INITARGS</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>get-compiled-function-name</b> fn)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Returns the symbol name of a function. Covers the six major CL vendors.</blockquote><p><b>IF*</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>IMPLODE</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>initializations</b> initialization-list-name &optional redo (flag t))&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Run the initializations on the passed list. If redo is non-nil, then the current value of the flag on the initialization is ignored, and the initialization is always run. Otherwise an initialization is only run if the associated flag is NIL. Flag is the value stored into the initialization's flag when it is run.</blockquote><p>(<b>let*-non-null</b> bindings &body body)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>like let*, but if any binding is made to NIL, the let*-non-null immediately returns NIL.</blockquote><p>(<b>let-maybe</b> condition bindings &body body)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Binds let arguments only if condition is non-nil, and evaluates body in any case.</blockquote><p>(<b>list-scheme-stream</b> &rest args)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Analogue to the cl list function, only the last arg is delayed.</blockquote><p>(<b>list-without-nulls</b> list)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Returns a copy of list with all null elements removed.</blockquote><p>(<b>listify-string</b> string)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Turns a string into a list of symbols.</blockquote><p><b>LOAD-ONCE</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>LOCATION-CONTENTS</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>LOCATIVE</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>LOCATIVE-P</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>locf</b> reference &environment env)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Much like seeing a setf</blockquote><p><b>MACRO-INDENT-RULE</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>MAKE-KEYWORD</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>MAKE-LOAD-FORM-WITH-ALL-SLOTS</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>make-plist</b> keys data &optional (plist (quote NIL)))&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Constructs a property list from keys and data (addition to plist).</blockquote><p>(<b>make-queue</b>)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Creates and returns a new empty queue</blockquote><p><b>MAKE-SCHEME-STREAM</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>MAKE-VARIABLE</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>mapatoms</b> func &optional (package *package*) (inherited-symbols-too t))&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Maps the passed function over all symbols in the package, and if inherited-symbols-too is non-nil, then over those symbols as well. Note that the function may be called >once on a symbol.</blockquote><p>(<b>mapc-dotted-list</b> fn &rest lists)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Like normal Mapc, but handles dotted lists, and will apply the fn to the dotted argument, unless it is NIL</blockquote><p>(<b>mapcan-dotted-list</b> fn &rest lists)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Like normal Mapcan, but handles dotted lists, and will apply the fn to the dotted argument, unless it is NIL</blockquote><p>(<b>mapcar-dotted-list</b> fn &rest lists)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Like normal Mapcar, but handles dotted lists, and will apply the fn to the dotted argument, unless it is NIL</blockquote><p>(<b>maplist-dotted-list</b> fn &rest lists)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Like normal Maplist, but handles dotted lists, and will apply the fn to the dotted argument, unless it is NIL</blockquote><p><b>MLET</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>MSETQ</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>MV-PROGFOO</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>nand</b> &rest predicates)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>True only if all predicates are not true. Short circutes when it finds one is false.</blockquote><p>(<b>neq</b> x y)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>not eq</blockquote><p>(<b>nor</b> &rest predicates)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>True only if all predicates are false. Short circutes when it finds a one is true.</blockquote><p><b>OR-LIST</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>parser-error</b> stream format-string &rest format-args)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Process an error within the parse process, e.g. reader macros. On some systems (e.g. lisp machines) this will invoke the rubout handler, and let you fix up your input.</blockquote><p>(<b>permutations</b> items)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Given a list of items, returns all possible permutations of the list.</blockquote><p>(<b>powerset</b> list)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Given a set, returns the set of all subsets of the set.</blockquote><p>(<b>prefix?</b> prefix seq)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Prefix? - Checks to see if Prefix is really a prefix of Seq. Returns T if it is, NIL otherwise. Just checks that Prefix is no longer than Seq, then checks to see if the the initial subsequence of Seq that is the same length as Prefix is equal to Prefix. Prefix is a real prefix if and only if both conditions hold.</blockquote><p><b>PROGFOO</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>prompt-and-read</b> prompt &rest prompt-args)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Prompt the user for an arbitrary response.</blockquote><p>(<b>prompt-for</b> type &optional prompt &rest prompt-args)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>inspired by cltl/2, condition chapter.</blockquote><p>(<b>queue-elements</b> q)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Returns a list of the elements in queue with the oldest element first. The list returned may share structure with queue and therefore may be altered by subsequent calls on enqueue and/or dequeue</blockquote><p>(<b>queue-front</b> q)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Returns the oldest element in queue (i.e., the element that has been in the queue the longest). When queue is empty, the results are undefined</blockquote><p>(<b>read-delimited-string</b> delimiters &optional (stream *standard-input*) (eof-error-p t) eof-value)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Read a stream until one of the delimiters (a list of characters) is found. Returns the characters so read until the delimiter as a string, plus the additional values: EOF-VALUE, which is as passed if eof was reached, and the delimiter that caused termination of the string. If EOF-ERROR-P is non-nil (the default), then an EOF causes an error to be signalled instead of returning EOF-VALUE.</blockquote><p><b>READER</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>regex</b> expression string)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Usage: (regex <expression> <string) This function will call regex-compile on the expression and then apply the string to the returned lambda list.</blockquote><p>(<b>regex-compile</b> source &key anchored)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Usage: (regex-compile <expression> [ :anchored (t/nil) ]) This function take a regular expression (supplied as source) and compiles this into a lambda list that a string argument can then be applied to. It is also possible to compile this lambda list for better performance or to save it as a named function for later use</blockquote><p>(<b>remove-keyword-arg</b> keyword input-list)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>from a set of keyword arguments, remove a particular pair marked by the passed keyword, i.e. (remove-keyword-arg :a '(:b 2 :a 3 :d 7)) -> (:b 2 :d 7). Return multiple values, the first being the new list, the second being the argument to the keyword removed, and the third indicating if there were a removal (useful if the second value is null).</blockquote><p>(<b>report-version</b> &optional depth (initialization-list (quote *cl-lib-version-reporter-initializations*)))&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>If depth is non-nil, then part names of the form foo-bar-bletch are suppressed at depth > 2. (using prefixes).</blockquote><p>(<b>reset-initializations</b> initialization-list-name)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Sets the FLAG of each initialization on the passed list to NIL so it will be (re)run the next time initializations is called on it.</blockquote><p>(<b>reverse-alist</b> alist &key (test (function eql)))&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Takes an alist of uniqe keys and non-unique values, and returns an alist of unique keys based on the values, whose values are lists of the original keys.</blockquote><p><b>RLIST-TO-SCHEME-STREAM</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>round-off</b> n &optional (sig 0))&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>rounds n off to sig significant figures (positive is right of decimal, negative is left), returning a float.</blockquote><p>(<b>round-to</b> number &optional (divisor 1))&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Like Round, but returns the resulting number</blockquote><p>(<b>safe-dequeue</b> q)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Dequeue that makes sure there is a non-empty queue, returning NIL if queue is empty. (dequeue on empty queue will screw the data structure!)</blockquote><p><b>SCHEME-DELAY</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>SCHEME-DELAY-P</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>SCHEME-FORCE</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>SCHEME-STREAM</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>SCHEME-STREAM-HEAD</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>SCHEME-STREAM-P</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>SCHEME-STREAM-TAIL</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>SCHEME-STREAM-TAIL-CLOSURE-P</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>SEQ-BUTLAST</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>SEQ-LAST</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>SET-SYNTAX</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>some-dotted-list</b> fn &rest lists)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Like normal Some, but handles a single dotted list, and will apply the fn to the dotted argument, unless it is NIL</blockquote><p>(<b>ss-head</b> stream)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Return the head of scheme stream Stream. If Stream is not a stream, returns NIL (to allow the usual car of nil).</blockquote><p>(<b>ss-tail</b> stream)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Return the tail of the scheme stream Stream. Invokes lazy evaluation if needed. If stream is not a scheme stream, return NIL (allows the usual cdr of nil).</blockquote><p>(<b>tailpush</b> item list)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Pushes ITEM onto the tail of LIST. Does not work if the list is null.</blockquote><p>(<b>true-list-p</b> term)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Returns t if the term is a non-dotted list. Note that nil is a true list.</blockquote><p>(<b>truncate-keywords</b> input-list)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Many functions take multiple arguments, via &rest, that can cause problems when keyword arguments are also supplied. This function truncates a list at the first top-level keyword. Thus, '(A B C :FOO D) is returned as (A B C). Note that the new list is freshly consed to avoid any stack problems with destroying a &rest argument.</blockquote><p>(<b>update-alist</b> item value alist &key (test (quote (function eql))) (key (quote (function identity))))&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>If alist already has a value for Key, it is updated to be Value. Otherwise the passed alist is updated with key-value added as a new pair.</blockquote><p>(<b>variablep</b> item)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Returns T if ITEM is a variable, namely a symbol of the form ?NAME, whose first character is a question-mark.</blockquote><p><b>VERSION-REPORTER</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>warn-or-error</b> item checklist continue-control-string proceed-control-string format-control-string &rest format-args)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Like Warn, returns non-nil if the user wishes to continue. A nil return implies failure. A bit snazzier than just WARN or CERROR, this function does a warning, and then asks if the user wants to go ahead (continue-control-string), error out, or go ahead and not ask again. Item and checklist is supplied by the caller for just this functionality: if item is found on checklist, Warn-or-Error will return non-nil.</blockquote><p>(<b>while</b> test &body body)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Keeps invoking the body while the test is true; test is tested before each loop.</blockquote><p>(<b>while-not</b> test &body body)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Keeps invoking the body while the test is false; test is tested before each loop.</blockquote><p>(<b>with-rhyme</b> body)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Well, there must be rhyme OR reason, and we now admit there is no reason, so... Used to flag silly constructs that may need to be rewritten for best effect.</blockquote><p><b>WITH-SYNTAX</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>xor</b> &rest predicates)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>True only if exactly one predicate is true. Short circutes when it finds a second one is true. Returns the true predicate</blockquote><font size=-1><p>Documentation generated by <a href="http://homepage.mac.com/svc/lispdoc/">lispdoc</a> running on LispWorks</p></font></body></html>
27,891
Common Lisp
.l
269
102.171004
500
0.725795
Bradford-Miller/CL-LIB
1
0
1
LGPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
4f81b744da0f8dea7e905c241f047cbc850f847ee4ca7a77721fb81834801cc4
25,942
[ -1 ]
25,959
CL-LIB-ESSENTIALS.html
Bradford-Miller_CL-LIB/functions/CL-LIB-ESSENTIALS.html
<html><head><title>CL-LIB-ESSENTIALS</title></head><body><h3>API for package CL-LIB-ESSENTIALS</h3> <blockquote>Essential functions for implementing the cl-lib</blockquote> <p><b>*cl-lib-detailed-version-reporter-string*</b>&nbsp;&nbsp;&nbsp;<i>variable</i></p> <blockquote>Default detail control string to announce the version</blockquote> <blockquote>Initial value: <tt>"~&;; ~A~45t~A~72t~D.~D.~D~%;;~2t(~A)~%"</tt></blockquote> <p><b>*cl-lib-version-announce-p*</b>&nbsp;&nbsp;&nbsp;<i>variable</i></p> <blockquote>change this to NIL to prevent version announcement at startup</blockquote> <blockquote>Initial value: <tt>T</tt></blockquote> <p><b>*cl-lib-version-reporter-string*</b>&nbsp;&nbsp;&nbsp;<i>variable</i></p> <blockquote>Default control string to announce the version</blockquote> <blockquote>Initial value: <tt>"~&;; ~A~45t~A~72t~D.~D~%;;~2t(~A)~%"</tt></blockquote> <p>(<b>detailed-version-reporter</b> part-name major-version minor-version micro-version date comments &key (report-string-symbol (quote *cl-lib-detailed-version-reporter-string*)) (initialization-list-symbol (quote *cl-lib-version-reporter-initializations*)))&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>set up a version announcement</blockquote><p>(<b>interactive-lisp-p</b>)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Return non-nil if the lisp is interactive (i.e., contains the development system)</blockquote><p>(<b>macro-indent-rule</b> symbol what)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Inform the editor (emacs) of how to indent macros, used by CL-LIB</blockquote><p>(<b>report-version</b> &optional depth (initialization-list (quote *cl-lib-version-reporter-initializations*)))&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>If depth is non-nil, then part names of the form foo-bar-bletch are suppressed at depth > 2. (using prefixes).</blockquote><p>(<b>version-reporter</b> part-name major-version minor-version date comments &optional (report-string-symbol (quote *cl-lib-version-reporter-string*)) (initialization-list-symbol (quote *cl-lib-version-reporter-initializations*)))&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>set up a version announcement</blockquote><font size=-1><p>Documentation generated by <a href="http://homepage.mac.com/svc/lispdoc/">lispdoc</a> running on LispWorks</p></font></body></html>
2,338
Common Lisp
.l
17
136.588235
405
0.739879
Bradford-Miller/CL-LIB
1
0
1
LGPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
f4df9aa35b459e1eff1b7b4b14cb6db93eaa41a196cea9e7d8e7ac8b33dde6e2
25,959
[ -1 ]
25,973
CL-LIB-LOGIC.html
Bradford-Miller_CL-LIB/packages/CL-LIB-LOGIC.html
<html><head><title>CL-LIB-LOGIC</title></head><body><h3>API for package CL-LIB-LOGIC</h3> <blockquote>UNDOCUMENTED</blockquote> <font size=-1><p>Documentation generated by <a href="http://homepage.mac.com/svc/lispdoc/">lispdoc</a> running on LispWorks</p></font></body></html>
276
Common Lisp
.l
3
91.333333
148
0.733577
Bradford-Miller/CL-LIB
1
0
1
LGPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
59f75deb83070af57199e45a8d7ca89b4eb47c56e02237c830a4e8bb07e09053
25,973
[ -1 ]
25,976
LISPDOC.html
Bradford-Miller_CL-LIB/packages/LISPDOC.html
<html><head><title>LISPDOC</title></head><body><h3>API for package LISPDOC</h3> <blockquote>Automatically generate documentation for properly documented symbols exported from packages</blockquote> <p>(<b>lispdoc</b> &rest packages)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Generate a lispdoc sexp documenting the exported symbols of each package</blockquote><p>(<b>lispdoc-html</b> directory &rest packages)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Generate HTML documentation in a file per package in directory for the exported symbols of each package</blockquote><p>(<b>render-html</b> lispdoc &optional stream)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Generate a HTML fragment for the lispdoc sexp</blockquote><font size=-1><p>Documentation generated by <a href="http://homepage.mac.com/svc/lispdoc/">lispdoc</a> running on <a href="http://openmcl.clozure.com/">OpenMCL</a></p></font></body></html>
926
Common Lisp
.l
6
153.333333
258
0.757609
Bradford-Miller/CL-LIB
1
0
1
LGPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
37ca86fd9107f6aa66988e2b62e9f92c2c9b3c87a8e48cd1d38e4876f003cd0b
25,976
[ -1 ]
25,981
CL-LIB-CONSOLE.html
Bradford-Miller_CL-LIB/packages/CL-LIB-CONSOLE.html
<html><head><title>CL-LIB-CONSOLE</title></head><body><h3>API for package CL-LIB-CONSOLE</h3> <blockquote>The motivation for this package, initially, was the lack of a distiguished *error-output* in LispWorks, that is, unlike allegro, access to file descriptor 2 was not available, and so programs that are intended to be pipes have no place to put an error, other than a file. This package allows one to create a stream into a popup console window and bind *error-output* or pretty much anything else to it. How to use: First, call (create-console). By default, a read-only console is created, suitable for displaying errors as your program prints them, (create-console :rw) will put up an editor buffer (read/write). In either case, a console object is returned, which is needed for the following calls. Optionally, you can specify a second argument, which will be the title of the window. (console-stream console) returns a stream associated with a console, e.g., the thing to format to. (format-console console format-string &rest args) is format for a console. (read-line-console console &optional eof-error-p eof-value) is read-line for a console, but the console argument is required.</blockquote> <p>(<b>console-stream</b> console)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Return the stream of a console</blockquote><p>(<b>create-console</b> &optional (type ro) (title (format NIL popup console ~a type)))&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Makes sure the environment is ready for popping up a window; two kinds of consoles are available, :ro and :rw, default :ro</blockquote><p>(<b>destroy-console</b> console)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Console is no longer needed</blockquote><p>(<b>format-console</b> console format-string &rest args)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Like format (oh if only that were a generic function!), but for consoles.</blockquote><p>(<b>read-line-console</b> console &optional (eof-error-p t) eof-value)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>read-line for a console; really can just call read-line on the console stream!</blockquote><font size=-1><p>Documentation generated by <a href="http://homepage.mac.com/svc/lispdoc/">lispdoc</a> running on LispWorks</p></font></body></html>
2,309
Common Lisp
.l
21
108
251
0.753503
Bradford-Miller/CL-LIB
1
0
1
LGPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
bbec41b0a376124db1324de8e52c0be40f3629c5f3112e5ef4cafd469b86ec59
25,981
[ -1 ]
25,983
CL-LIB-INITIALIZATIONS.html
Bradford-Miller_CL-LIB/packages/CL-LIB-INITIALIZATIONS.html
<html><head><title>CL-LIB-INITIALIZATIONS</title></head><body><h3>API for package CL-LIB-INITIALIZATIONS</h3> <blockquote>Symbolics compatible initializations package for common lisp</blockquote> <p><b>*after-gc-initialization-list*</b>&nbsp;&nbsp;&nbsp;<i>variable</i></p> <blockquote>Initializations to be run after a gc</blockquote> <blockquote>Initial value: <tt>NIL</tt></blockquote> <p><b>*before-cold-initialization-list*</b>&nbsp;&nbsp;&nbsp;<i>variable</i></p> <blockquote>Initializations run just before saving a non-checkpointed world</blockquote> <blockquote>Initial value: <tt>(#S(CL-LIB-INITIALIZATIONS::INITIALIZATION :NAME "User Notification" :FORM (IF (CL-LIB-ESSENTIALS:INTERACTIVE-LISP-P) (FORMAT *ERROR-OUTPUT* "~2&--> Running Before-Cold Initializations~2%")) :FLAG NIL :RUN (:NORMAL)) #S(CL-LIB-INITIALIZATIONS::INITIALIZATION :NAME "Reset Cold Initializations" :FORM (CL-LIB-INITIALIZATIONS:RESET-INITIALIZATIONS (QUOTE CL-LIB-INITIALIZATIONS:*COLD-INITIALIZATION-LIST*)) :FLAG NIL :RUN (:NORMAL)))</tt></blockquote> <p><b>*cold-initialization-list*</b>&nbsp;&nbsp;&nbsp;<i>variable</i></p> <blockquote>Initializations run just after booting a non-checkpointed world</blockquote> <blockquote>Initial value: <tt>(#S(CL-LIB-INITIALIZATIONS::INITIALIZATION :NAME "User Notification" :FORM (IF (CL-LIB-ESSENTIALS:INTERACTIVE-LISP-P) (FORMAT *ERROR-OUTPUT* "~2&--> Running Cold Initializations~2%")) :FLAG T :RUN (:NORMAL)))</tt></blockquote> <p><b>*gc-initialization-list*</b>&nbsp;&nbsp;&nbsp;<i>variable</i></p> <blockquote>Initializations to be run before a gc</blockquote> <blockquote>Initial value: <tt>NIL</tt></blockquote> <p><b>*initialization-keywords*</b>&nbsp;&nbsp;&nbsp;<i>variable</i></p> <blockquote>Alist of initialization-list keywords and the list itself. Third element, if present, is the default run time, :normal if absent. This can be overridden by the add-initialization function.</blockquote> <blockquote>Initial value: <tt>((:WARM CL-LIB-INITIALIZATIONS:*WARM-INITIALIZATION-LIST*) (:COLD CL-LIB-INITIALIZATIONS:*COLD-INITIALIZATION-LIST*) (:BEFORE-COLD CL-LIB-INITIALIZATIONS:*BEFORE-COLD-INITIALIZATION-LIST*) (:ONCE CL-LIB-INITIALIZATIONS:*ONCE-INITIALIZATION-LIST* :FIRST) (:GC CL-LIB-INITIALIZATIONS:*GC-INITIALIZATION-LIST*) (:AFTER-GC CL-LIB-INITIALIZATIONS:*AFTER-GC-INITIALIZATION-LIST*) (:QUIT CL-LIB-INITIALIZATIONS::*QUIT-INITIALIZATION-LIST*))</tt></blockquote> <p><b>*once-initialization-list*</b>&nbsp;&nbsp;&nbsp;<i>variable</i></p> <blockquote>Initializations to be run only once</blockquote> <blockquote>Initial value: <tt>(#S(CL-LIB-INITIALIZATIONS::INITIALIZATION :NAME "test-init-once4726" :FORM (SETQ CL-LIB-TESTS::*TEST-VAR* 2) :FLAG T :RUN (:FIRST)))</tt></blockquote> <p><b>*warm-initialization-list*</b>&nbsp;&nbsp;&nbsp;<i>variable</i></p> <blockquote>Initializations run just after booting any world</blockquote> <blockquote>Initial value: <tt>(#S(CL-LIB-INITIALIZATIONS::INITIALIZATION :NAME "User Notification" :FORM (IF (CL-LIB-ESSENTIALS:INTERACTIVE-LISP-P) (FORMAT *ERROR-OUTPUT* "~2&--> Running Warm Initializations~2%")) :FLAG T :RUN (:NORMAL)) #S(CL-LIB-INITIALIZATIONS::INITIALIZATION :NAME "Announce cl-lib is on the job" :FORM (WHEN (AND CL-LIB-ESSENTIALS:*CL-LIB-VERSION-ANNOUNCE-P* (CL-LIB-ESSENTIALS:INTERACTIVE-LISP-P)) (CL-LIB-ESSENTIALS:REPORT-VERSION)) :FLAG T :RUN (:NORMAL)))</tt></blockquote> <p>(<b>add-initialization</b> name form &optional keywords initialization-list-name)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>The initialization form is given name name and added to the initialization list specified either by the keywords or passed directly. The keywords can also be used to change the default time to evaluate the initialization.</blockquote><p>(<b>delete-initialization</b> name &optional keywords initialization-list-name)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Delete the initialization with name from either the list specified with the keywords, or passed as initialization-list-name.</blockquote><p>(<b>initializations</b> initialization-list-name &optional redo (flag t))&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Run the initializations on the passed list. If redo is non-nil, then the current value of the flag on the initialization is ignored, and the initialization is always run. Otherwise an initialization is only run if the associated flag is NIL. Flag is the value stored into the initialization's flag when it is run.</blockquote><p>(<b>reset-initializations</b> initialization-list-name)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Sets the FLAG of each initialization on the passed list to NIL so it will be (re)run the next time initializations is called on it.</blockquote><font size=-1><p>Documentation generated by <a href="http://homepage.mac.com/svc/lispdoc/">lispdoc</a> running on LispWorks</p></font></body></html>
4,876
Common Lisp
.l
38
127.315789
500
0.763794
Bradford-Miller/CL-LIB
1
0
1
LGPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
47bcc69453fa3fbb7285e4891c831834dc0c110b3a7fddb6b6fea39b00f1a930
25,983
[ -1 ]
25,986
TRANSCRIPTS.html
Bradford-Miller_CL-LIB/packages/TRANSCRIPTS.html
<html><head><title>TRANSCRIPTS</title></head><body><h3>API for package TRANSCRIPTS</h3> <blockquote>UNDOCUMENTED</blockquote> <p><b>*crash-log-stream*</b>&nbsp;&nbsp;&nbsp;<i>variable</i></p> <blockquote>Special stream for dealing with crash messages</blockquote> <blockquote>Initial value: <tt>NIL</tt></blockquote> <p><b>*log-file*</b>&nbsp;&nbsp;&nbsp;<i>variable</i></p> <blockquote>Path to a log file</blockquote> <blockquote>Initial value: <tt>NIL</tt></blockquote> <p><b>*LOG-STREAMS*</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>*TRANSCRIPT-STREAM*</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>CLOSE-LOGS</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>DEBUG-LOG</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>debug-p</b> debug-level-needed)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Return non-nil, if cl-user::*debug* is high enough to trigger debugging</blockquote><p><b>DO-LOG</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>DO-LOG-ALL</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>DO-LOG-TIMESTAMP</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>FIND-LOG-STREAM</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>LOG-WARNING</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>OPEN-INTERACTIVE-LOG-STREAM</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>OPEN-LOG-STREAM</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>OPEN-LOG-STREAM-FOR-MODULE</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>OPEN-TRANSCRIPT-STREAM</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>STAMP-VIEW-LOG-INDICATOR</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>tassert</b> who debug-level test-form &optional places string &rest args)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>TASSERT who debug-level test-form [({place}*) [string {arg}*]] If the test-form evals to NIL, then either signal an error or log an error, depending on the value of debug-level: if current tracing is such that we would normally trace debug-level, assert instead. If tracing is such that we would ignore, log instead.</blockquote><p><b>TRANSCRIBE</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>TRANSCRIBE-AND-LOG</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>WHEN-DEBUGGING</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>write-log-header</b> stream who)&nbsp;&nbsp;&nbsp;<i>generic-function</i></p> <blockquote>Puts a header at the top of each log file. For a particular who, may be overridden by the caller by defining a method.</blockquote><font size=-1><p>Documentation generated by <a href="http://homepage.mac.com/svc/lispdoc/">lispdoc</a> running on LispWorks</p></font></body></html>
3,178
Common Lisp
.l
32
98.15625
206
0.687957
Bradford-Miller/CL-LIB
1
0
1
LGPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
1d215d898839c7100c4b99327309b99c3c6ea21b1bf51d8bafde3161bcb675d5
25,986
[ -1 ]
25,993
CLOS-FACETS.html
Bradford-Miller_CL-LIB/packages/CLOS-FACETS.html
<html><head><title>CLOS-FACETS</title></head><body><h3>API for package CLOS-FACETS</h3> <blockquote>See the file 'Extending CLOS with Facets.doc' for extensive documentation.</blockquote> <p><b>cardinality-bounds-error</b>&nbsp;&nbsp;&nbsp;<i>condition</i></p> <blockquote>Either fewer or more values have been declared than the bounds allow</blockquote><blockquote>Class precedence list: <tt> cardinality-bounds-error clos-facets-cell-error clos-facets-error cell-error error serious-condition condition standard-object t</tt></blockquote> <blockquote>Class init args: <tt> :name :new-value :operation :facet :class :instance</tt></blockquote> <p><b>cardinality-bounds-incompatible</b>&nbsp;&nbsp;&nbsp;<i>condition</i></p> <blockquote>The cardinality bounds are not a proper subinterval of some ancestor declaration.</blockquote><blockquote>Class precedence list: <tt> cardinality-bounds-incompatible clos-facets-incompatible clos-facets-program-error clos-facets-error program-error error serious-condition condition standard-object t</tt></blockquote> <p><b>cardinality-bounds-overrun</b>&nbsp;&nbsp;&nbsp;<i>condition</i></p> <blockquote>Too may values have been declared for the slot's cardinality</blockquote><blockquote>Class precedence list: <tt> cardinality-bounds-overrun cardinality-bounds-error clos-facets-cell-error clos-facets-error cell-error error serious-condition condition standard-object t</tt></blockquote> <blockquote>Class init args: <tt> :name :new-value :operation :facet :class :instance</tt></blockquote> <p><b>cardinality-bounds-underrun</b>&nbsp;&nbsp;&nbsp;<i>condition</i></p> <blockquote>Too few values have been declared for the slot's cardinality</blockquote><blockquote>Class precedence list: <tt> cardinality-bounds-underrun cardinality-bounds-error clos-facets-cell-error clos-facets-error cell-error error serious-condition condition standard-object t</tt></blockquote> <blockquote>Class init args: <tt> :name :new-value :operation :facet :class :instance</tt></blockquote> <p>(<b>clear-slot-value-cache</b>)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>used to clear our cache of slot value values</blockquote><p><b>clos-facets-cell-error</b>&nbsp;&nbsp;&nbsp;<i>condition</i></p> <blockquote>Specialization of cell-error for faceted slots. The type cell-error consists of error conditions that occur during a location access. The name of the offending cell is initialized by the :name initialization argument to make-condition, and is accessed by the function cell-error-name.</blockquote><blockquote>Class precedence list: <tt> clos-facets-cell-error clos-facets-error cell-error error serious-condition condition standard-object t</tt></blockquote> <blockquote>Class init args: <tt> :name :new-value :operation :facet :class :instance</tt></blockquote> <p><b>clos-facets-error</b>&nbsp;&nbsp;&nbsp;<i>condition</i></p> <blockquote>All clos-facets package related errors inherit from this condition</blockquote><blockquote>Class precedence list: <tt> clos-facets-error error serious-condition condition standard-object t</tt></blockquote> <p><b>clos-facets-incompatible</b>&nbsp;&nbsp;&nbsp;<i>condition</i></p> <blockquote>Specialization of Clos-Facets-Error where there is some incompatibility (constraint conflict) with some other declaration. Generally this is due to some child class having a facet declaration that is not a proper subtype of an ancester class.</blockquote><blockquote>Class precedence list: <tt> clos-facets-incompatible clos-facets-error error serious-condition condition standard-object t</tt></blockquote> <p><b>clos-facets-program-error</b>&nbsp;&nbsp;&nbsp;<i>condition</i></p> <blockquote>Specialization of program-error for facets</blockquote><blockquote>Class precedence list: <tt> clos-facets-program-error clos-facets-error program-error error serious-condition condition standard-object t</tt></blockquote> <p><b>clos-facets-warning</b>&nbsp;&nbsp;&nbsp;<i>condition</i></p> <blockquote>All clos-facets package related warnings inherit from this warning</blockquote><blockquote>Class precedence list: <tt> clos-facets-warning warning condition standard-object t</tt></blockquote> <p>(<b>defclass</b> class-name superclass-names slot-specifiers &rest class-options)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>A shadowing of the usual implementation of defclass, that intercepts the slot-specifiers in order to support facets. Note that it is possible that slot accessors will not be compatible with the host implementation for classes not defined using this macro.</blockquote><p>(<b>deffacet</b> facet-name (super-facets &key (all NIL) (default NIL)) &optional unevaluated-comment &body body)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>The primary macro for creating a new facet. The body is invoked on any write to a slot (including initialization). The following formals are bound on invocation, and may be used within the body (as lexical): facet-form, slotname, current-slotvalue, new-slotvalue. The body should evaluate new-slotvalue in light of the current-slotvalue and the facet-form (the value of the facet when the class was defined - this is what was in the defclass form as the argument to this facet), and either allow the write by returning, or signal appropriately (q.v.) :all implies all slots support the facet, with the :default value.</blockquote><p>(<b>defslot</b> slot-name super-slots &key facet-initializations &allow-other-keys)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Defslot allows one to define a hierarchy of slots, where slots are semantic relationships between class instances and attributes (typically, other class instances). The current definition is pretty limited; the desired direction would, for instance, allow us to define a general "ancestor" slot, and allow that to be a super-slot of, say, "maternal-grandfather", specifying that the maternal grandfather is single-valued, but it's value is one of the multi-valued ancestor slot. The current implementation only allows us to state that a slot supports set-oriented facets (for instance), and alas we haven't (yet) implemented the :slot-type facet which would allow us to link such information to a "kind" of slot rather than to a specific slot name. We will get to these more interesting applications of this concept later. Note however, that defslot does make a global declaration about a particular slot name (within a package) as having a given semantics. That is, unlike casual use of slotnames as relative to a class, defslot says that anytime a particular slotname appears in any class, it has the same semantic meaning. The facet-initializations, if specified, is a list each element of which is either the name of a facet to be supported by the slot-name, or a pair, the second element of which is the value of the facet whenever it appears in a class. Setting a different value local to a class will signal an error; this allows one to for instance, require that all decendants of a particular slot-name support multiple values.</blockquote><p>(<b>facet-missing</b> instance-class instance slot-name facet-name operation &optional new-value)&nbsp;&nbsp;&nbsp;<i>generic-function</i></p> <blockquote>Patterned on slot-missing - invoked when an attempt is made to access a facet in an object where the name of the facet is not a name of a facet supported on that slot on that class. The default method signals an error (clos-facets-error). The generic function is not intended to be called by programmers. Programmers may write methods for it.</blockquote><p><b>facet-missing-error</b>&nbsp;&nbsp;&nbsp;<i>condition</i></p> <blockquote>Signalled when a facet was expected</blockquote><blockquote>Class precedence list: <tt> facet-missing-error clos-facets-cell-error clos-facets-error cell-error error serious-condition condition standard-object t</tt></blockquote> <blockquote>Class init args: <tt> :name :new-value :operation :facet :class :instance</tt></blockquote> <p>(<b>facet-unbound</b> class instance slot-name facet-name)&nbsp;&nbsp;&nbsp;<i>generic-function</i></p> <blockquote>Patterned on slot-unbound - invoked when an unbound facet is read. The default method signals an error of type unbound-facet. The generic function facet-unbound is not intended to be called by programmers, but programmers may write methods for it.</blockquote><p><b>no-multiple-slotvalues</b>&nbsp;&nbsp;&nbsp;<i>condition</i></p> <blockquote>An attempt was made to read or write a specific slotvalue (using place on a supported function such as a slot accessor), when the slot was declared or defaulted to be single valued.</blockquote><blockquote>Class precedence list: <tt> no-multiple-slotvalues clos-facets-cell-error clos-facets-error cell-error error serious-condition condition standard-object t</tt></blockquote> <blockquote>Class init args: <tt> :name :new-value :operation :facet :class :instance :place</tt></blockquote> <p><b>NO-MULTIPLE-SLOTVALUES-PLACE</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p>(<b>slot-boundp</b> instance slot-name &optional place)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Tests if a specific slot in an instance is bound, returning true or false. Can be used in :after methods on initialize instance. Implented using slot-boundp-using-class.</blockquote><p>(<b>slot-boundp-using-class</b> class instance slot-name &optional place)&nbsp;&nbsp;&nbsp;<i>generic-function</i></p> <blockquote>implements slot-boundp - see the AMOP</blockquote><p>(<b>slot-definition-facets</b> slot-definition)&nbsp;&nbsp;&nbsp;<i>generic-function</i></p> <blockquote>return the facets defined for the slot-definition</blockquote><p>(<b>slot-facet-value</b> object slotname facetname)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Returns the value of the facet facetname on the slot slotname for the object. Implemented in terms of slot-facet-value-using-class</blockquote><p>(<b>slot-facet-value-using-class</b> object-class object slotname facetname)&nbsp;&nbsp;&nbsp;<i>generic-function</i></p> <blockquote>Returns the value of the facet facetname on the slot slotname for this class-object. The default primary method signals an error of type clos-facets-error if no such facet is defined for this slot. If the facet is unbound for this slot, the default primary method signals an error of type facet-unbound.</blockquote><p>(<b>slot-makunbound</b> instance slot-name &optional place)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Restores a slot in an instance to the unbound state. Calls slot-missing if no slot of the given name exists. Implemented using slot-makunbound-using-class. If multi-valued, then place is used, and making a place unbound causes it to be removed if there are subsequent places, i.e., if places 1-6 exist, and place 4 is unbound, then the value of place 5 is now accessible only at place 4, etc.</blockquote><p>(<b>slot-makunbound-using-class</b> class instance slot-name &optional place)&nbsp;&nbsp;&nbsp;<i>generic-function</i></p> <blockquote>implements slot-makunbound - see the AMOP</blockquote><p>(<b>slot-unbound</b> class instance slot-name &optional place)&nbsp;&nbsp;&nbsp;<i>generic-function</i></p> <blockquote>Called when an unbound slot is read in an instance whose metaclass is standard-class. The default method signals an error of condition type unbound-slot (with slots :name, naming the slot that was unbound, and :instance which is the instance that had the unbound slot). The function is called only by the function slot-value-using-class.</blockquote><p>(<b>slot-value</b> object slot-name &optional place)&nbsp;&nbsp;&nbsp;<i>function</i></p> <blockquote>Calls slot-missing if there is no slot of the given name. Implemented using slot-value-using-class. Setf'able</blockquote><p>(<b>slot-value-using-class</b> class object slot-name &optional place)&nbsp;&nbsp;&nbsp;<i>generic-function</i></p> <blockquote>Implementation for slot-value and setf of slot-value.</blockquote><p><b>unbound-slot</b>&nbsp;&nbsp;&nbsp;<i>condition</i></p> <blockquote>An attempt was made to read an unbound multiple value, generally using the place argument</blockquote><blockquote>Class precedence list: <tt> unbound-slot clos-facets-cell-error clos-facets-error unbound-slot cell-error error serious-condition condition standard-object t</tt></blockquote> <blockquote>Class init args: <tt> :name :new-value :operation :facet :class :instance :place</tt></blockquote> <p><b>UNBOUND-SLOT-PLACE</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>value-type-decl-incompatible</b>&nbsp;&nbsp;&nbsp;<i>condition</i></p> <blockquote>the value-type declared on the slot is not compatible with the value-type of the slot on a parent class. Specifically, it must be the same or a proper subtype.</blockquote><blockquote>Class precedence list: <tt> value-type-decl-incompatible clos-facets-incompatible clos-facets-program-error clos-facets-error program-error error serious-condition condition standard-object t</tt></blockquote> <p><b>value-type-error</b>&nbsp;&nbsp;&nbsp;<i>condition</i></p> <blockquote>an attempt to directly write a value to a cell that conflicts with the declared value-type.</blockquote><blockquote>Class precedence list: <tt> value-type-error clos-facets-cell-error clos-facets-error cell-error error serious-condition condition standard-object t</tt></blockquote> <blockquote>Class init args: <tt> :name :new-value :operation :facet :class :instance</tt></blockquote> <font size=-1><p>Documentation generated by <a href="http://homepage.mac.com/svc/lispdoc/">lispdoc</a> running on LispWorks</p></font></body></html>
13,673
Common Lisp
.l
98
138.357143
421
0.781257
Bradford-Miller/CL-LIB
1
0
1
LGPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
2023c9ebb253e8cdf3bd78e3ba40c801754a2de807a8ef6fb002110216ca2b58
25,993
[ -1 ]
25,997
CHART.html
Bradford-Miller_CL-LIB/packages/CHART.html
<html><head><title>CHART</title></head><body><h3>API for package CHART</h3> <blockquote>UNDOCUMENTED</blockquote> <p>(<b>add-chart-entry</b> chart label start end &optional content parents &key)&nbsp;&nbsp;&nbsp;<i>generic-function</i></p> <blockquote>Creates a chart entry spanning the start and end index, with given label, and adds it to the chart. Note that other keywords are allowed, so you can put more information on your chart entry (and pass them to add-chart-entry). Returns the new chart-entry</blockquote><p>(<b>annotate-chart-entry</b> chart chart-entry annotation-label annotation)&nbsp;&nbsp;&nbsp;<i>generic-function</i></p> <blockquote>Effectively, annotation-label is a property-name, and annotation is the property.</blockquote><p>(<b>chart-entries-ending-at-index</b> chart index)&nbsp;&nbsp;&nbsp;<i>generic-function</i></p> <blockquote>Return the set of chart entries that end at the index in the chart</blockquote><p>(<b>chart-entries-next</b> chart chart-entry)&nbsp;&nbsp;&nbsp;<i>generic-function</i></p> <blockquote>Return the chart entries that start at the end index of the passed chart entry</blockquote><p>(<b>chart-entries-prior</b> chart chart-entry)&nbsp;&nbsp;&nbsp;<i>generic-function</i></p> <blockquote>Return the chart entries that end at the start index of the passed chart entry</blockquote><p>(<b>chart-entries-starting-at-index</b> chart index)&nbsp;&nbsp;&nbsp;<i>generic-function</i></p> <blockquote>Return the set of chart entries that start at the index in the chart</blockquote><p>(<b>chart-entry-annotation</b> chart chart-entry annotation-label)&nbsp;&nbsp;&nbsp;<i>generic-function</i></p> <blockquote>Effectively, annotation-label is a property-name, we return the property.</blockquote><p>(<b>chart-entry-content</b> chart-entry)&nbsp;&nbsp;&nbsp;<i>generic-function</i></p> <blockquote>Return the content of the chart entry (what it is we match against). This might just be the label.</blockquote><p>(<b>chart-entry-indices</b> chart-entry)&nbsp;&nbsp;&nbsp;<i>generic-function</i></p> <blockquote>Return a list of two values, (S E) indicating the start and end index covered by the chart-entry in the chart</blockquote><p>(<b>chart-entry-label</b> chart-entry)&nbsp;&nbsp;&nbsp;<i>generic-function</i></p> <blockquote>Return the label or name of the chart entry, e.g. "NP".</blockquote><p>(<b>chart-entry-parents</b> chart-entry)&nbsp;&nbsp;&nbsp;<i>generic-function</i></p> <blockquote>When a chart entry is derived from others, this function returns the entries that it was derived from, useful, e.g., in chart parsers to know which det and n a np entry covers, etc. Inputs will return NIL</blockquote><p>(<b>chart-last-index</b> chart)&nbsp;&nbsp;&nbsp;<i>generic-function</i></p> <blockquote>Return the highest index in the chart, i.e. the maximum index covered by some chart-entry</blockquote><p><b>generic-chart</b>&nbsp;&nbsp;&nbsp;<i>class</i></p> <blockquote>A chart is a way to collect data similar to an array, but entries can cover more than one index. Typically, access is from (0,1) rather than (0), i.e. the indexes are vertices, and the data are segments between vertices in the graph.</blockquote><blockquote>Class precedence list: <tt> generic-chart standard-object t</tt></blockquote> <p><b>generic-chart-entry</b>&nbsp;&nbsp;&nbsp;<i>class</i></p> <blockquote>A chart entry is a constituent of a chart.</blockquote><blockquote>Class precedence list: <tt> generic-chart-entry standard-object t</tt></blockquote> <p><b>GENERIC-CHART-ENTRY-P</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <p><b>GENERIC-CHART-P</b></p>&nbsp;&nbsp;&nbsp;<i><font color="FF0000">undocumented</font></i></p> <font size=-1><p>Documentation generated by <a href="http://homepage.mac.com/svc/lispdoc/">lispdoc</a> running on LispWorks</p></font></body></html>
3,840
Common Lisp
.l
23
165.956522
401
0.745416
Bradford-Miller/CL-LIB
1
0
1
LGPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
c6d46c1478b2b363283633074adafe4ad9038a7b8df6b09be0fc1764888fb542
25,997
[ -1 ]
26,023
readme.allegro
Bradford-Miller_CL-LIB/archive/allegro/readme.allegro
;; Time-stamp: <2001-3-8 18:36:12 [email protected]> If you are using Dick Waters series & generator package (as described in CLtL/2) and would like fi:clman manual pages, ftp to ftp.cs.rochester.edu:/pub/packages/knowlege-tools/ and get file cl-lib-3-41.tar.Z (Note that the most recent version of FI does not use clman; I don't yet have a substitute available). Uncompress and untar the file (will go into a directory cl-lib). cl-lib/series/series is a manual page directory you can merge with clman by simply linking that directory into your fi/manual directory that your clman knows about (installation option; consult with who installed your emacs and or fi subsystem). **** Please see the file readme-cl-lib.text for more information.
759
Common Lisp
.l
1
759
759
0.773386
Bradford-Miller/CL-LIB
1
0
1
LGPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
0f4e233ebab9f439fa239cfd7e381d13ef13e46d627f8836059f8cebbc4d9262
26,023
[ -1 ]
26,027
packages.lisp
einsiedlerspiel_cl-xrandr-dmenu/packages.lisp
;; Copyright (C) 2023 Lou Woell ;; This program 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 3 of the License, or ;; (at your option) any later version. ;; This program 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 this program. If not, see <https://www.gnu.org/licenses/>. (defpackage :cl-xrandr-dmenu (:use :cl) (:export :main))
739
Common Lisp
.lisp
14
51.214286
73
0.758669
einsiedlerspiel/cl-xrandr-dmenu
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
473eede04f24aab3b1796fdcac4a2c7e115b81a974338ab5610cadf4f86d7b78
26,027
[ -1 ]
26,028
cl-xrandr-dmenu.asd
einsiedlerspiel_cl-xrandr-dmenu/cl-xrandr-dmenu.asd
;; Copyright (C) 2023 Lou Woell ;; This program 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 3 of the License, or ;; (at your option) any later version. ;; This program 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 this program. If not, see <https://www.gnu.org/licenses/>. (asdf:defsystem :cl-xrandr-dmenu :author "Lou Woell <[email protected]>" :license "GPLv3" :serial t :version "1.0.0" :description "A dmenu interface for xrandr written in Common Lisp" :build-operation "program-op" :build-pathname "./bin/xrandr-dmenu" :entry-point "cl-xrandr-dmenu:main" :depends-on (:adopt :uiop :str) :components ((:file "packages") (:file "xrandr")))
1,115
Common Lisp
.asd
25
40.84
73
0.71639
einsiedlerspiel/cl-xrandr-dmenu
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
850e13b34da0892fee6f1c2ff320359071032152631efef51301cf67583cb212
26,028
[ -1 ]
26,031
Makefile
einsiedlerspiel_cl-xrandr-dmenu/Makefile
LISP ?= /usr/bin/sbcl build: $(LISP) --load cl-xrandr-dmenu.asd \ --eval '(ql:quickload :cl-xrandr-dmenu)' \ --eval '(asdf:make :cl-xrandr-dmenu)' \ --eval '(quit)' install: install "./bin/xrandr-dmenu" "$(HOME)/.local/bin" uninstall: rm "$(HOME)/.local/bin/xrandr-dmenu"
284
Common Lisp
.l
10
26.2
50
0.656827
einsiedlerspiel/cl-xrandr-dmenu
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
2dfa4b312bfc06272d0db8aca971bc3c2750dc76edf7a731bdc15fc65554913d
26,031
[ -1 ]
26,047
package.lisp
fsmunoz_cl-rebonoise/package.lisp
;;;; package.lisp (defpackage #:cl-rebonoise (:use #:cl) (:export #:octave #:octaves #:elevation #:elevation-grid #:grid-to-file))
152
Common Lisp
.lisp
8
15.375
26
0.615385
fsmunoz/cl-rebonoise
1
1
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
083a3490e74ba3d67a6a5d71d66121e9618707d32cbde78754decb63c2d637cd
26,047
[ -1 ]
26,048
cl-rebonoise.lisp
fsmunoz_cl-rebonoise/cl-rebonoise.lisp
;;;; cl-rebonoise.lisp ;;; ;;; Terrain generation through noise, based on Red Blob Games from ;;; Amit Patel (https://www.redblobgames.com/maps/terrain-from-noise/) ;;; ;;; Author: Frederico Mu√±oz <[email protected]> ;;; This program 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 3 of ;;; the License, or (at your option) any later version. ;;; ;;; This program 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 this program. If not, see ;;; <https://www.gnu.org/licenses/>. (in-package #:cl-rebonoise) ;;; Biomes (defparameter *terrain-colors* '((water . (50 150 255)) (beach . (255 244 170)) (forest . (34 139 34)) (jungle . (41 171 135)) (savannah . (209 189 146)) (desert . (108 84 30)) (snow . (255 255 255))) "Association list that maps a biome name to an RGB value (a list)") (defun biome (e &optional (threshold 0.3) (step 0.1)) "Defines biomes, starting at THRESHOLD and using STEP" (cond ((< e (+ threshold (* 1 step))) 'water) ((< e (+ threshold (* 1.5 step))) 'beach) ((< e (+ threshold (* 3 step))) 'forest) ((< e (+ threshold (* 5 step))) 'jungle) ((< e (+ threshold (* 6 step))) 'savannah) (t 'snow))) (defun biome-color (name &optional (colors *terrain-colors*)) "Map biome NAME with its color, through a lookup in the COLORS alist." (cdr (assoc name colors :test 'equal))) ;;; Noise & elevation (defun normalize-value (noise) "Normalizes a value from the [-1...1] range to [0...1]" (/ (+ noise 1) 2)) (defun normalized-noise (x y) "Use simplex noise with X Y (a [-1..1] value) and return a normalized [0...1] value." (normalize-value (black-tie:simplex-noise-2d x y))) (defun octave (x y &optional (frequency 1) (amplitude)) "Returns an elevation value (between 0..1) based on FREQUENCY and AMPLITUDE (by default 1 and 0.5, and if only the frequency is provided the amplitude is calculated as 1/frequency)" (let ((amplitude (or amplitude (/ 1 frequency)))) (* (normalized-noise (* x frequency) (* y frequency)) amplitude))) (defun octaves (x y &key (coefs '((1 1) (2 0.5) (4 0.25)))) "Returns the combination of multiple \"octaves\", each with the (FRENQUENCY AMPLITUDE) values in the COEFS list. By default 3 octaves are used with amplitudes 1 0.5 0.25, but it's possible to specify both frequency and amplitude values." (loop for (frequency amplitude) in coefs sum amplitude into amplitudes ;; Adding frequency and amplitude merely as a quick way to add ;; a different offset to each octave - it could use random or ;; a fixed value. sum (octave (+ x frequency) (+ y amplitude) frequency amplitude) into elevation finally (return (/ elevation amplitudes)))) (defun redistribution (e power &optional (fudge 1.0)) "Raises the elevation to POWER, with higher values pushing mid-elevations down. Optionally multiplies elevation by FUDGE factor before exponentiation." (expt (* e fudge) power)) (defun distance (x y &optional (cx 0.5) (cy 0.5)) "Euclidean distance between points X Y and the centre of the map (defaults to 0.5 0.5)" (sqrt (+ (expt(- x cx) 2) (expt(- y cy) 2)))) (defun elevation (x y &key (coefs '((1 1) (2 0.5) (4 0.25))) (power 1)) "Returns an elevation value calculated through adding all the octaves with their frequency and amplitude (each cons is composed of FREQUENCY and AMPLITUDE), optionally raised to POWER for redistribution." (expt (octaves x y :coefs coefs) power)) (defun elevation-grid (width height &key (coefs '((1 1) (2 0.5) (4 0.25))) (power 1) (offset -0.5)) "Returns a WIDTHxHEIGHT where each element has an elevation value, optionally using COEFS and POWER for octaves and redistribution, plus OFFSET to chose a different noise space." (let ((grid (make-array (list width height)))) (dotimes (x width) (dotimes (y height) (let* ((nx (+ (/ x width) offset)) (ny (+ (/ y height) offset)) (e (elevation nx ny :coefs coefs :power power))) (setf (aref grid x y) e)))) grid)) ;;; PNG creation functions (defun e->rgb (e) "Takes a value between 0..1 and returns an integer between 0..255" (truncate (* e 255))) ;;; From black-tie textures.lisp example (defun set-blue (image x y value) (setf (aref image y x 2) value)) (defun set-green (image x y value) (setf (aref image y x 1) value)) (defun set-red (image x y value) (setf (aref image y x 0) value)) (defun set-rgb (image x y red green blue) (set-blue image x y blue) (set-green image x y green) (set-red image x y red)) ;;; Create and save a PNG file (defun grid-to-file (width height filename &key (coefs '((1 1) (2 0.5) (4 0.25))) (power 1) (offset -0.5) (biomes nil)) "Creates a PNG file with FILENAME that is the visual representation of an elevation map of dimensions WIDTHxHEIGHT, optionally using options for the elevation calculation. If BIOMES is not nil, use specific biome colors." (let* ((png (make-instance 'zpng:png :color-type :truecolor :width width :height height)) (image (zpng:data-array png)) (elevations (elevation-grid width height :coefs coefs :power power :offset offset))) (black-tie::with-2d (x width y height) (let* ((e (aref elevations x y)) (biome-color (and biomes (biome-color (biome e)))) (rgb (e->rgb e))) (if biome-color (apply #'set-rgb image x y biome-color) (set-rgb image x y rgb rgb rgb)))) (zpng:write-png png filename)))
5,840
Common Lisp
.lisp
133
40.962406
122
0.689722
fsmunoz/cl-rebonoise
1
1
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
748baff9a9676eecfbeb1cf75f6f480f07fdf0d64fb05eb888a683d6a45133ac
26,048
[ -1 ]
26,049
create-map.lisp
fsmunoz_cl-rebonoise/examples/create-map.lisp
;;;; cl-rebonoise.lisp ;;; ;;; Examples on how to use cl-rebonoise. ;;; ;;; ;;; This program 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 3 of ;;; the License, or (at your option) any later version. ;;; ;;; This program 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 this program. If not, see ;;; <https://www.gnu.org/licenses/>. (in-package :cl-rebonoise) ;;; Single octave, 500x500; we override the defaults since they are ;;; set to produce multiple octaves (grid-to-file 500 500 "./examples/img/1-single-pass.png" :coefs '((1 1))) ;;; Using the defaults, 3 octaves are used, producing noise at ;;; different frequencies. (grid-to-file 500 500 "./examples/img/2-three-octaves.png") ;;; The same but using a small offset: it's almost the same as the ;;; previous one but moved slightly. Higher offset values will pick up ;;; a different noise space. (grid-to-file 500 500 "./examples/img/3-offset.png" :offset -0.6) ;;; More octaves result in more interesting terrain features. (grid-to-file 500 500 "./examples/img/4-more-octaves.png" :coefs '((1 1) (2 0.5) (4 0.25) (8 0.125) (16 0.0625))) ;;; Using a different POWER will redistribute middle values, creating ;;; more abrupt "valleys" (grid-to-file 500 500 "./examples/img/5-noise1.png" :coefs '((1 1) (2 0.5) (4 0.25) (8 0.125) (16 0.0625)) :power 2) ;;; Different values can be used for each "octave" amplitude and ;;; frequency; playing with them and the rest produces different maps, ;;; obviouly. (grid-to-file 500 500 "./examples/img/6-coefs.png" :coefs '((1 3) (3 1) (4 1.25) (8 0.3) ) :power 1.5 :offset 10) ;; Biomes map colors to elevation; using different settings we can get ;; a more forest-heavy landmass. (grid-to-file 500 500 "./examples/img/7-biome1.png" :coefs '((1 1) (2 1) (4 8) (18 2) ) :power 0.75 :offset 90 :biomes t) ;;... or a more island-like map. (grid-to-file 500 500 "./examples/img/7-biome2.png" :coefs '((1 6) (2 11) (4 8) (18 2) ) :power 1.45 :offset 166 :biomes t)
2,376
Common Lisp
.lisp
43
53.906977
123
0.709232
fsmunoz/cl-rebonoise
1
1
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
48b6e54482ffd99ef73552289b6a023500dfe0a36c14ba6cda9e6c1f8898e960
26,049
[ -1 ]
26,050
cl-rebonoise.asd
fsmunoz_cl-rebonoise/cl-rebonoise.asd
;;;; cl-rebonoise.asd (asdf:defsystem #:cl-rebonoise :description "Making maps with noise functions" :author "Frederico Mu√±oz <[email protected]>" :license "GPLv3" :version "0.0.1" :serial t :depends-on (#:black-tie #:zpng) :components ((:file "package") (:file "cl-rebonoise")))
312
Common Lisp
.asd
10
27.2
49
0.654485
fsmunoz/cl-rebonoise
1
1
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
4ebf4b8efaec1ade36db8716424bc3245a371c61f35393487cb97bbbe23119cb
26,050
[ -1 ]
26,070
budget.models.lisp
SRechenberger_pecunia2/src/budget.models.lisp
(in-package :cl-user) (defpackage budget.models (:use :cl :clsql :clsql-uffi :cl-pass) ;; Database Stuff (:export :configure-database :connect-to-database :migrate) ;; Budget User (:export :user-name :user-passwd :user-id :login :add-user :find-user) ;; Budgets (:export :budget :budget-id :budget-title :budget-descr :budget-closed-p :budget-owner :budget-globals :budget-locals :get-budgets-of-user :add-budget :add-pos-to-budget :get-all-positions-from-budget :get-init-positions-of-budget :get-eventual-positions-of-budget :get-balance-of-budget) ;; Conditions (:export :name-taken-error :taken-name :login-failed-error :login-failed-message )) (in-package :budget.models) ;;; ;;; Budget User Definition ;;; (def-view-class budget-user () ((id :db-kind :key :db-constraint :not-null :type integer :initarg :id :accessor user-id ) (name :db-constraint :not-null :accessor user-name :type (string 30) :initarg :name) (passwd :db-constraint :not-null :accessor user-passwd :type string :initarg :passwd)) (:base-table budget-users)) ;;; ;;; Budget User Functions ;;; (locally-enable-sql-reader-syntax) (define-condition name-taken-error (error) ((name :initarg :taken-name :accessor taken-name :initform nil :documentation "The name already taken by another user."))) (define-condition login-failed-error (error) ((message :initarg :login-failed-message :accessor login-failed-message :initform nil :documentation "A message, why the login failed."))) (defun add-user (new-name password) "Adds a new User, given a Username and a Password, if the Username is not already take." (print "ENTERED add-user") (when (connect-to-database) (let ((max-id (select [max [id]] :from [budget_users] :flatp t)) (new-id 0)) (if (select [name] :from [budget_users] :where [= [name] new-name] :flatp t) (progn (disconnect) (error 'name-taken-error :taken-name new-name)) (progn (format t "################################") (when (car max-id) (setf new-id (+ 1 (car max-id)))) ; (format t "######~%USERNAME: ~A~%~S~%######" max-id) (let ((new-user (make-instance 'budget-user :id new-id :name new-name :passwd (hash password)))) (update-records-from-instance new-user) (disconnect))))))) (defun login (login-name password) "Tries to verify a login name and a given password. Causes a `login-failed-error` if anything went wrong. Returns `NIL` on success." (print "ENTERED login") (if (connect-to-database) (let ((pw-hash (select [passwd] :from [budget_users] :where [= [name] login-name] :flatp t))) (disconnect) (if pw-hash (unless (check-password password (car pw-hash)) (error 'login-failed-error :login-failed-message "Password is incorrect.")) (error 'login-failed-error :login-failed-message (format nil "Could not match user `~A` and given password." login-name)))))) (defun find-user (login-name) "Gets the user assoziated with the given login name. Returns `NIL` if the login name was not found." (print "ENTERED find-user") (if (connect-to-database) (let ((result (select 'budget-user :from [budget_users] :where [= [name] login-name] :flatp t))) (disconnect) (when result (car result))) NIL)) (defun get-budgets-of-user (user-id) (print "ENTERED get-budgets-of-user") (when (connect-to-database) (let ((budgets (select 'budget :where [= [slot-value 'budget 'owner] user-id] :flatp t))) (disconnect) budgets))) (restore-sql-reader-syntax-state) ;;; ;;; Budget ;;; (def-view-class budget () ((id :db-kind :key :type integer :db-constraint :not-null :accessor budget-id :initarg :id) (title :type (string 30) :db-constraint :not-null :accessor budget-title :initarg :title) (descr :type string :accessor budget-descr :initarg :descr) (closed :type boolean :initarg :closed :accessor budget-closed-p) (owner :type integer :db-constraint :not-null :accessor budget-owner :initarg :owner)) (:base-table budgets)) (locally-enable-sql-reader-syntax) (defun add-budget (&key title descr owner closedp) (print "ENTERED add-budget") (let ((to-add (make-instance 'budget :title title :descr descr :owner owner :closed-p closedp))) (when (connect-to-database) (let* ((max-id (select [max [id]] :from [budgets] :flatp t)) (new-id (if (car max-id) (+ (car max-id) 1) 0))) (setf (slot-value to-add 'id) new-id) (update-records-from-instance to-add)) (disconnect)))) (restore-sql-reader-syntax-state) ;;; Assignment (def-view-class assignment () ((bdg-id :db-kind :key :type integer :db-constraint :not-null :initarg :bdg-id) (p-id :db-kind :key :type integer :db-constraint :not-null :initarg :pos-id) (timestamp :type string :initarg :date :initform (format nil "~A" (local-time:now)))) (:base-table assignments)) ;;; Positions (def-view-class pos () ((id :db-kind :key :type integer :db-constraint :not-null :accessor pos-id :initarg :id) (title :type (string 30) :db-constraint :not-null :accessor pos-title :initarg :title) (descr :type string :accessor pos-descr :initarg :descr) (value :type string :accessor pos-value :initarg :value :db-constraint :not-null) (tag :type integer :accessor pos-tag :initarg :tag)) (:base-table positions)) (locally-enable-sql-reader-syntax) (defun add-pos-to-budget (&key budget-id title descr value timestamp (tag NIL)) (print "ENTERED add-pos-to-budget") (when (connect-to-database) (let* ((max-id (select [max [id]] :from [positions] :flatp t)) (new-id (if (car max-id) (+ 1 (car max-id)) 0)) (new-pos (make-instance 'pos :id new-id :title title :descr descr :value value :tag tag)) (new-assgn (make-instance 'assignment :bdg-id budget-id :pos-id new-id :date timestamp))) (format t "(:TITLE ~A :DESCR ~A :VALUE ~A)~%" title descr value) (update-records-from-instance new-pos) (update-records-from-instance new-assgn) (disconnect)))) (defun get-all-positions-from-budget (&key budget-id) (format T "ENTERED (get-all-positions-from-budget :budget-id ~A)" budget-id) (when (connect-to-database) (let* ((p-ids (select [p-id] :from [assignments] :where [= [bdg-id] budget-id] :flatp t )) (poss (if p-ids (select 'pos :where [in [slot-value 'pos 'id] p-ids] :flatp t) NIL))) (disconnect) poss))) (defun get-init-positions-of-budget (&key budget-id) (format T "ENTERED (get-init-positions-of-budget :budget-id ~A)" budget-id) (when (connect-to-database) (let* ((p-ids (select [p-id] :from [assignments] :where [and [= [bdg-id] budget-id] [is [timestamp] nil]] :flatp T)) (poss (when p-ids (select 'pos :where [in [slot-value 'pos 'id] p-ids] :flatp T)))) (disconnect) poss))) (defun get-eventual-positions-of-budget (&key budget-id) (format T "ENTERED (get-init-eventual-of-budget :budget-id ~A)" budget-id) (when (connect-to-database) (let* ((p-ids (select [p-id] :from [assignments] :where [and [= [bdg-id] budget-id] [not [is [timestamp] nil]]] :flatp T)) (poss (when p-ids (select 'pos :where [in [slot-value 'pos 'id] p-ids] :flatp T)))) (disconnect) poss))) (defun get-balance-of-budget (&key budget-id) (print "ENTERED get-balance-of-budget") (when T (let* ((ps (get-all-positions-from-budget :budget-id budget-id)) (s (loop :for p :in ps :sum (parse-number:parse-real-number (pos-value p))))) (print ps) s))) (restore-sql-reader-syntax-state) ;;; Tags (def-view-class tag () ((id :db-kind :key :type integer :db-constraint :not-null :accessor tag-id :initarg :id) (title :type (string 30) :db-constraint :not-null :accessor tag-title :initarg :title) (descr :type string :accessor tag-title :initarg :title)) (:base-table tags)) ;;; ;;; Database Connection ;;; (defvar *db-server* nil) (defvar *db-name* nil) (defvar *db-user* nil) (defvar *db-password* nil) (defvar *db-type* :mysql) (defun configure-database (&key (server "localhost") (database "budgetapp") (username "budgetapp") (password "budgetapp")) (setf *db-server* server) (setf *db-name* database) (setf *db-user* username) (setf *db-password* password)) (defun connect-to-database () ;; Are there information about the database? (when (and *db-server* *db-name* *db-user* *db-password*) ;; If yes, connect! (connect `(,*db-server* ,*db-name* ,*db-user* ,*db-password*) :database-type *db-type*))) (defun migrate () (when (connect-to-database) (progn (start-sql-recording) (ignore-errors (drop-view-from-class 'assignment) (drop-view-from-class 'budget) (drop-view-from-class 'tag) (drop-view-from-class 'pos) (drop-view-from-class 'budget-user)) (create-view-from-class 'budget-user) (create-view-from-class 'budget) (create-view-from-class 'tag) (create-view-from-class 'pos) (create-view-from-class 'assignment) (disconnect))))
12,222
Common Lisp
.lisp
353
22.84136
91
0.500676
SRechenberger/pecunia2
1
0
3
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
bd144f1cd6dc1393d7359d8b8bf989b2568a3b0de9da4ca23f9741ce9a5ed5ca
26,070
[ -1 ]
26,071
budget.lisp
SRechenberger_pecunia2/src/budget.lisp
(in-package :cl-user) (defpackage :budget (:use :cl :lucerne :parse-number ) (:export :main) (:documentation "Main budget code.")) (in-package :budget) (annot:enable-annot-syntax) ;;; App (defapp pecunia :middlewares (clack.middleware.session:<clack-middleware-session> (clack.middleware.static:<clack-middleware-static> :root (asdf:system-relative-pathname :pecunia2 #p"static/") :path "/static/"))) (defun main () (budget.models:configure-database) (start pecunia :port 8000)) ;;; Templates (djula:add-template-directory (asdf:system-relative-pathname :pecunia2 #p"templates/")) (defparameter +index+ (djula:compile-template* "index.html")) (defparameter +budgets+ (djula:compile-template* "budgets.html")) ;;; Views (defclass budget-output () ((bdg :accessor get-budget :initarg :budget :type budget.models:budget) (balance :accessor get-balance :initarg :balance :type single-float) (inits :accessor get-inits :initarg :inits :type list) (eventuals :accessor get-eventuals :initarg :eventuals :type list))) @route pecunia "/" (defview index () (if (lucerne-auth:logged-in-p) (let ((user (current-user))) (render-template (+budgets+) :username (budget.models:user-name user) ;; Dummy values! :budgets (let ((budgets (budget.models:get-budgets-of-user (budget.models:user-id (current-user))))) (loop :for bdg :in budgets :collect (make-instance 'budget-output :budget bdg :balance (budget.models:get-balance-of-budget :budget-id (budget.models:budget-id bdg)) :inits (budget.models:get-init-positions-of-budget :budget-id (budget.models:budget-id bdg)) :eventuals (budget.models:get-eventual-positions-of-budget :budget-id (budget.models:budget-id bdg))))))) (render-template (+index+)))) @route pecunia (:post "/add-budget") (defview add-budget () (with-params (title descr) (progn (budget.models:add-budget :title title :descr descr :owner (budget.models:user-id (current-user)) :closedp 0))) (redirect "/")) @route pecunia (:post "/signup") (defview sign-up () (with-params (username password password-repeat) (if (string= password password-repeat) (handler-case ;; Try to add the user. ;; May cause a `name-taken-error`. (progn (format t "Signing up ~A~%" username) (budget.models:add-user username password) (format t "Signed up ~A~%" username) (redirect "/")) ;; on `NAME-TAKEN-ERROR` (budget.models:name-taken-error (err) (render-template (+index+) :error (budget.models:taken-name err)))) (render-template (+index+) :error "Passwords do not match!")))) @route pecunia (:post "/add-position/:budget-id/:which") (defview add-position (which budget-id) (with-params (title descr value) (progn (format t "(:TITLE ~A :DESCR ~A :VALUE ~A)~%" title descr value) (budget.models:add-pos-to-budget :budget-id (parse-integer budget-id) :title title :descr descr :value value :timestamp (cond ((string= which "eventual") (format nil "~A" (local-time:now))) ((string= which "init") nil) (T nil))) (redirect "/")))) @route pecunia (:post "/signin") (defview sign-in () (with-params (username password) (handler-case (progn ;; This may cause a `login-failed-error`. (budget.models:login username password) ;; This will only be executed, if no condition was caused. (lucerne-auth:login username) (redirect "/")) (budget.models:login-failed-error (err) (render-template (+index+) :error (budget.models:login-failed-message err)))))) @route pecunia "/signout" (defview sign-out () (when (lucerne-auth:logged-in-p) (lucerne-auth:logout)) (redirect "/")) ;;; Utils (defun current-user () "Gets the user-id of the current user." (let ((username (lucerne-auth:get-userid))) (when username (budget.models:find-user username))))
5,491
Common Lisp
.lisp
129
27.023256
102
0.489517
SRechenberger/pecunia2
1
0
3
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
38c0c9274ecbc54b4c39c1cbae76b6d5c7b05fd6889d9f40da151713b29fa7c8
26,071
[ -1 ]
26,072
manifest.lisp
SRechenberger_pecunia2/docs/manifest.lisp
(:docstring-markup-format :scriba :systems (budget) :documents ((:title "budget Manual" :authors ("Sascha Rechenberger") :output-format (:type :multi-html :template :minima) :sources ("manual.scr"))))
275
Common Lisp
.lisp
7
27.714286
48
0.544776
SRechenberger/pecunia2
1
0
3
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
f0846948c86742bbb1c49492cd477b0c9eff47f355d86e3a022c8909df22ee51
26,072
[ -1 ]
26,073
budget.lisp
SRechenberger_pecunia2/t/budget.lisp
(in-package :cl-user) (defpackage budget-test (:use :cl :fiveam)) (in-package :budget-test) (def-suite tests :description "budget tests.") (in-suite tests) (test simple-test (is (equal 1 1)) (is-true (and t t))) (run! 'tests)
243
Common Lisp
.lisp
13
16.384615
31
0.678414
SRechenberger/pecunia2
1
0
3
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
bb14b2cc2cce90a07acd82f68c4b9cead4f3fb7cfc69d49a923155792e8f3a94
26,073
[ -1 ]
26,074
budget-test.asd
SRechenberger_pecunia2/budget-test.asd
(defsystem budget-test :author "Sascha Rechenberger <[email protected]>" :license "GPLv3" :description "Tests for budget." :depends-on (:pecunia2 :fiveam) :components ((:module "t" :serial t :components ((:file "budget")))))
311
Common Lisp
.asd
10
22.8
64
0.574751
SRechenberger/pecunia2
1
0
3
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
b0cfdea13b79e5e7ea34d187512cf674f6e3fa36b5107dc1c2146af0127fdb4a
26,074
[ -1 ]
26,075
pecunia2.asd
SRechenberger_pecunia2/pecunia2.asd
(defsystem pecunia2 :author "Sascha Rechenberger <[email protected]>" :maintainer "Sascha Rechenberger <[email protected]>" :license "GPLv3" :version "0.1" :homepage "https://github.com/SRechenberger/pecunia2" :bug-tracker "https://github.com/SRechenberger/pecunia2/issues" :source-control (:git "[email protected]:SRechenberger/pecunia2.git") :depends-on (:lucerne :lucerne-auth :clsql :clsql-uffi :cl-pass :clsql-helper :local-time :parse-number) :defsystem-depends-on (:asdf-linguist) :components ((:module "src" :serial t :components ((:file "budget.models") (:file "budget")))) :description "A simple Budget Manager" :long-description #.(uiop:read-file-string (uiop:subpathname *load-pathname* "README.md")) :in-order-to ((test-op (test-op budget-test))))
987
Common Lisp
.asd
27
28.037037
68
0.6125
SRechenberger/pecunia2
1
0
3
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
ee575efbeca51e25faf66f01a7b7ce2327660bd3e580bcbd7aef6ac7dfa4fe35
26,075
[ -1 ]
26,079
style.css
SRechenberger_pecunia2/assets/css/style.css
/* Variables */ /* Mixins */ /* Style */ *, *:after, *:before { margin: 0; padding: 0; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } html { height: 100vh; margin: 0; padding: 0; } /*# sourceMappingURL=style.css.map */
277
Common Lisp
.l
14
17.5
37
0.636015
SRechenberger/pecunia2
1
0
3
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
cbda8174724372ae6c903c068522bd68b7bb671558485766d7ff618fc566e89c
26,079
[ -1 ]
26,081
manual.scr
SRechenberger_pecunia2/docs/manual.scr
@begin(section) @title(Overview) A simple Budget Manager @end(section) @begin(section) @title(API Reference) @end(section)
130
Common Lisp
.l
7
16.571429
23
0.810345
SRechenberger/pecunia2
1
0
3
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
6532741b6ec766bea827e76ba362626ff8e396981c33b60c65abe9e3d9ccd535
26,081
[ -1 ]
26,082
budgets.html
SRechenberger_pecunia2/templates/budgets.html
{% extends "base.html" %} {% block content %} <div class="panel panel-default"> <div class="panel-heading user-brief"> <h1> Budgets </h1> <form role="form" action="/signout"> <button type="submit" class="btn btn-link"> logout ({{ username }}) </button> </form> </div> <div class="panel-body"> <form role="form" action="/add-budget" method="post"> <div class="panel panel-info"> <div class="panel-heading"> <div class="row"> <div class="col-md-8"> New Budget </div> <div class="col-md-4" align="right"> <button type="submit" class="btn btn-link"> Add </button> </div> </div> </div> <div class="panel-body"> <div class="row"> <div class="col-md-4"> <div class="form-group"> <label for="budget-title" class="sr-only"> Budget Title </label> <input type="text" class="form-control" id="budget-title" name="title" placeholder="Title"> </div> </div> <div class="col-md-4"> <div class="form-group"> <label for="budget-descr" class="sr-only"> Budget Description </label> <input type="text" class="form-control" id="budget-descr" name="descr" placeholder="Description"> </div> </div> </div> </div> </div> </form> {% if budgets %} <div id="show-budgets"> {% for bdgout in budgets %} <div class="media budget"> <div class="panel panel-default"> <div class="panel-heading"> <div class="row"> <div class="col-lg-10"> <div class="row-lg-1" align="left"> <font size=6> {{ bdgout.bdg.title }} </font> </div> <div class="row-lg-1"> {{ bdgout.bdg.descr }} </div> </div> <div class="col-lg-2" align="right"> <font size=9> {{ bdgout.balance }} € </font> </div> </div> </div> <div class="panel-body"> <div class="row"> <div class="col-lg-6"> <div class="panel panel-default"> <div class="panel-heading"> <font size=6> Initial entries </font> </div> <div class="panel-body"> <table class="table table-striped"> <thead> <tr> <th>ID</th> <th>Title</th> <th>Description</th> <th>Value</th> </tr> </thead> <tbody> {% for pos in bdgout.inits %} <tr> <td>{{ pos.id }}</td> <td>{{ pos.title }}</td> <td>{{ pos.descr }}</td> <td>{{ pos.value }}</td> </tr> {% endfor %} <tr> <form role="form" action="/add-position/{{ bdgout.bdg.id }}/init" method="post"> <td> <button type="submit" class="btn btn-link"> <span class="glyphicon glyphicon-plus"></span> </button> </td> <td> <div class="form-group"> <label for="pos-title" class="sr-only"> Positions Title </label> <input type="text" class="form-control" id="pos-title" name="title" placeholder="Title"> </div> </td> <td> <div class="form-group"> <label for="pos-descr" class="sr-only"> Position Description </label> <input type="text" class="form-control" id="pos-descr" name="descr" placeholder="description"> </div> </td> <td> <div class="form-group"> <label for="pos-value" class="sr-only"> Position Value </label> <input type="text" class="form-control" id="pos-value" name="value" placeholder="Value"> </div> </td> </form> <td> </tr> </tbody> </table> </div> </div> </div> <div class="col-lg-6"> <div class="panel panel-default"> <div class="panel-heading"> <font size=6> Eventual entries </font> </div> <div class="panel-body"> <table class="table table-striped"> <thead> <tr> <th>ID</th> <th>Title</th> <th>Description</th> <th>Value</th> </tr> </thead> <tbody> {% for pos in bdgout.eventuals %} <tr> <td>{{ pos.id }}</td> <td>{{ pos.title }}</td> <td>{{ pos.descr }}</td> <td>{{ pos.value }} €</td> </tr> {% endfor %} <tr> <form role="form" action="/add-position/{{ bdgout.bdg.id }}/eventual" method="post"> <td> <button type="submit" class="btn btn-link"> <span class="glyphicon glyphicon-plus"></span> </button> </td> <td> <div class="form-group"> <label for="pos-title" class="sr-only"> Positions Title </label> <input type="text" class="form-control" id="pos-title" name="title" placeholder="Title"> </div> </td> <td> <div class="form-group"> <label for="pos-descr" class="sr-only"> Position Description </label> <input type="text" class="form-control" id="pos-descr" name="descr" placeholder="description"> </div> </td> <td> <div class="form-group"> <label for="pos-value" class="sr-only"> Position Value </label> <div class="input-group"> <input type="text" class="form-control" id="pos-value" name="value" width="20px" placeholder="Value"> </div> </div> </td> </form> </tr> </tbody> </table> </div> </div> </div> </div> </div> </div> {% endfor %} </div> </div> {% else %} <div class="alert alert-info" role="alert"> Your do not have any budgets to manage. </div> {% endif %} </div> </div> {% endblock %}
8,748
Common Lisp
.l
258
16.193798
75
0.337266
SRechenberger/pecunia2
1
0
3
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
88192c0ee54f153695466e16d38de5586e496fb767087f15e7257b16c4951b5b
26,082
[ -1 ]
26,083
base.html
SRechenberger_pecunia2/templates/base.html
<!DOCTYPE html> <html lang="en"> {% include "includes/head.html" %} <body> {% block content %}{% endblock %} </body> </html>
136
Common Lisp
.l
7
16.857143
37
0.59375
SRechenberger/pecunia2
1
0
3
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
f0b538aee27fc675b25891aed7f5837cd86c1cf33428ac6993514ad20d44ee80
26,083
[ -1 ]
26,084
index.html
SRechenberger_pecunia2/templates/index.html
{% extends "base.html" %} {% block content %} <div id="landing"> <div id="welcome-panel" class="panel panel-default"> <div class="panel-heading"> <div class="col"> <div class="row" align="center"> <h1> PECUNIA II </h1> </div> <div class="row" align="center"> <h3> THE BUDGET MANAGEMENT SYSTEM </h3> </div> </div> </div> <div class="panel-body"> {% if error %} <div class="alert alert-danger" role="alert"> {{ error }} </div> {% endif %} <div class="row"> <div class="col-md-6"> <h3>Sign up</h3> <form role="form" action="/signup" method="post"> <div class="form-group"> <label for="sign-up-username" class="sr-only"> Username </label> <input type="text" class="form-control" id="sign-up-username" name="username" placeholder="Username"> </div> <div class="form-group"> <label for="sign-up-password" class="sr-only"> Password </label> <input type="password" class="form-control" id="sign-up-password" name="password" placeholder="Password"> </div> <div class="form-group"> <label for="sign-up-password-repeat" class="sr-only"> Repeat Password </label> <input type="password" class="form-control" id="sign-up-password-repeat" name="password-repeat" placeholder="Repeat Password"> </div> <button type="submit" class="btn btn-default"> Submit </button> </form> </div> <div class="col-md-6"> <h3> Sign in </h3> <form role="form" action="/signin" method="post"> <div class="form-group"> <label for="sing-in-username" class="sr-only"> Username </label> <input type="text" class="form-control" id="sign-in-username" name="username" placeholder="Username"> </div> <div class="form-group"> <label for="sing-in-password" class="sr-only"> Password </label> <input type="password" class="form-control" id="sign-in-password" name="password" placeholder="Password"> </div> <button type="submit" class="btn btn-default"> Submit </button> </form> </div> </div> </div> </div> <div class="col-lg-12" align="center"> <font color="#dddddd"> {% include "includes/version.html" %} </font> </font> </div> {% endblock %}
3,122
Common Lisp
.l
99
19.161616
67
0.449487
SRechenberger/pecunia2
1
0
3
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
f7fe0a4c714b748da7f33a830304be96f0dd821f61bf196d245131ed82df4910
26,084
[ -1 ]
26,085
head.html
SRechenberger_pecunia2/templates/includes/head.html
<head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- jQuery --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <!-- Bootstrap --> <link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous"> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" crossorigin="anonymous"></script> <!-- Custon CSS --> <link href="static/style.css" rel="stylesheet"> <title> {% if title %} &ndash; budget {% else %} budget {% endif %} </title> </head>
749
Common Lisp
.l
22
29.454545
91
0.644537
SRechenberger/pecunia2
1
0
3
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
5a9db0e83c6aa6a955f5c8e53f9bae65cd1de56184e620f190f1625aba78f3c3
26,085
[ -1 ]
26,087
style.css
SRechenberger_pecunia2/static/style.css
@import url(http://fonts.googleapis.com/css?family=Source+Sans+Pro); @import url(http://fonts.googleapis.com/css?family=Inconsolata); /* General CSS */ h1, h2, h3, h4 { font-family: 'Inconsolata', sans-serif; } body, html { height:100%; overflow: auto; } /* Panels */ .panel { /* padding: 10px; */ margin: 20px auto 0; width: 95%; } /* .panel-heading { background-color: white !important; padding-bottom: 0px; overflow: auto; }*/ /* Sign up/in page */ #landing { background-image: -webkit-gradient(linear, left bottom, right top, color-stop(0, #787FD5), color-stop(1, #9EDDFF)); background-image: -webkit-linear-gradient(right top, #787FD5 0%, #9EDDFF 100%); background-image: -moz-linear-gradient(right top, #787FD5 0%, #9EDDFF 100%); background-image: -ms-linear-gradient(right top, #787FD5 0%, #9EDDFF 100%); background-image: -o-linear-gradient(right top, #787FD5 0%, #9EDDFF 100%); background-image: linear-gradient(to right top, #787FD5 0%, #9EDDFF 100%); width: 100%; min-height: 100%; overflow: auto; } #welcome-panel .panel-heading { text-align: center; } /* Profile page */ #names { list-style-type: none; padding-left: 0; } #names .full { font-size: 32px; font-style: bold; } .tweet .media-object { width: 64px; }
1,334
Common Lisp
.l
49
24.061224
119
0.670338
SRechenberger/pecunia2
1
0
3
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
cc74f15b92e09cf0db4937ec4ffd94e7c5a83abe2f7e28ed02868edf4befc55c
26,087
[ -1 ]
26,102
simple-parallel-tasks.lisp
glv2_simple-parallel-tasks/simple-parallel-tasks.lisp
;;; simple-parallel-tasks ;;; Copyright 2019-2020 Guillaume Le Vaillant ;;; This library is free software released under the GNU GPL-3 license. (defpackage :simple-parallel-tasks (:use :cl :chanl) (:export #:pvalues #:plist #:plet #:pprog1 #:pprogn)) (in-package :simple-parallel-tasks) (defmacro pvalues (&rest forms) "Evaluate FORMS in parallel and return the results as multiple values." (let* ((channels (loop repeat (length forms) collect (gensym))) (bindings (mapcar (lambda (channel) `(,channel (make-instance 'bounded-channel))) channels)) (start-tasks (mapcar (lambda (channel form) `(pcall (lambda () (send ,channel ,form)))) channels forms)) (results (mapcar (lambda (channel) `(recv ,channel)) channels))) `(let ,bindings ,@start-tasks (values ,@results)))) (defmacro plist (&rest forms) "Evaluate FORMS in parallel and return the results in a list." `(multiple-value-list (pvalues ,@forms))) (defmacro plet (bindings &body body) "Like LET, but the BINDINGS are evaluated in parallel." (let* ((channels (loop repeat (length bindings) collect (gensym))) (vars (mapcar (lambda (binding) (if (listp binding) (car binding) binding)) bindings)) (forms (mapcar (lambda (binding) (if (listp binding) (cadr binding) nil)) bindings)) (chan-bindings (mapcar (lambda (channel) `(,channel (make-instance 'bounded-channel))) channels)) (start-tasks (mapcar (lambda (channel form) `(pcall (lambda () (send ,channel ,form)))) channels forms)) (var-bindings (mapcar (lambda (var channel) `(,var (recv ,channel))) vars channels))) `(let ,chan-bindings ,@start-tasks (let ,var-bindings ,@body)))) (defmacro pprog1 (first-form &body forms) "Evaluate FIRST-FORM and FORMS in parallel and return the result of the evaluation of FIRST-FORM." `(nth-value 0 (pvalues ,first-form ,@forms))) (defmacro pprogn (&rest forms) "Evaluate FORMS in parallel and return the result of the evaluation of the last form." (when forms `(nth-value ,(1- (length forms)) (pvalues ,@forms))))
2,802
Common Lisp
.lisp
63
30.142857
79
0.519224
glv2/simple-parallel-tasks
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
0036edbcb7157a9dbc697ed99c3be0ce5a07c683fb9ef0c6d80350776e16c8cd
26,102
[ -1 ]
26,103
simple-parallel-tasks-tests.lisp
glv2_simple-parallel-tasks/simple-parallel-tasks-tests.lisp
;;; simple-parallel-tasks ;;; Copyright 2019-2020 Guillaume Le Vaillant ;;; This library is free software released under the GNU GPL-3 license. (defpackage :simple-parallel-tasks-tests (:use :cl :fiveam :simple-parallel-tasks)) (in-package :simple-parallel-tasks-tests) (def-suite simple-parallel-tasks-tests) (in-suite simple-parallel-tasks-tests) (defmacro duration (&body body) (let ((start-time (gensym)) (end-time (gensym)) (result (gensym)) (duration (gensym))) `(let* ((,start-time (get-internal-real-time)) (,result ,@body) (,end-time (get-internal-real-time)) (,duration (/ (- ,end-time ,start-time) internal-time-units-per-second))) (values ,duration ,result)))) (test plist (is (null (plist))) (is (equalp '(a) (plist 'a))) (is (equalp '(10 20) (plist (+ 4 6) (* 4 5)))) (is (equalp '(1 2 3 4 5) (plist 1 2 3 4 5))) (is (> 1.01 (duration (plist (sleep 1))))) (is (> 1.01 (duration (plist (sleep 1) (sleep 1))))) (is (> 1.01 (duration (plist (sleep 1) (sleep 1) (sleep 1)))))) (test pvalues (is (null (multiple-value-list (pvalues)))) (is (equalp '(a) (multiple-value-list (pvalues 'a)))) (is (equalp '(10 20) (multiple-value-list (pvalues (+ 4 6) (* 4 5))))) (is (equalp '(1 2 3 4 5) (multiple-value-list (pvalues 1 2 3 4 5)))) (is (> 1.01 (duration (multiple-value-list (pvalues (sleep 1)))))) (is (> 1.01 (duration (multiple-value-list (pvalues (sleep 1) (sleep 1)))))) (is (> 1.01 (duration (multiple-value-list (pvalues (sleep 1) (sleep 1) (sleep 1))))))) (test plet (is (null (plet ()))) (is (equalp 'a (plet ((x 'a)) x))) (is (equalp '(10 20) (plet ((x (+ 4 6)) (y (* 4 5))) (list x y)))) (is (equalp '(1 2 3 4 5) (plet ((a 1) (b 2) (c 3) (d 4) (e 5)) (list a b c d e)))) (is (> 1.01 (duration (plet ((x (sleep 1))) x)))) (is (> 1.01 (duration (plet ((x (sleep 1)) (y (sleep 1))) (list x y))))) (is (> 1.01 (duration (plet ((x (sleep 1)) (y (sleep 1)) (z (sleep 1))) (list x y z)))))) (test pprog1 (is (equalp 'a (pprog1 'a))) (is (equalp 10 (pprog1 (+ 4 6) (* 4 5)))) (is (equalp 1 (pprog1 1 2 3 4 5))) (is (> 1.01 (duration (pprog1 (sleep 1))))) (is (> 1.01 (duration (pprog1 (sleep 1) (sleep 1))))) (is (> 1.01 (duration (pprog1 (sleep 1) (sleep 1) (sleep 1)))))) (test pprogn (is (null (pprogn))) (is (equalp 'a (pprog1 'a))) (is (equalp 20 (pprogn (+ 4 6) (* 4 5)))) (is (equalp 5 (pprogn 1 2 3 4 5))) (is (> 1.01 (duration (pprogn (sleep 1))))) (is (> 1.01 (duration (pprogn (sleep 1) (sleep 1))))) (is (> 1.01 (duration (pprogn (sleep 1) (sleep 1) (sleep 1))))))
3,048
Common Lisp
.lisp
76
31.723684
80
0.505235
glv2/simple-parallel-tasks
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
a00f2840590821d8056d3dc65aff1d32098becffbd61c7dea59956f26ad85e48
26,103
[ -1 ]
26,104
simple-parallel-tasks.asd
glv2_simple-parallel-tasks/simple-parallel-tasks.asd
;;; simple-parallel-tasks ;;; Copyright 2019 Guillaume Le Vaillant ;;; This library is free software released under the GNU GPL-3 license. (defsystem "simple-parallel-tasks" :name "simple-parallel-tasks" :description "Evaluate forms in parallel" :version "1.0" :author "Guillaume Le Vaillant" :license "GPL-3" :depends-on ("chanl") :in-order-to ((test-op (test-op "simple-parallel-tasks-tests"))) :components ((:file "simple-parallel-tasks")))
461
Common Lisp
.asd
12
36
71
0.732143
glv2/simple-parallel-tasks
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
3a660b15feffe186413707236eb975ad776f22b88e93264cac62c655959f14b0
26,104
[ -1 ]
26,105
simple-parallel-tasks-tests.asd
glv2_simple-parallel-tasks/simple-parallel-tasks-tests.asd
;;; simple-parallel-tasks ;;; Copyright 2019 Guillaume Le Vaillant ;;; This library is free software released under the GNU GPL-3 license. (defsystem "simple-parallel-tasks-tests" :name "simple-parallel-tasks-tests" :description "Tests for simple-parallel-tasks" :version "1.0" :author "Guillaume Le Vaillant" :license "GPL-3" :depends-on ("fiveam" "simple-parallel-tasks") :in-order-to ((test-op (load-op "simple-parallel-tasks-tests"))) :perform (test-op (o s) (let ((tests (uiop:find-symbol* 'simple-parallel-tasks-tests :simple-parallel-tasks-tests))) (uiop:symbol-call :fiveam 'run! tests))) :components ((:file "simple-parallel-tasks-tests")))
742
Common Lisp
.asd
16
39.625
76
0.662069
glv2/simple-parallel-tasks
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
42f81e054de8fbeb585ce0719f3530880129a981eb3e9353b8f86b688d3db504
26,105
[ -1 ]
26,125
snake.lisp
mjkalyan_snake/snake.lisp
;;;; snake.lisp (in-package #:snake) (defun make-coords (&optional x y) (make-array 2 :initial-contents (list (or x (+ *easing* (random (- *board-size* (* 2 *easing*))))) (or y (+ *easing* (random (- *board-size* (* 2 *easing*)))))))) (defun logical->px (c) "Calculate a pixel coordinate based on a logical coordinate C." (* c *px-per-seg*)) (defun random-heading () "Pick a random direction." (alexandria:random-elt (list :up :down :left :right))) (defun random-starting-trail (heading length) "Based on HEADING and LENGTH, pick a starting trail (position and size) for a snake." (loop for i from 1 to length with (x y) = (list (/ *board-size* 2) (/ *board-size* 2)) for (xoff yoff) = (case heading (:up (list 0 i)) (:down (list 0 (- i))) (:left (list i 0)) (:right (list (- i) 0))) collect (make-coords (+ x xoff) (+ y yoff)))) (defclass snake () ((%heading :initarg :heading :accessor heading :documentation "Which way is the snake going?") (%trail :initarg :trail :accessor trail :documentation "A list of the logical positions where the snake is and has been. This is as long as the snake.") (%should-grow :initform nil :accessor should-grow :documentation "Whether the snake should grow."))) (defun make-snake (&optional (heading (random-heading)) (length 3)) (let ((trail (random-starting-trail heading length))) (make-instance 'snake :trail trail :heading heading))) (defun overlapping-p (seg1 seg2) "Are segments SEG1 & SEG2 overlapping?" (and (= (elt seg1 0) (elt seg2 0)) (= (elt seg1 1) (elt seg2 1)))) (defun hitting-wall-p (head) "Is the HEAD trail segment hitting a wall?" (or (not (< -1 (elt head 0) *board-size*)) (not (< -1 (elt head 1) *board-size*)))) (defun check-collisions (snake food) "When the SNAKE collides with FOOD, a wall, or itself, return the appropriate action (:EAT/:DIE)" (let ((head (car (trail snake)))) (cond ((overlapping-p head ;; TODO not efficient, maybe food should have its own logical pos (make-coords (truncate (/ (x food) *px-per-seg*)) (truncate (/ (y food) *px-per-seg*)))) :eat) ((or (hitting-wall-p head) (loop for segment in (cdr (trail snake)) when (overlapping-p head segment) return t)) :die)))) (defun maybe-change-heading (snake) "Change the SNAKE's heading based on player input." (setf (heading snake) (cond ((and (is-key-pressed-p +key-up+) (not (eq (heading snake) :down))) :up) ((and (is-key-pressed-p +key-down+) (not (eq (heading snake) :up))) :down) ((and (is-key-pressed-p +key-left+) (not (eq (heading snake) :right))) :left) ((and (is-key-pressed-p +key-right+) (not (eq (heading snake) :left))) :right) (t (heading snake))))) (defun update-trail (snake) "Move the SNAKE, growing it when needed." (let ((new-segment (alexandria:copy-array (car (trail snake))))) (case (heading snake) (:right (incf (elt new-segment 0))) (:left (decf (elt new-segment 0))) (:down (incf (elt new-segment 1))) (:up (decf (elt new-segment 1)))) (setf (trail snake) (if (should-grow snake) (progn (setf (should-grow snake) nil) (cons new-segment (trail snake))) (cons new-segment (butlast (trail snake))))))) (defun new-pos (food snake) "Place FOOD at a location not occupied by SNAKE." (loop for xy = (make-coords) when (notany (lambda (snake-seg) (overlapping-p xy snake-seg)) (trail snake)) return (setf (x food) (logical->px (elt xy 0)) (y food) (logical->px (elt xy 1))))) (defun draw-snake (snake) "Draw each segment of the SNAKE." (loop for segment in (trail snake) do (claylib/ll:draw-rectangle (logical->px (elt segment 0)) (logical->px (elt segment 1)) *px-per-seg* *px-per-seg* (claylib::c-struct +green+)))) (defun prompt-restart (snake) "Ask the player if they want to start again, displaying some info about SNAKE." (with-drawing (:bgcolor +black+) (claylib/ll:draw-text (format nil "You died with a length of ~a!~%SPC to restart or ESC to ext." (length (trail snake))) (logical->px (/ *board-size* 4)) (logical->px (/ *board-size* 2)) 20 (claylib::c-struct +orange+))) (is-key-pressed-p +key-space+)) (defun reset (snake food) "Reset the SNAKE and FOOD." (setf (heading snake) (random-heading) (trail snake) (random-starting-trail (heading snake) 3) (should-grow snake) nil) (new-pos food snake)) (defun initialize () "Initialize all global variables." (defparameter *board-size* 40 "The number of x & y segments length of the game board.") (defparameter *px-per-seg* 15 "How many pixels an edge of a segment is.") (defparameter *easing* 2 "Minimum distance from the edge of the screen that food must be placed.") (defparameter *scene* (make-scene () ((snake (make-snake)) (food (let ((xy (make-coords))) (make-rectangle (logical->px (elt xy 0)) (logical->px (elt xy 1)) *px-per-seg* *px-per-seg* +orange+ :filled nil :thickness 3))))))) (defun main () (initialize) (with-window (:title "Snake!" :width (logical->px *board-size*) :height (logical->px *board-size*) :fps 60) (with-scenes *scene* (with-scene-objects (snake food) *scene* (do-game-loop (:livesupport t :vars ((diedp nil) (frame-counter 0) (frame-speed 1/64))) (if diedp (let ((restartp (prompt-restart snake))) (when restartp (reset snake food) (setf diedp nil))) (when (>= (incf frame-counter) (/ 60 frame-speed)) (maybe-change-heading snake) (setf frame-counter 0) (update-trail snake) (case (check-collisions snake food) (:die (setf diedp t)) (:eat (progn (setf (should-grow snake) t) (new-pos food snake)))) (with-drawing (:bgcolor +black+) (draw-object food) (draw-snake snake)))))))))
7,414
Common Lisp
.lisp
165
31.987879
99
0.512384
mjkalyan/snake
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
12d2fc0bd7d70dd7b8fa59c495787008871fcb894dce07185229d1b0a9c2f15d
26,125
[ -1 ]
26,126
snake.asd
mjkalyan_snake/snake.asd
;;;; snake.asd (asdf:defsystem #:snake :description "A new concept in gaming." :author "James Kalyan <[email protected]>" :license "" :version "0.0.1" :serial t :depends-on (#:claylib #:alexandria) :components ((:file "package") (:file "snake")) :build-operation "program-op" :build-pathname "snake" :entry-point "snake:main")
370
Common Lisp
.asd
13
24.692308
50
0.657303
mjkalyan/snake
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
59dd1f887108e0a3e8bd92cead34080d0cfb357f3c2dfd1d0cf96107e7ed0f7a
26,126
[ -1 ]
26,143
csound-synth.lisp
cac-t-u-s_csound/csound-synth.lisp
;============================================================================ ; om#: visual programming language for computer-aided music composition ;============================================================================ ; ; This program is free software. For information on usage ; and redistribution, see the "LICENSE" file in this distribution. ; ; This program 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. ; ;============================================================================ ; File author: J. Bresson ;============================================================================ ;============================================================ ; CSOUND INTERFACE ;============================================================ (in-package :om) ;;;============================= ;;; Preferences ;;;============================= (defun which-executable (program-file &optional default) (with-open-stream (s (sys::open-pipe (format nil "which ~A" program-file))) (let ((path (read-line s nil nil))) (if path (handler-case (and (file-executable-p path) path) (simple-error () default)) default)))) (add-preference-section :externals "Csound" nil '(:csound-flags :csound-gen-args :csound-def-table :csound-table-size)) (add-preference :externals :csound-path "Csound exec path" :file #+linux (pathname (which-executable "csound" "no csound found in $PATH")) #-linux #P"/usr/local/bin/csound" ) (add-preference :externals :csound-flags "Default flags" :string "-f -m7 -N -g -b8192 -B8192") (add-preference :externals :csound-gen-args "Max GEN arguments" (make-number-in-range :min 2 :max 10000) 1024) (add-preference :externals :csound-def-table "Default table" :string "f 1 0 4097 7 0 2048 1 2048 0") (add-preference :externals :csound-table-size "Default table size" (make-number-in-range :min 2 :max 10000) 4097) ;;;================================ ;;; Main Csound synthesis function ;;;================================ (defmethod! csd-synth ((csd t) &key out) (csd-synth (convert-input-to-csound csd "csd") :out out)) ;;; A CSD file already contains all informations in (defmethod! csd-synth ((csd pathname) &key out) :icon 'csound (if (get-pref-value :externals :csound-path) (let* ((RT-OUT (equal out :rt)) (csout (if RT-OUT nil (handle-new-file-exists (cond ((pathnamep out) out) ((stringp out) (outfile out)) (t (outfile "cs_out")))))) (outpath (unless RT-OUT (handle-new-file-exists (om-make-pathname :directory csout :name (pathname-name csout) :type (or (pathname-type csout) "wav")))))) (om-print "======================================") (om-print "BEGIN CSOUND SYNTHESIS...") (om-print "======================================") (om-print-format "~%CSD file: ~s~%Output: ~A~%~%" (list (namestring csd) (if RT-OUT "DAC" (namestring outpath)))) (when (and (not RT-OUT) (probe-file outpath)) (om-print (string+ "Deleting existing file: " (namestring outpath))) (om-delete-file outpath)) (om-cmd-line (format nil "~s ~A ~A" (namestring (get-pref-value :externals :csound-path)) (namestring csd) (if RT-OUT "-odac" (format nil "-o ~s" (namestring outpath))) )) (om-print "======================================") (om-print "END CSOUND SYNTHESIS") (om-print "======================================") (when (and (not RT-OUT) (null (probe-file outpath))) (om-message-dialog "!!! Error in CSound synthesis !!!")) (om::maybe-clean-tmp-files) (and outpath (probe-file outpath))) (om-beep-msg "ERROR: CSound exec not found! (check in External preferences)")) ) (defmethod! csound-synth ((orc pathname) (sco pathname) &key out format resolution) :icon 'csound (if (get-pref-value :externals :csound-path) (let* ((RT-OUT (equal out :rt)) (out-format (string-downcase (or format (get-pref-value :audio :format)))) (out-res resolution) ;;; no resolution will keep the output in float format (csout (if RT-OUT nil (handle-new-file-exists (cond ((pathnamep out) out) ((stringp out) (outfile out)) (t (outfile (pathname-name sco))))))) (outpath (unless RT-OUT (handle-new-file-exists (om-make-pathname :directory csout :name (pathname-name csout) :type out-format))))) (om-print "======================================") (om-print "BEGIN CSOUND SYNTHESIS...") (om-print "======================================") (om-print-format "~%Orchestra: ~s~%Score: ~s~%Output: ~A~%~%" (list (namestring orc) (namestring sco) (if RT-OUT "DAC" (namestring csout)))) (when (and (not RT-OUT) (probe-file outpath)) (om-print (string+ "Deleting existing file: " (namestring outpath))) (om-delete-file outpath)) (om-cmd-line (format nil "~s ~A ~A ~A ~s ~s ~A" (namestring (get-pref-value :externals :csound-path)) (get-pref-value :externals :csound-flags) (if format (string+ "--format=" out-format) "") (case out-res (16 "-s") (24 "-3") (32 "-l") (otherwise "")) (namestring orc) (namestring sco) (if RT-OUT "-odac" (format nil "-o ~s" (namestring outpath))) )) (om-print "======================================") (om-print "END CSOUND SYNTHESIS") (om-print "======================================") (when (and (not RT-OUT) (null (probe-file outpath))) (om-message-dialog "!!! Error in CSound synthesis !!!")) (om::maybe-clean-tmp-files) (and outpath (probe-file outpath))) (om-beep-msg "ERROR: CSound exec not found! (check in External preferences)"))) (defmethod! csound-synth ((orc t) (sco t) &key out format resolution) (csound-synth (convert-input-to-csound orc "orc") (convert-input-to-csound sco "sco") :out out :format format :resolution resolution)) (defmethod convert-input-to-csound ((self string) &optional type) (pathname self)) (defmethod convert-input-to-csound ((self pathname) &optional type) self) (defmethod convert-input-to-csound ((self cons) &optional type) (let ((path (tmpfile "temp_csound_file" :type type))) (with-open-file (out path :direction :output :if-does-not-exist :create :if-exists :supersede) (loop for item in self do (write-line item out))) (add-tmp-file path) path)) (defmethod convert-input-to-csound ((self textbuffer) &optional type) (let ((path (tmpfile "temp_csound_file" :type type))) (save-as-text self path) (when (probe-file path) (add-tmp-file path) path))) (defmethod convert-input-to-csound ((self null) &optional type) (error "Empty input for CSOUND-SYNTH"))
7,800
Common Lisp
.lisp
139
44.568345
132
0.513701
cac-t-u-s/csound
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
51139af2b60c15c5b5367f13930cc3c98ca2b23f16b1c07303ccf311f9b3e8f5
26,143
[ -1 ]
26,146
csound.omlib
cac-t-u-s_csound/csound.omlib
;;;=================================================== ;;; csound external ;;; Connection between OM# and Csound ;;; Jean Bresson ;;;=================================================== (:om-lib (:version 1.2) (:source-files (:pathname (:directory (:relative)) (:name "csound-synth")) ) (:symbols (:functions "csound-synth" "csd-synth")) (:author "J. Bresson (2018)") (:doc "Csound synthesis utilities for OM#") )
429
Common Lisp
.l
15
26.533333
61
0.492718
cac-t-u-s/csound
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
4d720a0c1aa225065359dc39cf5d56f622b53f84099cd39ec3cc6ac4c952100b
26,146
[ -1 ]
26,161
world-gen.lisp
mike-1-2-3_EWRP6/world-gen.lisp
#| Copyright (C) 2015 Mike Harris This program 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 3 of the License, or any later version. This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |# (defun check-tiles (x y accepted) (let ((ret nil)) (dolist (tile accepted) (if (equalp tile (tile-id (get-sector x y))) (progn (setf ret t) (return)))) ret)) (defun place-alien (fact species accepted-tiles) (let ((x 0) (y 0)) (loop (setf x (random +map-size+)) (setf y (random +map-size+)) (if (and (check-tiles x y accepted-tiles) (null (settlement (get-sector x y)))) (return))) (let ((capital (make-instance 'aligned-sector :underlying-sector (get-sector x y) :controller-index fact))) (setf (settlement (get-sector x y)) capital) (push-item capital (make-instance 'sentient-population :quantity 100 :species-index species)) (push-item (get-faction fact) capital) (setf (idle-workers capital) 100) (update-populations capital) (setf (monthly-workers capital) 0)))) (defun place-player (x y fact) (let ((capital (make-instance 'aligned-sector :underlying-sector (get-sector x y) :controller-index fact))) (setf (settlement (get-sector x y)) capital) (push-item capital (make-instance 'livestock-population :quantity 10 :species-index +cow+)) (push-item capital (make-instance 'sentient-population :quantity 100 :species-index +human+)) (push-item (get-faction fact) capital) (setf (idle-workers capital) 100) (update-populations capital) (setf (monthly-workers capital) 0) (setf (aref (intel (get-faction fact)) fact) 1) (explore x y))) (defun seed-wildlife () (dotimes (x 50) (push-item (get-sector x 1) (make-instance 'animal-population :quantity 1000 :species-index 0)))) (defun set-ocean (x y) (with-slots (tile-id rainfall salt-water fresh-water cleared arable) (get-sector x y) (incf rainfall 10) (setf tile-id +ocean1+ cleared 0 arable 0 fresh-water 0 salt-water 10000))) (defun set-forest (x y) (with-slots (tile-id rainfall cleared arable fresh-water) (get-sector x y) (incf arable (+ 200 (random 1000))) (incf rainfall 5) (incf fresh-water 3) (setf tile-id +forest1+ cleared (random 20)))) (defun make-ocean () (let ((x (- 110 (random 120))) (y (- 110 (random 120))) (h (random 10)) (newx1 0) (newx2 0)) (dotimes (newy h) (decf newx1 (random 3)) (incf newx2 (random 3)) (dotimes (curx (+ (* -1 newx1) newx2)) (if (and (>= (+ x curx newx1) 0) (<= (+ x curx newx1) 99) (>= (+ newy y) 0) (<= (+ newy y) 99)) (set-ocean (+ x curx newx1) (+ newy y))) +ocean1+)) (incf y h) (dotimes (newy h) (incf newx1 (random 3)) (decf newx2 (random 3)) (dotimes (curx (+ (* -1 newx1) newx2)) (if (and (>= (+ x curx newx1) 0) (<= (+ x curx newx1) 99) (>= (+ newy y) 0) (<= (+ newy y) 99)) (set-ocean (+ x curx newx1) (+ newy y))) +ocean1+)))) ;; (setf (tile-id (get-sector (+ x curx newx1) (+ newy y))) +ocean1+)))))) (defun make-forest () (let ((x (- 110 (random 120))) (y (- 110 (random 120))) (h (random 8)) (newx1 0) (newx2 0)) (dotimes (newy h) (decf newx1 (random 3)) (incf newx2 (random 3)) (dotimes (curx (+ (* -1 newx1) newx2)) (if (and (>= (+ x curx newx1) 0) (<= (+ x curx newx1) 99) (>= (+ newy y) 0) (<= (+ newy y) 99)) (set-forest (+ x curx newx1) (+ newy y))))) (incf y h) (dotimes (newy h) (incf newx1 (random 3)) (decf newx2 (random 3)) (dotimes (curx (+ (* -1 newx1) newx2)) (if (and (>= (+ x curx newx1) 0) (<= (+ x curx newx1) 99) (>= (+ newy y) 0) (<= (+ newy y) 99)) (set-forest (+ x curx newx1) (+ newy y))))) (incf y h) (dotimes (newy h) (decf newx1 (random 3)) (incf newx2 (random 3)) (dotimes (curx (+ (* -1 newx1) newx2)) (if (and (>= (+ x curx newx1) 0) (<= (+ x curx newx1) 99) (>= (+ newy y) 0) (<= (+ newy y) 99)) (set-forest (+ x curx newx1) (+ newy y))))) (incf y h) (dotimes (newy h) (incf newx1 (random 3)) (decf newx2 (random 3)) (dotimes (curx (+ (* -1 newx1) newx2)) (if (and (>= (+ x curx newx1) 0) (<= (+ x curx newx1) 99) (>= (+ newy y) 0) (<= (+ newy y) 99)) (set-forest (+ x curx newx1) (+ newy y))))))) (defun set-hill (x y tile) (with-slots (rainfall avg-summer-temp tile-id fresh-water cleared arable) (get-sector x y) (setf tile-id tile cleared (random 20) arable (random 1000)) (incf rainfall 10) (decf avg-summer-temp 10) (incf fresh-water 10))) (defun set-mountain (x y tile) (with-slots (avg-summer-temp tile-id cleared arable) (get-sector x y) (decf avg-summer-temp 25) (setf tile-id tile cleared (random 10) arable (random 5)))) (defun make-mountain () (let ((x (- 110 (random 120))) (y (- 110 (random 120))) (h (random 20)) (hill (random 2)) (mountain (random 2)) (l 0) (newx1 0) (dir (random 2))) (if (equalp hill 0) (setf hill +hill1+) (setf hill +hill2+)) (if (equalp mountain 0) (setf mountain +mountain2+) (setf mountain +mountain3+)) (dotimes (newy h) (setf l (random 6)) (if (equalp dir 0) (incf newx1 l) (decf newx1 l)) (dotimes (curx l) (if (and (>= (+ x curx newx1) 0) (<= (+ x curx newx1) 99) (>= (+ newy y -1) 0) (<= (+ newy y -1) 99)) (set-hill (+ x curx newx1) (+ newy y -1) hill)) (if (and (>= (+ x curx newx1) 0) (<= (+ x curx newx1) 99) (>= (+ newy y) 0) (<= (+ newy y) 99)) (set-mountain (+ x curx newx1) (+ newy y) mountain)) (if (and (>= (+ x curx newx1) 0) (<= (+ x curx newx1) 99) (>= (+ newy y 1) 0) (<= (+ newy y 1) 99)) (set-mountain (+ x curx newx1) (+ newy y 1) mountain)) (if (and (>= (+ x curx newx1) 0) (<= (+ x curx newx1) 99) (>= (+ newy y 2) 0) (<= (+ newy y 2) 99)) (set-hill (+ x curx newx1) (+ newy y 2) hill)))))) (defun make-desert () (let ((x 0) (w 0) (curw 0) (d (random 7)) (extrusions 10) (h (+ 4 (random 1)))) (dotimes (y h) (dotimes (x +map-size+) (setf (tile-id (get-sector x (- +map-size+ (1+ y)))) +desert2+))) (dotimes (i extrusions) (setf x (- (+ +map-size+ 10) (random (+ 20 +map-size+)))) (setf w (+ 8 (floor (random +map-size+) extrusions))) (setf d (random 5)) (dotimes (depth d) (dotimes (curx w) (if (and (>= (+ curw x curx) 0) (< (+ curw x curx) +map-size+)) (setf (tile-id (get-sector (+ curw x curx) (- +map-size+ (+ 1 depth h)))) +desert2+))) (setf w (+ (floor w 2) (random (1+ (floor w 4))))) (setf curw (- w (floor w 4))))))) (defun set-name (n) (setf (player-name *the-world*) n)) (defun populate-world () (setf *the-world* (make-instance 'world)) (make-raw-mats) (make-plants) (make-animals) (make-factions) (make-afflictions) (make-goods) (dotimes (x +num-biomes+) (dotimes (y +plants-per-biome+) (setf (aref (native-plant-array *the-world*) x y) (generate-random-plant)))) (dotimes (x +map-size+) (dotimes (y +map-size+) (let* ((heat (random 10)) (rain (+ heat 5 (abs (- (round (* 2.6 x)) 130)))) (temp (+ 50 heat (floor y 1.5)))) (setf (aref (world-grid *the-world*) x y) (make-instance 'sector :arable (+ 1000 (random 3000)) :cleared (+ 100 (random 200)) :salt-water 0 :fresh-water (floor (random rain) 2) :tile-id +grassland2+ :rainfall rain :avg-summer-temp temp))))) (dotimes (i 140) (make-forest)) (make-desert) (dotimes (i 20) (make-mountain)) (dotimes (i 20) (make-ocean)) (seed-wildlife) (let ((x 0) (y 0)) (loop (setf x (random +map-size+)) (setf y (random +map-size+)) (if (and (not (equalp (tile-id (get-sector x y)) +mountain2+)) (not (equalp (tile-id (get-sector x y)) +mountain3+)) (not (equalp (tile-id (get-sector x y)) +ocean1+))) (return))) (setf (cursor-x *the-world*) x) (setf (cursor-y *the-world*) y) (place-player x y +earthlings+) (place-alien +gliesens+ +naga+ (list +ocean1+)) (place-alien +nebulites+ +gnogor+ (list +forest1+)) (place-alien +cygnites+ +cyclosiles+ (list +mountain2+ +mountain3+ +hill1+ +hill2+)) (place-alien +errrkruuu+ +hmmgmm+ (list +grassland2+ +hill1+ +hill2+)) (place-alien +trrrmsss+ +hmmgmm+ (list +grassland2+ +hill1+ +hill2+)) (place-alien +ribes+ +torms+ (list +grassland2+ +forest1+ +hill1+ +hill2+)) (let ((intro-str nil)) (push "You wake up in a totally alien environment. Taped to your forehead is a note that reads:" intro-str) (push "\"Dear human - your stupid species wiped itself out with nukes. Our board of conservation has decided to transfer some of you to Endangered Wildlife Reserve Planet 6. If you mess up this planet, or can't get along with the other endangered species, you'll be moved to our museum of taxidermy.\"" intro-str) (push "There are several pallets of supplies and dozens of people around. You decide to go introduce yourself." intro-str) (push "----Tips----" intro-str) (push "-You are in the blue tile. Select it." intro-str) (push "-The escape key backs out of menus." intro-str) (push "-Time will pass whether you are playing the game or not." intro-str) (push "-Have farms and idle workers by April." intro-str) (push (make-instance 'alert :strings intro-str :title "Welcome to EWRP6" :result-func #'set-name :prompts (list (make-instance 'prompt-info :prompt-string "Enter name:" :input-type 'string :trailing-string ""))) (alert-queue *the-world*)))))
10,179
Common Lisp
.lisp
261
34.214559
319
0.605028
mike-1-2-3/EWRP6
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
499d6a97d3a06d58a667c222884fafd7833cd4ce57e1e2dd6984e0efa3780ae0
26,161
[ -1 ]
26,162
generics.lisp
mike-1-2-3_EWRP6/generics.lisp
#| Copyright (C) 2015 Mike Harris This program 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 3 of the License, or any later version. This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |# ;;----------------------- generic function definitions (defgeneric get-name (item)) (defgeneric get-man-hours (employer)) (defgeneric get-population-type (pop)) (defgeneric push-item (place item)) ;; exists so human doesn't get treated as animal first, rewrite later (defgeneric push-sentient (place item)) ;;(defgeneric print-menu (menu items)) (defgeneric draw-menu-items (m-items first-elt selected max)) ;;----------------------- some utility functions ;; compares two dates of format (month, date) (defun date-less (date1 date2) (if (< (first date1) (first date2)) t (if (> (first date1) (first date2)) nil (if (< (second date1) (second date2)) t nil)))) (defun datep (date1 date2) (if (and (equalp (first date1) (first date2)) (equalp (second date1) (second date2))) T)) ;; ---------------- 1 sector is about 3 miles across, so 1 unit -> 1 hr travel (defun get-distance (x1 y1 x2 y2) (round (sqrt (+ (expt (- x2 x1) 2) (expt (- y2 y1) 2))))) ;; ------- just makes sure the coors are in bounds (defun check-coors (x y) (if (and (>= x 0) (< x +map-size+) (>= y 0) (< y +map-size+)) t nil)) ;; --------------------------------- last element replaces removed element (defun vector-remove (i vec) (let ((len (length vec))) (if (equalp len 1) (vector-pop vec) (if (<= i len) (progn (setf (aref vec i) (aref vec (1- len))) (decf (fill-pointer vec) 1)) (error "Vector-remove out of bounds"))))) ;; WARNING - doesn't work on first element. You can't set what points to the first cons from here (defun remove-nth (n list) (let ((cons (nthcdr (1- n) list))) (if cons (setf (cdr cons) (cddr cons)) cons)))
2,372
Common Lisp
.lisp
56
38.821429
97
0.656658
mike-1-2-3/EWRP6
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
cfd36cfdbcde88f8ed512fd751833a254b94fd410fa4714c0d4fa40e561fe480
26,162
[ -1 ]
26,163
scheduling.lisp
mike-1-2-3_EWRP6/scheduling.lisp
#| Copyright (C) 2015 Mike Harris This program 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 3 of the License, or any later version. This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |# ;;--------------------- food stores (defun eat (place) (dolist (group (sentients-list place)) (let ((population (quantity group))) (dotimes (i +total-nutrients+) (decf (aref (food-stores place) i) (* population (aref (nutrition-needs (get-population-type group)) i))))))) (defun check-farms (current-sector) (dolist (farm (farms-list current-sector)) (if (datep (current-date) (dormancy-start-date (get-plant (species-index farm)))) (if (tended farm) (harvest farm current-sector) (setf (tended farm) T))))) (defun harvest (farm current-sector) (with-slots (species-index quantity) farm (dolist (product (get-products species-index)) (when (typep product 'food) (with-slots (yield nutrients) product (dotimes (i +total-nutrients+) (incf (aref (food-stores current-sector) i) (* quantity yield (env-suitability farm) (aref nutrients i))))))))) ;; (message (concatenate 'string "Harvested " yield "pounds of " (name product))) ;; (print (food-stores current-sector))))))) (defun check-malnutrition (place) (setf (afflictions-list place) nil) (dolist (group (sentients-list place)) (let ((population (quantity group))) (dotimes (i (- +total-nutrients+ 2)) (when (< 0 (aref (nutrition-needs (get-population-type group)) i)) (let* ((aff (aref (affliction-array *the-world*) i)) (need (* population (aref (nutrition-needs (get-population-type group)) i))) (supply (aref (food-stores place) i)) (severity (* -1 (floor (/ supply need) (creature-days-per-severity aff)))) (msg-index (- severity (fatality-threshold aff) 3))) (if (> msg-index 3) (progn (setf msg-index 3) (if (< (random 100) (fatality-chance aff)) (let ((d (round (* (/ (fatality-amount aff) 100) population)))) (if (> d 0) (deaths (random d) group place)))))) (if (>= msg-index 0) (push (list i msg-index) (afflictions-list place))))))))) ;;---------------------- labor (defmethod needed-workers ((employer farmed-plant-population)) (with-slots (growth-start-date fruiting-start-date dormancy-start-date harvest-difficulty) (aref (plant-instance-array *the-world*) (species-index employer)) (let ((workers (ceiling (quantity employer) 20))) (cond ((date-less (current-date) growth-start-date) 0) ((date-less (current-date) fruiting-start-date) workers) ((date-less (current-date) dormancy-start-date) (* workers harvest-difficulty)) (t 0))))) (defun assign-workers (current-sector) (with-slots (idle-workers monthly-workers) current-sector (incf idle-workers monthly-workers) (setf monthly-workers 0) (dolist (farm (farms-list current-sector)) (let ((workers (needed-workers farm))) (if (tended farm) (if (> idle-workers workers) (progn (decf idle-workers workers) (incf monthly-workers workers)) (setf (tended farm) nil))))))) (defun reproduce (place) (dolist (group (sentients-list place)) (if (< (length (afflictions-list place)) 3) (let ((increase (random (+ 2 (* (round (/ (reproductive-capacity (get-population-type group)) (* 12 100))) (quantity group)))))) (incf (idle-workers place) increase) (incf (quantity group) increase))))) (defun update-populations (current-sector) (let ((ppl 0)) (dolist (i (sentients-list current-sector)) (incf ppl (quantity i))) (setf (total-workforce current-sector) ppl))) (defun check-jobs (place) (if (job-queue place) (let ((i -1)) (loop (incf i 1) (if (>= i (length (job-queue place))) (return)) (let ((j (aref (job-queue place) i))) (if (equalp (job-id j) +clear-land+) (decf (hours-remaining j) (workers-used j)) (decf (hours-remaining j) 1)) (if (<= (hours-remaining j) 0) (progn (finish-job j place) (vector-remove i (job-queue place))))))))) (defun finish-job (j place) (incf (idle-workers place) (workers-used j)) (cond ((equalp (job-id j) +forage+) (finish-foraging j)) ((equalp (job-id j) +fish+) (finish-fishing j)) ((equalp (job-id j) +make-goods+) (finish-goods j)) ((equalp (job-id j) +hunt+) (finish-hunting j)) ((equalp (job-id j) +explore+) (finish-exploring j)) ((equalp (job-id j) +clear-land+) (progn (message "Land has been cleared") (incf (cleared (origin j)) (yield j)))))) ;;----------------------------------------- alerts (defun check-alerts () (if (and (alert-queue *the-world*) (null (showing-alert? *the-world*)) (not (equalp (type-of (current-game-state *the-world*)) 'input-game-state))) (progn (setf (showing-alert? *the-world*) t) (with-slots (strings prompts result-func title) (first (alert-queue *the-world*)) (draw-info-box strings) (if prompts (set-state-to-input title prompts result-func)))))) (defun next-alert () (pop (alert-queue *the-world*)) (check-alerts)) ;;--------------------------------- task lists (defun hourly-tasks () (dotimes (f-index +total-factions+) (loop for current-sector being the elements of (controlled-sectors (get-faction f-index)) do (check-jobs current-sector) (check-alerts) (sdl:update-display)))) (defun daily-tasks () (dotimes (f-index +total-factions+) (loop for current-sector being the elements of (controlled-sectors (get-faction f-index)) do (assign-workers current-sector) (check-farms current-sector) (eat current-sector) (check-malnutrition current-sector)))) (defun monthly-tasks () (dotimes (f-index +total-factions+) (loop for current-sector being the elements of (controlled-sectors (get-faction f-index)) do (reproduce current-sector) (update-populations current-sector)))) ;;--------------------------------the event queue (defun process-ticks-on-load () (let ((old-time (last-played *the-world*))) (let ((ticks (floor (- (get-universal-time) old-time) *seconds-per-tick* ))) (process-some-ticks ticks) (incf (last-played *the-world*) (* ticks *seconds-per-tick*))))) (defun process-some-ticks (&optional (num +tick-processing-interval+)) (when (mutex *the-world*) (setf (mutex *the-world*) nil) (dotimes (i num) (process-a-tick)) (setf (mutex *the-world*) t))) (defun process-a-tick () (with-slots (hour-num day-num month-num year-num) *the-world* (incf hour-num 1) (hourly-tasks) (when (equalp 25 hour-num) (setf hour-num 1) (incf day-num 1) (daily-tasks) (when (equalp 31 day-num) (setf day-num 1) (incf month-num 1) (monthly-tasks) (message "New month!") (when (equalp 13 month-num) (setf month-num 1) (incf year-num 1))))) (draw-date)) (defun launch-timer () (let ((trigger-time (* *seconds-per-tick* +tick-processing-interval+))) (schedule-timer (make-timer #'process-some-ticks :name "the-tick-timer") trigger-time :repeat-interval trigger-time)))
7,617
Common Lisp
.lisp
190
35.710526
96
0.655593
mike-1-2-3/EWRP6
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
f0b0f5fcdcb0018a0fb801be39cc38edb0e524129a7d27704cadfab041ae5f55
26,163
[ -1 ]
26,164
jobs.lisp
mike-1-2-3_EWRP6/jobs.lisp
#| Copyright (C) 2015 Mike Harris This program 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 3 of the License, or any later version. This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |# ;;----------------------------------------- making goods (defun supplies-available (item quantity) (let ((available t)) (with-slots (mats good-mats tools) item (with-slots (good-stores mat-stores) (selected-town) (with-slots (goods-array mats-array) *the-world* (dolist (m mats) (if (< (aref mat-stores (first m)) (* (second m) quantity)) (progn (setf available nil) (message (concatenate 'string "Needs " (write-to-string ( * (second m) quantity)) " " (name (aref mats-array (first m)))))))) (dolist (tool tools) (if (< (aref good-stores tool) 1) (progn (setf available nil) (message (concatenate 'string "Needs " (name (aref goods-array tool))))))) (dolist (tool good-mats) (if (< (aref good-stores (first tool)) (* quantity (second tool))) (progn (setf available nil) (message (concatenate 'string "Needs " (name (aref goods-array (first tool)))))))) available))))) (defun subtract-supplies (item quantity) (with-slots (mats good-mats tools) item (with-slots (good-stores mat-stores) (selected-town) (with-slots (goods-array) *the-world* (dolist (m mats) (decf (aref mat-stores (first m)) (* (second m) quantity))) (dolist (tool tools) (decf (aref good-stores tool) 1)) (dolist (tool good-mats) (decf (aref good-stores (first tool)) (* (second tool) quantity))))))) (defun add-supplies (item j) (with-slots (mats good-mats tools) item (with-slots (good-stores mat-stores) (origin j) (with-slots (goods-array) *the-world* (dolist (tool tools) (incf (aref good-stores tool) 1)))))) (defun finish-goods (j) (let ((item (aref (goods-array *the-world*) (index j)))) (add-supplies item j) (incf (aref (good-stores (origin j)) (index j)) (yield j)))) (defun order-goods (quantity) (let ((item (aref (goods-array *the-world*) (selected-item (the-menu-state *the-world*))))) (if (supplies-available item quantity) (if (>= (idle-workers (selected-town)) 1) (progn (subtract-supplies item quantity) (message "Making goods") (decf (idle-workers (selected-town)) 1) (vector-push (make-instance 'job :workers-used 1 :yield (* quantity (yield (aref (goods-array *the-world*) (selected-item (the-menu-state *the-world*))))) :origin (selected-town) :index (selected-item (the-menu-state *the-world*)) :hours-remaining (* (hours item) quantity) :job-id +make-goods+) (job-queue (selected-town)))) (message "Not enough people available"))))) ;; ---------------------------------------------- Missions (defun arm-group (job ranged?) (with-slots (good-stores) (origin job) (with-slots (goods-array) *the-world* (let* ((attack 0) (defense 0) (num (workers-used job)) (unarmed num) (unarmored num) (power 0) (wpns (if ranged? +ranged+ +weapons+))) (dolist (w wpns) (if (equalp unarmed 0) (return)) (let ((stock (aref good-stores w))) (if (> stock 0) (progn (if (>= stock unarmed) (setf stock unarmed)) (decf (aref good-stores w) stock) (push (list w stock) (tools job)) (decf unarmed stock) (incf attack (* stock (* (accuracy (aref goods-array w)) (+ (fatality-chance (aref goods-array w)) (damage (aref goods-array w)))))))))) (dolist (w +armor+) (if (equalp unarmored 0) (return)) (let ((stock (aref good-stores w))) (if (> stock 0) (progn (if (>= stock unarmored) (setf stock unarmored)) (decf (aref good-stores w) stock) (push (list w stock) (tools job)) (decf unarmored stock) (incf defense (* stock (- (* (hardness (aref goods-array w)) (coverage (aref goods-array w))) (weight (aref goods-array w))))))))) (setf power (1+ (floor (+ attack defense) (* num 1.2)))) (setf (index job) power))))) (defun return-arms (job) (dolist (tool (tools job)) (incf (aref (good-stores (origin job)) (first tool)) (second tool)))) (defun finish-exploring (j) (let ((luck (random 3)) (dead 0)) (if (> luck 0) (setf dead (round (* (random 20) (/ 10 (index j))))) (setf dead (round (* (random (workers-used j)) (/ 10 (index j)))))) (if (>= dead (workers-used j)) (progn (deaths (workers-used j) (first (sentients-list (origin j))) (origin j)) (message "Explorers have gone missing")) (progn (deaths dead (first (sentients-list (origin j))) (origin j)) (return-arms j) (message (concatenate 'string "Explorers have returned, " (write-to-string dead) " were eaten.")) (explore (first (destination j)) (second (destination j))) (draw-sectors))))) (defun explore (x y) (let ((nx (- x 1)) (ny (- y 1))) (dotimes (cx 3) (dotimes (cy 3) (if (check-coors (+ nx cx) (+ ny cy)) (let ((place (get-sector (+ nx cx) (+ ny cy)))) (if (settlement place) (if (null (aref (intel (get-faction 0)) (controller-index (settlement place)))) (progn (setf (aref (intel (get-faction 0)) (controller-index (settlement place))) 1) (setf (alert-queue *the-world*) (nconc (alert-queue *the-world*) (list (make-instance 'alert :result-func (lambda()) :title "" :prompts (list (make-instance 'prompt-info :prompt-string "" :input-type nil :trailing-string "")) :strings (list (description (get-faction (controller-index (settlement place)))) (description (get-population-type (first (sentients-list (settlement place))))) "Your explorers have encountered strange beings!")))))))) (setf (player-knowledge place) 1)))))) (setf (player-knowledge (get-sector x y)) 2)) (defun send-explorers (workers dest-y dest-x) (if (> workers 0) (if (>= (idle-workers (selected-town)) workers) (if (check-coors dest-x dest-y) (progn (decf (idle-workers (selected-town)) workers) (let ((group (make-instance 'job :workers-used workers :origin (selected-town) :destination (list dest-x dest-y) :hours-remaining (+ 8 (* 2 (get-distance dest-x dest-y (cursor-x *the-world*) (cursor-y *the-world*)))) :job-id +explore+))) (arm-group group nil) (vector-push group (job-queue (selected-town))))) (message "Invalid coordinates")) (message "Not enough workers")))) (defun send-hunters (workers) (if (> workers 0) (if (>= (idle-workers (selected-town)) workers) (progn (decf (idle-workers (selected-town)) workers) (let ((group (make-instance 'job :workers-used workers :origin (selected-town) :hours-remaining 1 :job-id +hunt+))) (arm-group group t) (vector-push group (job-queue (selected-town))))) (message "Not enough workers")))) (defun get-job-tools (type-list job required?) (with-slots (good-stores) (origin job) (with-slots (goods-array) *the-world* (let* ((num (workers-used job)) (unarmed num) (power num)) (dolist (type type-list) (if (equalp unarmed 0) (return)) (let ((stock (aref good-stores type))) (if (> stock 0) (progn (if (>= stock unarmed) (setf stock unarmed)) (decf (aref good-stores type) stock) (push (list type stock) (tools job)) (decf unarmed stock) (incf power (effectiveness (aref goods-array type))))))) (setf (index job) power))))) (defun send-fishers (workers) (if (> workers 0) (if (>= (idle-workers (selected-town)) workers) (if (>= (+ (fresh-water (selected-sector)) (salt-water (selected-sector))) (floor workers 2)) (progn (decf (idle-workers (selected-town)) workers) (let ((group (make-instance 'job :workers-used workers :origin (selected-town) :hours-remaining 8 :job-id +fish+))) (get-job-tools +fishing-tools+ group t) (vector-push group (job-queue (selected-town))))) (message "Not enough fishing ground")) (message "Not enough workers")))) (defun finish-fishing (j) (message "Fishers have brought back their catches") (return-arms j) (add-food (make-instance 'food :nutrients (make-array +total-nutrients+ :initial-contents '(15 5 0 0 100 20 20 200 30 30 6 1))) (random (index j)) (origin j))) (defun finish-hunting (j) (let ((luck (random 3)) (dead 0)) (if (> luck 0) (setf dead (round (* (random 15) (/ 10 (index j))))) (setf dead (round (* (random (workers-used j)) (/ 10 (index j)))))) (if (>= dead (workers-used j)) (progn (deaths (workers-used j) (first (sentients-list (origin j))) (origin j)) (message "Hunters have gone missing")) (progn (deaths dead (first (sentients-list (origin j))) (origin j)) (return-arms j) (add-food (make-instance 'food :nutrients (make-array +total-nutrients+ :initial-contents '(100 80 10 10 500 10 100 50 500 50 2 5))) (round (* (random (workers-used j)) (1+ (/ (index j) 100)))) (origin j)) (incf (aref (mat-stores (origin j)) +skins+) (random (floor (workers-used j) 4))) (message (concatenate 'string "Hunters have returned, " (write-to-string dead) " were eaten.")))))) (defun send-foragers (workers) (if (>= (idle-workers (selected-town)) workers) (progn (decf (idle-workers (selected-town)) workers) (vector-push (make-instance 'job :workers-used workers :hours-remaining 8 :job-id +forage+) (job-queue (selected-town))) (message "Foragers dispatched!")) (message "Not enough people available"))) (defun deaths (num population place) (when (> num 0) (if (equalp num 1) (message "Someone has died.") (message (concatenate 'string (write-to-string num) " people have died."))) (decf (quantity population) num) (update-populations place) (decf (idle-workers place) num))) ;;--------------------------------- Designations (defun clear-acres (acres workers) (if (>= (arable (selected-sector)) acres) (if (>= (idle-workers (selected-town)) workers) (progn (decf (arable (selected-sector)) acres) (decf (idle-workers (selected-town)) workers) (vector-push (make-instance 'job :workers-used workers :yield acres :origin (selected-sector) :hours-remaining (* acres 50) :job-id +clear-land+) (job-queue (selected-town)))) (message "Not enough people available")) (message "There aren't that many acres of useable land"))) (defun remove-farm (index) (if (>= index 0) (progn (incf (cleared (selected-sector)) (quantity (nth index (get-farms)))) (if (zerop index) (if (cdr (get-farms)) (setf (farms-list (settlement (selected-sector))) (cdr (get-farms))) (setf (farms-list (settlement (selected-sector))) nil))) (remove-nth (+ index 1) (cons nil (get-farms)))))) (defun calc-plant-suitability (plant place) (if (typep plant 'native-plant) 1.2 (progn (+ (/ 5 (+ 8 (abs (- (rainfall-desired plant) (rainfall place))))) (/ 5 (+ 8 (abs (- (temp-desired plant) (avg-summer-temp place))))))))) (defun add-farm (amount) (let* ((type (selected-item (the-menu-state *the-world*))) (plant (aref (plant-instance-array *the-world*) type)) (place (settlement (selected-sector))) (in-time nil) (suitability nil)) (if (< (cleared (selected-sector)) amount) (message "Not enough room!") (if (> amount 0) (progn (setf suitability (calc-plant-suitability plant (selected-sector))) (if (or (date-less (current-date) (growth-start-date (get-plant type))) (date-less (dormancy-start-date (get-plant type)) (current-date))) (setf in-time T)) (push-item place (make-instance 'farmed-plant-population :quantity amount :tended in-time :env-suitability suitability :species-index type)) (decf (cleared (selected-sector)) amount) (message "Land allocated!")))))) ;;------------------------ discovering plants (defun add-food (food amount place) (with-slots (nutrients) food (dotimes (i +total-nutrients+) (incf (aref (food-stores place) i) (* amount (aref nutrients i)))))) (defun finish-foraging (j) (let* ((success nil)) (loop (let* ((x (random +num-biomes+)) (y (random +plants-per-biome+)) (plant (aref (native-plant-array *the-world*) x y))) (if (known-to-player plant) (if (null (poison? 0 x y)) (progn (add-food (first (product-list plant)) (random (workers-used j)) (origin j)) (message (concatenate 'string "Some foragers have returned with " (name plant))) (setf success t) (return))) (return)))) (if (null success) (let ((coors (next-new-plant))) (if coors (let ((x (first coors)) (y (second coors))) (setf (known-to-player (aref (native-plant-array *the-world*) x y)) t) (setf (alert-queue *the-world*) (nconc (alert-queue *the-world*) (list (make-instance 'alert :result-func #'name-plant :title "New Plant" :prompts (list (make-instance 'prompt-info :prompt-string "Enter name:" :input-type 'string :trailing-string " ")) :strings (list "What would you like to name this plant?" (if (poison? 0 x y) (progn (deaths 1 (first (sentients-list (origin j))) (origin j)) "She died a very painful death.") "And she seems to be fine!") "A brave volunteer put one in her mouth and chewed." (concatenate 'string "They show you a pile of " (description (first (product-list (aref (native-plant-array *the-world*) x y)))) " that they got from " (first (description (aref (native-plant-array *the-world*) x y))) (second (description (aref (native-plant-array *the-world*) x y)))) "Your foragers have found something that might be food."))) )))))))) (defun next-new-plant () (let ((coors nil)) (dotimes (x +num-biomes+) (if coors (return)) (dotimes (y +plants-per-biome+) (if (null (known-to-player (aref (native-plant-array *the-world*) x y))) (progn (setf coors (list x y)) (return))))) coors)) (defun next-unnamed-plant () (let ((coors nil)) (dotimes (x +num-biomes+) (if coors (return)) (dotimes (y +plants-per-biome+) (if (null (name (aref (native-plant-array *the-world*) x y))) (progn (setf coors (list x y)) (return))))) coors)) (defun name-plant (name) (let* ((coors (next-unnamed-plant)) (x (first coors)) (y (second coors))) (setf (name (aref (native-plant-array *the-world*) x y)) name) (if (null (poison? 0 x y)) (vector-push (aref (native-plant-array *the-world*) x y) (plant-instance-array *the-world*))) (draw-sectors))) (defun poison? (sentient-index biome-index p-index) (let ((ret nil)) (dolist (chem (poisonous-chemicals (aref (sentient-array *the-world*) sentient-index))) (if (> (aref (chemicals (first (product-list (aref (native-plant-array *the-world*) biome-index p-index)))) chem) 0) (setf ret t))) ret))
15,857
Common Lisp
.lisp
423
32.144208
93
0.620947
mike-1-2-3/EWRP6
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
fed10eec3c33c07ce59013d226c0ca6b1fe7d4aa12e7f12b060f87701d4ec460
26,164
[ -1 ]
26,165
index-constants.lisp
mike-1-2-3_EWRP6/index-constants.lisp
#| Copyright (C) 2015 Mike Harris This program 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 3 of the License, or any later version. This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |# (defconstant +tick-processing-interval+ 1) (defconstant +map-size+ 100) (defconstant +default-screen-width+ 640) (defconstant +default-screen-height+ 480) (defconstant +tile-size+ 50) (defconstant +menu-width+ 210) (defconstant +line-spacing+ 2) (defmacro def-constants (&body body) (let ((total (1- (length body))) (total-name (pop body)) (derp nil) (subderp nil)) (dotimes (i (length body)) (push i subderp) (push (pop body) subderp) (push 'defconstant subderp) (push subderp derp) (setf subderp nil)) (push total subderp) (push total-name subderp) (push 'defconstant subderp) (push subderp derp) (push 'progn derp) derp)) ;;--------- (def-constants +total-goods+ +shoddy-spear+ +simple-bow+ +shoddy-shield+ +stone-axe+ +stone-knife+ +bone-needles+ +stone-pot+ +stone-hoe+ +basic-plow+ +loom+ +thread+ +net+ +shoddy-textiles+ +leather+ +leather-scales+ +lamellar+) (def-constants +total-materials+ +fibers+ +skins+) ;;------- (def-constants +job-types+ +clear-land+ +make-goods+ +explore+ +forage+ +fish+ +hunt+) ;;--- tiles (def-constants +total-graphics+ ;; +grassland1+ +grassland2+ ;; +grassland3+ ;; +grassland4+ ;; +desert1+ +desert2+ +ocean1+ ;; +ocean2+ +hill1+ +hill2+ +mountain2+ +mountain3+ +forest1+) ;; +woodland1+) ;;--- sentients (def-constants +total-types-of-sentients+ +human+ +naga+ +gnogor+ +cyclosiles+ +hmmgmm+ +torms+) ;;--- factions (def-constants +total-factions+ +earthlings+ +gliesens+ +nebulites+ +cygnites+ +errrkruuu+ +trrrmsss+ +ribes+) ;;--- animals (def-constants +total-types-of-animals+ +rabbit+ +cow+) ;;--- plants (def-constants +total-types-of-plants+ +blueberry-bush+ +brown-rice+ +carrots+ +corn+ +red-currant-bush+ +cranberries+ +kiwi+ +navy-beans+ +peanuts+ +potato+ +sesame+ +soybeans+ +spinach+ +wheat+) ;;--- chemicals array (def-constants +total-chemicals+ +ammonia+ +arsenic+ +sulfides+ +heteropoly-m+ +heteropoly-t+ +heteropoly-v+ +methane+ +silicones+) ;;--- nutrition array (def-constants +total-nutrients+ +protein+ +fat+ +carbs+ +vitamin-a+ +vitamin-b+ +vitamin-c+ +calcium+ +iodine+ +iron+ +zinc+ +bonus+ +taste+) (defconstant +total-afflictions+ (+ +total-nutrients+ 0)) (defconstant +num-biomes+ (floor +map-size+ 10)) (defconstant +plants-per-biome+ 5) (defconstant +random-plants+ (* +num-biomes+ +plants-per-biome+)) ;;------- Type lists - ordered from best to worst (defconstant +weapons+ (list +stone-axe+ +simple-bow+ +shoddy-spear+ +stone-knife+)) (defconstant +ranged+ (list +simple-bow+ +shoddy-spear+)) (defconstant +armor+ (list +lamellar+ +shoddy-shield+)) (defconstant +fishing-tools+ (list +net+)) ;;-------
4,056
Common Lisp
.lisp
153
20.248366
84
0.589525
mike-1-2-3/EWRP6
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
891bf8938f099e1bfc337c068eb98d6eff1a706294f52cbfac3ed6b64d984276
26,165
[ -1 ]
26,166
startup.lisp
mike-1-2-3_EWRP6/startup.lisp
#| Copyright (C) 2015 Mike Harris This program 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 3 of the License, or any later version. This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |# ;; Version 0.5 - Demo (ql:quickload "lispbuilder-sdl") (ql:quickload "lispbuilder-sdl-image") (ql:quickload "cl-store") (defun setup-world () (if (equalp nil (probe-file *save-directory*)) (progn (draw-loading-item "Generating world..." 10 30) (populate-world)) (progn (setf *the-world* (cl-store:restore *save-directory*)) (message "Welcome back!")))) ;;-------------------------------- some game functions (defun cleanup () (unschedule-timer (car (list-all-timers)))) (defun save () (message "Saving...") (setf (last-played *the-world*) (get-universal-time) (the-menu-state *the-world*) nil (the-sector-state *the-world*) nil (the-input-state *the-world*) nil (current-game-state *the-world*) nil) (cl-store::store *the-world* *save-directory*) (gc) #-allegro (quit) #+allegro (exit)) (defun load-all () (load "index-constants.lisp") (load "interfaces/sdl-interface.lisp") (load "generics.lisp" :verbose nil) ;; load various classes (load "interfaces/menu.lisp") (load "data/plants.lisp" :verbose nil) (load "data/animals.lisp" :verbose nil) (load "data/sentients.lisp" :verbose nil) (load "data/populations.lisp" :verbose nil) (load "data/affliction.lisp") (load "data/world.lisp" :verbose nil) (load "data/goods.lisp") ;; load the rest of the code (load "jobs.lisp" :verbose nil) (load "scheduling.lisp" :verbose nil) (load "data/plants-instances.lisp") (load "data/animal-instances.lisp") (load "data/faction-instances.lisp") (load "data/affliction-instances.lisp") (load "data/random-plants.lisp") (load "data/goods-instances.lisp") (load "data/raw-mats-instances.lisp") (load "world-gen.lisp") (load "interfaces/menu-instances.lisp") (load "interfaces/states.lisp")) (defun make-bin () (load-all) (save-lisp-and-die "EWRP6" :toplevel #'start-game :executable t)) (defun read-config () (let ((config (open "config.txt"))) (defparameter *seconds-per-tick* (parse-integer (read-line config))) (defparameter *fog-of-war* (parse-integer (read-line config))) (defparameter *save-directory* (read-line config)) (close config))) (defun start-game () (cffi:define-foreign-library sdl (:darwin (:or (:framework "SDL") (:default "libSDL"))) (:windows "SDL.dll") (:unix (:or "libSDL-1.2.so.0.7.2" "libSDL-1.2.so.0" "libSDL-1.2.so" "libSDL.so" "libSDL"))) (read-config) (defparameter *the-world* nil) (defparameter *title-font* (sdl:initialise-font sdl:*font-10x20*)) (defparameter *font* (sdl:initialise-font sdl:*font-9x18B*)) (defparameter *char-height* (sdl:char-height *font*)) (defparameter *char-width* (sdl:char-width *font*)) (defparameter *screenw* +default-screen-width+) (defparameter *screenh* +default-screen-height+) (setf *random-state* (make-random-state t)) ;; start the display (sdl:init-image :png) (sdl:with-init () (sdl:window *screenw* *screenh* :title-caption "Endangered Wildlife Reserve Planet 6") (sdl:enable-unicode) (setf (sdl:frame-rate) 15) (draw-borders) (draw-loading-item "Loading game..." 10 10) ;;start game backend (setup-world) (draw-date) (setf (the-menu-state *the-world*) (make-instance 'menu-game-state) (the-sector-state *the-world*) (make-instance 'sector-selection-state) (the-input-state *the-world*) (make-instance 'input-game-state) (current-game-state *the-world*) (the-sector-state *the-world*)) (teleport (cursor-y *the-world*) (cursor-x *the-world*)) (setf (root-menu (the-menu-state *the-world*)) (make-main-menu)) (setf (current-menu (the-menu-state *the-world*)) (root-menu (the-menu-state *the-world*))) (load-graphics (the-sector-state *the-world*)) (draw (the-sector-state *the-world*)) (draw-sector-border) (check-alerts) (sdl:update-display) (process-ticks-on-load) (setf (mutex *the-world*) t) (launch-timer) ;; game loop (with-slots (current-game-state) *the-world* (sdl:with-events (:wait) (:quit-event () t) (:video-expose-event () (sdl:update-display)) (:key-down-event (:key key :unicode unicode) (when (mutex *the-world*) (setf (mutex *the-world*) nil) (process-key-event current-game-state key unicode) (draw current-game-state) (sdl:update-display) (setf (mutex *the-world*) t)))))))
5,080
Common Lisp
.lisp
130
34.976923
95
0.682235
mike-1-2-3/EWRP6
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
555c2f432b4f5752a2d007bd285af6e2d79b514ca8103a85d5ef70e7e962eb0c
26,166
[ -1 ]
26,167
populations.lisp
mike-1-2-3_EWRP6/data/populations.lisp
#| Copyright (C) 2015 Mike Harris This program 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 3 of the License, or any later version. This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |# (defclass population () ;; quantity given in percent for innumerable critters ((quantity :initarg :quantity :accessor quantity :initform (error "no quantity")) (species-index :initarg :species-index :accessor species-index :initform (error "no species")))) ;;----------------------------- Plants! (defclass plant-population (population) ;; a multiplier greater than zero, and usually below 1.5 ((env-suitability :initarg :env-suitability :accessor env-suitability))) (defclass farmed-plant-population (plant-population) ((tended :initarg :tended :accessor tended :initform T) (age :initarg :age :accessor age :initform 0))) ;;----------------------- people! (defclass sentient-population (population) ((growth-rate :initarg :growth-rate :accessor growth-rate :initform 1))) ;;----------------------- animals! (defclass animal-population (population) ()) (defclass livestock-population (population) ())
1,611
Common Lisp
.lisp
30
50.066667
99
0.719668
mike-1-2-3/EWRP6
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
a096e9a0ea08617b9ea30370d253e763c945c656a7a086fb4d6ad96a63549162
26,167
[ -1 ]
26,168
random-plants.lisp
mike-1-2-3_EWRP6/data/random-plants.lisp
#| Copyright (C) 2015 Mike Harris This program 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 3 of the License, or any later version. This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |# (defun generate-random-plant () (let ((part1 (random 12)) (part2 (random 12)) (part3 (random 12)) (new-plant (make-instance 'native-plant :name nil :description nil :growth-start-date (list 4 1) :fruiting-start-date (list 6 20) :dormancy-start-date (list 9 1) :rainfall-desired 30 :harvest-difficulty 6 :product-list (list (make-instance 'native-food :name nil :yield 500))))) (with-slots (name description product-list) new-plant (with-slots (nutrients chemicals) (first product-list) ;;---------------------------------------------------------- stump string (cond ((equalp part1 0) (progn (push " a thin, branching, crusty and yellow trunk." description) (setf (aref nutrients +iodine+) 200) (setf (aref chemicals +silicones+) 200))) ((equalp part1 1) (progn (push " a brown, coral like, base." description) (setf (aref nutrients +calcium+) 200) (setf (aref chemicals +methane+) 200))) ((equalp part1 2) (progn (push " a spherical, juicy, orange thing." description) (setf (aref nutrients +iron+) 300) (setf (aref chemicals +methane+) 200))) ((equalp part1 3) (progn (push " a helical, flowering, vine." description) (setf (aref chemicals +heteropoly-m+) 300) (setf (aref chemicals +heteropoly-t+) 300))) ((equalp part1 4) (progn (push " a crystalline stalk." description) (setf (aref nutrients +calcium+) 50) (setf (aref chemicals +heteropoly-v+) 300))) ((equalp part1 5) (progn (push " a fleshy mound that smells like ammonia." description) (setf (aref chemicals +ammonia+) 400) (setf (aref chemicals +arsenic+) 400))) ((equalp part1 6) (progn (push " a gnarled mass, with symbiotic guardian insects." description) (setf (aref nutrients +vitamin-a+) 200) (setf (aref nutrients +iron+) 100) (setf (aref nutrients +zinc+) 100) (setf (aref nutrients +bonus+) 3) (setf (aref nutrients +taste+) 2))) ((equalp part1 7) (progn (push " a scintillating, fractal, trunk." description) (setf (aref nutrients +vitamin-b+) 1000) (setf (aref chemicals +arsenic+) 1000))) ((equalp part1 8) (progn (push " a cluster of smelly, yellow, partially transparent vesicles." description) (setf (aref nutrients +fat+) 100) (setf (aref chemicals +sulfides+) 400))) ((equalp part1 9) (progn (push " a dense, blue, shrub." description) (setf (aref nutrients +taste+) 5) (setf (aref nutrients +bonus+) 5) (setf (aref nutrients +protein+) 100) (setf (aref nutrients +iodine+) 100) (setf (aref nutrients +vitamin-b+) 100))) ((equalp part1 10) (progn (push " a rocky, honeycombed, mound." description) (setf (aref nutrients +calcium+) 1000) (setf (aref nutrients +fat+) 50))) ((equalp part1 11) (progn (push " a giant, partially submerged, moss ball." description) (setf (aref nutrients +vitamin-b+) 500) (setf (aref chemicals +vitamin-c+) 500)))) ;;---------------------------------------------- branch string (cond ((equalp part2 0) (progn (push "something with floating, red, sacks anchored to" description) (incf (aref chemicals +heteropoly-t+) 150) (incf (aref chemicals +methane+) 150))) ((equalp part2 1) (progn (push "a veiny web of tendrils boring into" description) (incf (aref nutrients +protein+) 50) (incf (aref nutrients +iron+) 200))) ((equalp part2 2) (progn (push "a thing with huge, stacking, blue, disks rising from" description) (incf (aref nutrients +carbs+) 100) (incf (aref nutrients +bonus+) 8))) ((equalp part2 3) (progn (push "a sheet of enveloping, red, mucus emanating from" description) (incf (aref chemicals +arsenic+) 200) (incf (aref chemicals +sulfides+) 200))) ((equalp part2 4) (progn (push "this thing that had tons of spikes coming out of" description) (incf (aref nutrients +zinc+) 200) (incf (aref nutrients +vitamin-a+) 200))) ((equalp part2 5) (progn (push "a mind boggling blue filigree of symmetrical branches from" description) (incf (aref nutrients +calcium+) 250) (incf (aref chemicals +silicones+) 250))) ((equalp part2 6) (progn (push "pastel colored flowers on" description) (incf (aref nutrients +vitamin-a+) 100) (incf (aref nutrients +vitamin-c+) 100))) ((equalp part2 7) (progn (push "thick, greasy, tubers descending from" description) (incf (aref nutrients +fat+) 100) (incf (aref chemicals +carbs+) 100))) ((equalp part2 8) (progn (push "putrid threads hanging off" description) (incf (aref chemicals +ammonia+) 200) (incf (aref chemicals +heteropoly-v+) 200))) ((equalp part2 9) (progn (push "spindly, jointed, branches protruding from" description) (incf (aref nutrients +protein+) 100))) ((equalp part2 10) (progn (push "something like a bromeliad, but jagged, serrated, and rotating around" description) (incf (aref nutrients +carbs+) 400) (incf (aref nutrients +protein+) 200))) ((equalp part2 11) (progn (push "bulbous green pads attached to" description) (incf (aref chemicals +heteropoly-m+) 200) (incf (aref chemicals +sulfides+) 100)))) ;; ------------------------------- fruit descriptions (cond ((equalp part3 0) (progn (setf (description (first product-list)) "leathery star shaped flesh") (incf (aref nutrients +carbs+) 100) (incf (aref chemicals +silicones+) 100) (incf (aref nutrients +vitamin-b+) 100))) ((equalp part3 1) (progn (setf (description (first product-list)) "glowing fruit") (incf (aref chemicals +sulfides+) 300) (incf (aref chemicals +heteropoly-v+) 200))) ((equalp part3 2) (progn (setf (description (first product-list)) "golden, gritty, berries") (incf (aref nutrients +vitamin-c+) 800) (incf (aref chemicals +silicones+) 100))) ((equalp part3 3) (progn (setf (description (first product-list)) "fibrous shoots" ) (incf (aref nutrients +bonus+) 5) (incf (aref nutrients +zinc+) 500))) ((equalp part3 4) (progn (setf (description (first product-list)) "things that look just like a human kidney" ) (incf (aref nutrients +protein+) 100) (incf (aref nutrients +iron+) 300))) ((equalp part3 5) (progn (setf (description (first product-list)) "spongy nodules embedded in white amber") (incf (aref nutrients +protein+) 50) (incf (aref chemicals +methane+) 100) (incf (aref nutrients +calcium+) 600))) ((equalp part3 6) (progn (setf (description (first product-list)) "glazed, blue, pads") (incf (aref nutrients +vitamin-a+) 300) (incf (aref nutrients +taste+) 5))) ((equalp part3 7) (progn (setf (description (first product-list)) "black pellets covered in white powder") (incf (aref nutrients +zinc+) 200) (incf (aref chemicals +arsenic+) 200))) ((equalp part3 8) (progn (setf (description (first product-list)) "barbed melons" ) (incf (aref nutrients +carbs+) 600) (incf (aref nutrients +bonus+) 3))) ((equalp part3 9) (progn (setf (description (first product-list)) "hairy buds" ) (incf (aref nutrients +taste+) 6) (incf (aref nutrients +bonus+) 6))) ((equalp part3 10) (progn (setf (description (first product-list)) "gilled cones" ) (incf (aref nutrients +fat+) 100) (incf (aref nutrients +vitamin-b+) 400))) ((equalp part3 11) (progn (setf (description (first product-list)) "green fruit with woody, white, ribs") (incf (aref nutrients +fat+) 50) (incf (aref nutrients +iodine+) 800)))) ;;---------- add a random nutrient (let ((r (random 3)) (i (random 8))) (if (equalp r 0) (incf (aref nutrients i) 100) (if (equalp r 1) (incf (aref chemicals i) 100)))) new-plant))))
8,920
Common Lisp
.lisp
187
40.513369
98
0.625889
mike-1-2-3/EWRP6
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
9b2c40a87a1048feb805a69e42f191d894bd48c91deb65f932b7f42a5cfda2fd
26,168
[ -1 ]
26,169
raw-mats-instances.lisp
mike-1-2-3_EWRP6/data/raw-mats-instances.lisp
#| Copyright (C) 2015 Mike Harris This program 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 3 of the License, or any later version. This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |# (defun make-raw-mats () (let ((mats (mats-array *the-world*))) (setf (aref mats +fibers+) (make-instance 'product :name "Fibers" :yield 5)) (setf (aref mats +skins+) (make-instance 'product :name "Skins" :yield 1))))
908
Common Lisp
.lisp
17
48.823529
81
0.725424
mike-1-2-3/EWRP6
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
4d4b964cffb4cdffa6d27f48a98802783a0ec3a6fd3e812fe8968b903b6bf6b1
26,169
[ -1 ]
26,170
animal-instances.lisp
mike-1-2-3_EWRP6/data/animal-instances.lisp
#| Copyright (C) 2015 Mike Harris This program 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 3 of the License, or any later version. This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |# (defun make-animals () (push-item +rabbit+ (make-instance 'animal :name "rabbit" :age-of-maturity 3 :age-of-senility 160 :avg-lifespan 168 :reproductive-capacity 50 :strength 2 :agility 5 :aggressiveness 1)) (push-item +cow+ (make-instance 'domestic-animal :name "cow" :age-of-maturity 32 :age-of-senility 72 :avg-lifespan 180 :reproductive-capacity 10 :strength 30 :agility 3 :aggressiveness 3 :forage-required 1)) (push-sentient +human+ (make-instance 'sentient-animal :name "human" :age-of-maturity 168 :age-of-senility 816 :avg-lifespan 600 :reproductive-capacity 15 :strength 30 :agility 40 :aggressiveness 40 :emotional-intelligence 15 :analytical-intelligence 75 :poisonous-chemicals (list +ammonia+ +arsenic+ +sulfides+ +heteropoly-m+ +heteropoly-v+) :nutrition-needs (make-array +total-nutrients+ :initial-contents '(50 65 300 100 100 100 100 100 100 100 5 5)))) (push-sentient +naga+ (make-instance 'sentient-animal :name "Naga" :description "They are serpentine creatures with thin, webbed, arms ending in three long fingers. Their eyes and mouths are narrow slits, and they have no neck or chin." :reproductive-capacity 2 :strength 20 :agility 50 :aggressiveness 1 :emotional-intelligence 100 :analytical-intelligence 75 :poisonous-chemicals (list +arsenic+ +sulfides+ +heteropoly-m+ +heteropoly-v+) :nutrition-needs (make-array +total-nutrients+ :initial-contents '(50 50 200 100 100 100 100 100 100 100 5 5)))) (push-sentient +gnogor+ (make-instance 'sentient-animal :name "Gnogor" :description "They are covered in loose, yellow, robes. Only large, hooved, feet are visible. They seem to have large, double jointed, legs, and switch between standing erect and walking on all fives." :reproductive-capacity 2 :strength 20 :agility 50 :aggressiveness 1 :emotional-intelligence 100 :analytical-intelligence 75 :chemical-needs (make-array +total-chemicals+ :initial-contents '(100 0 100 100 100 100 10 10)) :poisonous-nutrients (list +iron+ +zinc+ +calcium+))) (push-sentient +cyclosiles+ (make-instance 'sentient-animal :name "Cyclociles" :description "They look like spiders made of white crystals with yellow veins." :reproductive-capacity 10 :strength 50 :agility 20 :aggressiveness 50 :emotional-intelligence 60 :analytical-intelligence 200 :chemical-needs (make-array +total-chemicals+ :initial-contents '(50 100 200 0 50 0 100 500)) :poisonous-nutrients (list +iodine+ +fat+ +vitamin-a+) :nutrition-needs (make-array +total-nutrients+ :initial-contents '(0 0 100 0 0 80 200 0 100 0 0 0)))) (push-sentient +hmmgmm+ (make-instance 'sentient-animal :name "Hmmgmm" :description "They look like bloated, orange, bats and communicate with a humming noises." :reproductive-capacity 15 :strength 50 :agility 50 :aggressiveness 100 :emotional-intelligence 10 :analytical-intelligence 100 :chemical-needs (make-array +total-chemicals+ :initial-contents '(100 0 100 0 0 0 700 0)) :poisonous-nutrients (list +iodine+ +fat+ +vitamin-a+) :nutrition-needs (make-array +total-nutrients+ :initial-contents '(80 100 0 100 100 0 0 0 0 0 0 0)))) (push-sentient +torms+ (make-instance 'sentient-animal :name "Torms" :description "They are short, lumpy, reddish bipeds with long heads." :reproductive-capacity 15 :strength 70 :agility 120 :aggressiveness 100 :emotional-intelligence 10 :analytical-intelligence 80 :poisonous-nutrients (list +iodine+) :nutrition-needs (make-array +total-nutrients+ :initial-contents '(500 100 0 40 90 40 100 0 200 40 0 0)))))
4,458
Common Lisp
.lisp
79
50.708861
205
0.72133
mike-1-2-3/EWRP6
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
0c2af5b3bed3323108b6c5e511dc53827158b2519e394a5f52cea11189866d94
26,170
[ -1 ]
26,171
sentients.lisp
mike-1-2-3_EWRP6/data/sentients.lisp
#| Copyright (C) 2015 Mike Harris This program 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 3 of the License, or any later version. This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |# (defclass sentient () ((description :initarg :description :accessor description :initform nil) (emotional-intelligence :initarg :emotional-intelligence :accessor emotional-intelligence) ;;0-100 (analytical-intelligence :initarg :analytical-intelligence :accessor analytical-intelligence))) ;;0-100 (defclass sentient-animal (sentient animal) ((poisonous-chemicals :initarg :poisonous-chemicals :accessor poisonous-chemicals :initform nil) (poisonous-nutrients :initarg :poisonous-nutrients :accessor poisonous-nutrients :initform nil) (chemical-needs :initarg :chemical-needs :accessor chemical-needs :initform (make-array +total-chemicals+ :initial-element 0)) (nutrition-needs :initarg :nutrition-needs :accessor nutrition-needs :initform (make-array +total-nutrients+ :initial-element 0)))) (defclass sentient-plant (sentient plant) ()) (defclass faction () ((description :initarg :description :accessor description :initform nil) (intel :initarg :intel :accessor intel :initform (make-array +total-factions+ :initial-element nil)) (name :initarg :name :accessor name) (color1 :initarg :color1 :accessor color1) (color2 :initarg :color2 :accessor color2) (controlled-sectors :initarg :controlled-sectors :accessor controlled-sectors :initform nil) (bellicose :initarg :bellicose :accessor bellicose))) ;; 0 to 10
2,060
Common Lisp
.lisp
35
54.6
103
0.763627
mike-1-2-3/EWRP6
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
8691b8802035a9c5ec5e500abbae2af8e305a7211f0785d59730dcd28a6b4624
26,171
[ -1 ]
26,172
affliction-instances.lisp
mike-1-2-3_EWRP6/data/affliction-instances.lisp
#| Copyright (C) 2015 Mike Harris This program 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 3 of the License, or any later version. This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |# (defun make-afflictions () (push-item +protein+ (make-instance 'malnurishment :fatality-threshold 3 :fatality-chance 100 :fatality-amount 10 :creature-days-per-severity 15 :descriptions (make-array 4 :initial-contents '("Workers seem to be tiring more easily than usual. A few people have complained of head aches." "Everyone's hair looks bad for some reason. Like it's thinning. Several mothers are concerned about their children's swollen feet." "Everyone's muscles are melting away, most of the children have bloated stomachs. Their eyes are cast down in misery, and their parents blame you." "The area smells of rot from the dead. Those with strength remaining are preparing to leave, looking for greener pastures.")))) (push-item +fat+ (make-instance 'malnurishment :fatality-threshold 3 :fatality-chance 80 :fatality-amount 5 :creature-days-per-severity 40 :descriptions (make-array 4 :initial-contents '("Everyone misses chocolate." "Everyone's craving food from the old world." "People feel generally bad. Achy joints, dry hair and rashes, and feeling brain dead all the time." "\"I'd kill for a milkshake\" a man laying on the ground says. Everyone's skin is cracked despite drinking constantly, and people feel like they're dying.")))) (push-item +carbs+ (make-instance 'malnurishment :fatality-threshold 10 :fatality-chance 20 :fatality-amount 3 :creature-days-per-severity 40 :descriptions (make-array 4 :initial-contents '("You miss eating bread." "You miss eating oatmeal." "Everyone seems sluggish." "The torpor is overwhelming.")))) (push-item +vitamin-a+ (make-instance 'malnurishment :fatality-threshold 4 :fatality-chance 50 :fatality-amount 4 :creature-days-per-severity 15 :descriptions (make-array 4 :initial-contents '("Someone went out into the wilds last night and hasn't come back yet." "The nights seem black and enveloping." "There is obviously something wrong with people's vision." "A child went blind.")))) (push-item +vitamin-b+ (make-instance 'malnurishment :fatality-threshold 3 :fatality-chance 60 :fatality-amount 8 :creature-days-per-severity 20 :descriptions (make-array 4 :initial-contents '("This guy, George, won't shut up about how much he misses turkey." "Your tongue hurts and you keep forgetting what your doing." "Several people have mentioned that their hearts beat fast all the time, your tongue hurts badly and started swelling up, and your stomach has hurt for a week." "That George guy lost his marbles. Walked right into a river. Another guy died in his sleep.")))) (push-item +vitamin-c+ (make-instance 'malnurishment :fatality-threshold 3 :fatality-chance 90 :fatality-amount 50 :creature-days-per-severity 30 :descriptions (make-array 4 :initial-contents '("Workers seem a bit lethargic." "Several people have spots on their legs. Huh, you have them, too." "People are very concerned about their bleeding gums." "People are absolutely distraught about their teeth falling out.")))) (push-item +calcium+ (make-instance 'malnurishment :fatality-threshold 4 :fatality-chance 70 :fatality-amount 5 :creature-days-per-severity 40 :descriptions (make-array 4 :initial-contents '("Your lips are tingling." "Everyone seems twitchy, like their muscles just don't want to work." "Several people say they can't feel their hands or feet." "Someone started convulsing and died.")))) (push-item +iodine+ (make-instance 'malnurishment :fatality-threshold 5 :fatality-chance 70 :fatality-amount 2 :creature-days-per-severity 80 :descriptions (make-array 4 :initial-contents '("Ew. That dude's got a goiter." "Kids seem to be getting dumber." "There are several people with goiters." "Some of the kids are stupid. Like, REALLY stupid. One has gotten his head stuck in the same tree four times now.")))) (push-item +iron+ (make-instance 'malnurishment :fatality-threshold 5 :fatality-chance 30 :fatality-amount 2 :creature-days-per-severity 80 :descriptions (make-array 4 :initial-contents '("Erica says she misses eating liver. Disgusting." "Peterson, the farmer, has problems blacking out when he works too hard." "Dizzy spells are frequent." "Dizzyness and fatigue have become facts of life.")))) (push-item +zinc+ (make-instance 'malnurishment :fatality-threshold 5 :fatality-chance 35 :fatality-amount 2 :creature-days-per-severity 80 :descriptions (make-array 4 :initial-contents '("Some people have been complaining they just don't enjoy things like they used to." "People are just generally uglier nowadays. Thinning hair and acne abound." "Vinny's mouth is all swollen and his tongue turned white. His girlfriend dumped him." "Dehydration, bad skin, and hair falling out, are concerning a lot of people.")))) )
5,720
Common Lisp
.lisp
101
51.376238
167
0.733656
mike-1-2-3/EWRP6
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
2f48219cad0095ee3b3b3a5c6beb0ebcbd63d645be8a68ce7bc16ae7e978939a
26,172
[ -1 ]
26,173
plants-instances.lisp
mike-1-2-3_EWRP6/data/plants-instances.lisp
#| Copyright (C) 2015 Mike Harris This program 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 3 of the License, or any later version. This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |# (defun make-plants () (push-item +blueberry-bush+ (make-instance 'bush :name "blueberry bush" :growth-start-date (list 4 1) :fruiting-start-date (list 6 20) :dormancy-start-date (list 9 1) :rainfall-desired 35 :maturity-time 4 :temp-desired 80 :harvest-difficulty 6 :product-list (list (make-instance 'food :name "blueberries" :yield 500 :nutrients (make-array +total-nutrients+ :initial-contents '(3 1 65 5 10 72 2 0 9 0 2 8)))))) (push-item +red-currant-bush+ (make-instance 'bush :name "red currants" :growth-start-date (list 4 1) :fruiting-start-date (list 7 20) :dormancy-start-date (list 9 1) :rainfall-desired 35 :maturity-time 4 :temp-desired 80 :harvest-difficulty 7 :product-list (list (make-instance 'food :name "red currant berries" :yield 2000 :nutrients (make-array +total-nutrients+ :initial-contents '(6 1 64 4 10 304 14 0 27 11 2 3)))))) (push-item +cranberries+ (make-instance 'bush :name "cranberries" :growth-start-date (list 4 1) :fruiting-start-date (list 7 20) :dormancy-start-date (list 9 1) :rainfall-desired 70 :maturity-time 4 :temp-desired 80 :harvest-difficulty 6 :product-list (list (make-instance 'food :name "cranberries" :yield 1000 :nutrients (make-array +total-nutrients+ :initial-contents '(0 0 54 20 16 96 3 1068 9 0 1 2)))))) (push-item +brown-rice+ (make-instance 'plant :name "brown rice" :growth-start-date (list 4 1) :fruiting-start-date (list 7 20) :dormancy-start-date (list 9 1) :rainfall-desired 110 :temp-desired 90 :harvest-difficulty 7 :product-list (list (make-instance 'food :name "rice grain" :yield 1000 :nutrients (make-array +total-nutrients+ :initial-contents '(34 13 341 0 20 0 20 0 48 64 0 3)))))) (push-item +carrots+ (make-instance 'plant :name "carrots" :growth-start-date (list 4 1) :fruiting-start-date (list 7 20) :dormancy-start-date (list 9 1) :rainfall-desired 50 :temp-desired 85 :harvest-difficulty 3 :product-list (list (make-instance 'food :name "carrots" :yield 5000 :nutrients (make-array +total-nutrients+ :initial-contents '(8 0 37 927 5 16 15 0 16 0 2 1)))))) (push-item +corn+ (make-instance 'plant :name "corn" :growth-start-date (list 4 1) :fruiting-start-date (list 7 20) :dormancy-start-date (list 9 1) :rainfall-desired 50 :temp-desired 90 :harvest-difficulty 1 :product-list (list (make-instance 'food :name "corn" :yield 1500 :nutrients (make-array +total-nutrients+ :initial-contents '(15 3 101 0 2 32 0 0 16 16 0 4)))))) (push-item +kiwi+ (make-instance 'bush :name "kiwi" :growth-start-date (list 4 1) :fruiting-start-date (list 7 20) :dormancy-start-date (list 9 1) :rainfall-desired 75 :temp-desired 80 :harvest-difficulty 7 :maturity-time 4 :product-list (list (make-instance 'food :name "kiwis" :yield 1500 :nutrients (make-array +total-nutrients+ :initial-contents '(5 1 64 8 2 688 16 0 0 0 1 8)))))) (push-item +navy-beans+ (make-instance 'plant :name "navy beans" :growth-start-date (list 4 1) :fruiting-start-date (list 7 20) :dormancy-start-date (list 9 1) :rainfall-desired 60 :temp-desired 80 :harvest-difficulty 6 :product-list (list (make-instance 'food :name "navy beans" :yield 460 :nutrients (make-array +total-nutrients+ :initial-contents '(101 7 275 0 300 0 66 0 138 103 2 1)))))) (push-item +peanuts+ (make-instance 'plant :name "peanuts" :growth-start-date (list 4 1) :fruiting-start-date (list 7 20) :dormancy-start-date (list 9 1) :rainfall-desired 33 :temp-desired 100 :harvest-difficulty 6 :product-list (list (make-instance 'food :name "peanuts" :yield 800 :nutrients (make-array +total-nutrients+ :initial-contents '(117 223 73 0 100 0 42 0 120 100 1 5)))))) (push-item +potato+ (make-instance 'plant :name "potato" :growth-start-date (list 4 1) :fruiting-start-date (list 7 20) :dormancy-start-date (list 9 1) :rainfall-desired 50 :temp-desired 70 :harvest-difficulty 6 :product-list (list (make-instance 'food :name "potatoes" :yield 3000 :nutrients (make-array +total-nutrients+ :initial-contents '(10 0 79 0 5 150 5 82 19 9 0 3)))))) (push-item +sesame+ (make-instance 'plant :name "sesame" :growth-start-date (list 4 1) :fruiting-start-date (list 7 20) :dormancy-start-date (list 9 1) :rainfall-desired 120 :temp-desired 100 :harvest-difficulty 7 :product-list (list (make-instance 'food :name "sesame seeds" :yield 200 :nutrients (make-array +total-nutrients+ :initial-contents '(80 225 106 0 150 0 440 0 366 234 4 4)))))) (push-item +soybeans+ (make-instance 'plant :name "soybeans" :growth-start-date (list 4 1) :fruiting-start-date (list 7 20) :dormancy-start-date (list 9 1) :rainfall-desired 40 :temp-desired 80 :harvest-difficulty 6 :product-list (list (make-instance 'food :name "soybeans" :yield 500 :nutrients (make-array +total-nutrients+ :initial-contents '(59 31 50 17 20 218 89 0 88 29 2 2)))))) (push-item +spinach+ (make-instance 'plant :name "spinach" :growth-start-date (list 4 1) :fruiting-start-date (list 7 20) :dormancy-start-date (list 9 1) :rainfall-desired 70 :temp-desired 75 :harvest-difficulty 1 :product-list (list (make-instance 'food :name "spinach" :yield 2200 :nutrients (make-array +total-nutrients+ :initial-contents '(13 2 16 849 20 211 45 0 68 16 5 1)))))) (push-item +wheat+ (make-instance 'plant :name "wheat" :growth-start-date (list 4 1) :fruiting-start-date (list 7 20) :dormancy-start-date (list 9 1) :rainfall-desired 30 :temp-desired 70 :harvest-difficulty 6 :product-list (list (make-instance 'food :name "wheat" :yield 600 :nutrients (make-array +total-nutrients+ :initial-contents '(60 11 326 0 50 0 15 0 89 80 4 5)))))))
7,272
Common Lisp
.lisp
168
35.422619
76
0.634367
mike-1-2-3/EWRP6
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
26862e9b02a0d6f3381a262736ae73833d11f28c9ca909ff45036d8b3e723794
26,173
[ -1 ]
26,174
animals.lisp
mike-1-2-3_EWRP6/data/animals.lisp
#| Copyright (C) 2015 Mike Harris This program 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 3 of the License, or any later version. This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |# (defclass animal () ((name :initarg :name :accessor name :initform (error "no name")) (age-of-maturity :initarg :age-of-maturity :accessor age-of-maturity) ;;in months (age-of-senility :initarg :age-of-senility :accessor age-of-senility) ;; in months (avg-lifespan :initarg :avg-lifespan :accessor avg-lifespan) ;; in months (reproductive-capacity :initarg :reproductive-capacity :accessor reproductive-capacity) ;; 0-100 (strength :initarg :strength :accessor strength) ;; 0 - 100 (agility :initarg :agility :accessor agiltiy) ;; 0-100 (aggressiveness :initarg :aggressiveness :accessor aggressiveness))) ;; 0-100 (defclass domestic-animal (animal) ((forage-required :initarg :forage-required :accessor forage-required))) ;; in acres of pasture
1,452
Common Lisp
.lisp
24
56.333333
99
0.747361
mike-1-2-3/EWRP6
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
3de6ee0a6022eaf0a9aa8791df39f6384c396078379f638348f5650e452f656c
26,174
[ -1 ]
26,175
plants.lisp
mike-1-2-3_EWRP6/data/plants.lisp
#| Copyright (C) 2015 Mike Harris This program 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 3 of the License, or any later version. This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |# (defclass plant () ((name :initarg :name :accessor name :initform nil) ;; month, day pair expected (growth-start-date :initarg :growth-start-date :reader growth-start-date :initform (error "no growth date")) (fruiting-start-date :initarg :fruiting-start-date :reader fruiting-start-date :initform (error "no fruiting date")) (dormancy-start-date :initarg :dormancy-start-date :reader dormancy-start-date :initform (error "no dormancy date")) ;;multiplier between 0 and 10 (harvest-difficulty :initarg :harvest-difficulty :reader harvest-difficulty :initform (error "no harvest difficulty")) (product-list :initarg :product-list :reader product-list :initform nil) ;;Rainfall is in cm/year (temp-desired :initarg :temp-desired :reader temp-desired :initform 80) (rainfall-desired :initarg :rainfall-desired :reader rainfall-desired :initform (error "no rainfall info")))) (defclass bush (plant) ((maturity-time :initarg :maturity-time :reader maturity-time :initform (error "no maturity info")))) (defclass native-plant (plant) ((known-to-player :initarg :known-to-player :accessor known-to-player :initform nil) (description :initarg :description :accessor description :initform nil))) (defclass product () ((name :initarg :name :accessor name) (yield :initarg :yield :accessor yield))) ;; pounds per acre (defclass native-food (product) ((description :initarg :description :accessor description) (chemicals :initarg :chemicals :accessor chemicals :initform (make-array +total-chemicals+ :initial-element 0)) (nutrients :initarg :nutrients :accessor nutrients :initform (make-array +total-nutrients+ :initial-element 0)))) (defclass food (product) ((nutrients :initarg :nutrients :accessor nutrients :initform (make-array +total-nutrients+ :initial-element 0))))
2,553
Common Lisp
.lisp
47
49.914894
103
0.741884
mike-1-2-3/EWRP6
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
d0b636c8f8f737dd561099c05e9d2a68ea47f869fb5e6e9369dea22ff0e79d29
26,175
[ -1 ]
26,176
affliction.lisp
mike-1-2-3_EWRP6/data/affliction.lisp
#| Copyright (C) 2015 Mike Harris This program 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 3 of the License, or any later version. This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |# (defclass affliction () ((descriptions :initarg :descriptions :accessor descriptions :initform (error "need descriptions")) (fatality-threshold :initarg :fatality-threshold :accessor fatality-threshold :initform 3) (fatality-chance :initarg :fatality-chance :accessor fatality-chance :initform (error "needs amt")) (fatality-amount :initarg :fatality-amount :accessor fatality-amount :initform (error "needs amt")))) (defclass malnurishment (affliction) ((missing-nutrient :initarg :missing-nutrient :accessor missing-nutrient) (creature-days-per-severity :initarg :creature-days-per-severity :accessor creature-days-per-severity :initform 30)))
1,360
Common Lisp
.lisp
23
54.478261
102
0.761475
mike-1-2-3/EWRP6
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
23e794735c8e2a3c94c588484c1879d45b3d76df1ff359b24830e9872870ed0f
26,176
[ -1 ]
26,177
world.lisp
mike-1-2-3_EWRP6/data/world.lisp
#| Copyright (C) 2015 Mike Harris This program 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 3 of the License, or any later version. This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |# (defclass sector () ((arable :initarg :arable :accessor arable :initform (error "needs more info")) (cleared :initarg :cleared :accessor cleared :initform (error "needs more info")) (salt-water :initarg :salt-water :accessor salt-water :initform (error "needs more info")) (fresh-water :initarg :fresh-water :accessor fresh-water :initform (error "needs more info")) (settlement :initarg :settlement :accessor settlement :initform nil) (player-knowledge :initarg :player-knowledge :accessor player-knowledge :initform *fog-of-war*) (tile-id :initarg :tile-id :accessor tile-id :initform 0) (rainfall :initarg :rainfall :accessor rainfall :initform (error "sector needs rainfall")) (avg-summer-temp :initarg :avg-summer-temp :accessor avg-summer-temp :initform 0) (animals-list :initarg :animals-list :accessor animals-list :initform nil) (plants-list :accessor plants-list :initform nil))) ;; this class "overlays" a sector controlled by a faction ;; basically, synonymous with settlement or town (defclass aligned-sector () ((underlying-sector :initarg :underlying-sector :accessor underlying-sector) (controller-index :initarg :controller-index :accessor controller-index :initform (error "no controller")) (total-workforce :accessor total-workforce) (idle-workers :accessor idle-workers) (monthly-workers :accessor monthly-workers) (job-queue :initarg :job-queue :accessor job-queue :initform (make-array 2000 :fill-pointer 0)) (sentients-list :accessor sentients-list :initform nil) (livestock-list :initarg :livestock-list :accessor livestock-list :initform nil) (farms-list :initarg :farms-list :accessor farms-list :initform nil) (afflictions-list :initarg :afflictions-list :accessor afflictions-list :initform nil) ;; (nutrient, severity) (good-stores :initarg :good-stores :accessor good-stores :initform (make-array +total-goods+ :initial-element 0)) (mat-stores :initarg :mat-stores :accessor mat-stores :initform (make-array +total-materials+ :initial-element 0)) (food-stores :initarg :food-stores :accessor food-stores :initform (make-array +total-nutrients+ :initial-element 30000)))) ;;-------------------The massive, global, singleton that holds all persistant data (defclass world () ((world-grid :initarg :world-grid :accessor world-grid :initform (make-array (list +map-size+ +map-size+))) (mutex :initarg :mutex :accessor mutex :initform t) (alert-queue :initarg :alert-queue :accessor alert-queue :initform nil) (current-game-state :accessor current-game-state) (queued-game-states :initarg :queued-game-states :accessor queued-game-states :initform nil) (the-menu-state :accessor the-menu-state) (the-sector-state :accessor the-sector-state) (the-input-state :accessor the-input-state) (showing-alert? :initarg :showing-alert? :accessor showing-alert? :initform nil) (cursor-x :initarg :cursor-x :accessor cursor-x :initform 1) (cursor-y :initarg :cursor-y :accessor cursor-y :initform 1) (time-created :initarg :time-created :reader time-created :initform (get-universal-time)) (last-played :initarg :last-played :accessor last-played :initform (get-universal-time)) (player-name :initarg :player-name :accessor player-name :initform "User") (year-num :initarg :year-num :accessor year-num :initform 2016) (month-num :initarg :month-num :accessor month-num :initform 1) (day-num :initarg :day-num :accessor day-num :initform 1) (hour-num :initarg :hour-num :accessor hour-num :initform 1) ;; instance arrays (mats-array :initarg :mats-array :accessor mats-array :initform (make-array +total-materials+)) (goods-array :initarg :goods-array :accessor goods-array :initform (make-array +total-goods+)) (factions-array :initarg :factions-array :accessor factions-array :initform (make-array +total-factions+)) (plant-instance-array :initarg :plant-instance-array :accessor plant-instance-array :initform (make-array (+ +total-types-of-plants+ +random-plants+) :fill-pointer 0)) (native-plant-array :initarg :native-plant-array :accessor native-plant-array :initform (make-array (list +num-biomes+ +plants-per-biome+))) (animal-array :initarg :animal-array :accessor animal-array :initform (make-array +total-types-of-animals+)) (affliction-array :initarg :affliction-array :accessor affliction-array :initform (make-array +total-afflictions+)) (sentient-array :initarg :sentient-array :accessor sentient-array :initform (make-array +total-types-of-sentients+)))) (defun selected-sector () (get-sector (cursor-x *the-world*) (cursor-y *the-world*))) (defun selected-town () (settlement (selected-sector))) ;;------------------------- some sector access code shortening functions (defun get-farms () (farms-list (settlement (selected-sector)))) (defmethod push-item ((place aligned-sector) (item farmed-plant-population)) (push item (farms-list place))) (defmethod push-item ((place faction) (item aligned-sector)) (push item (controlled-sectors place))) (defmethod push-item ((place sector) (item animal-population)) (push item (animals-list place))) (defmethod push-item ((place aligned-sector) (item livestock-population)) (push item (livestock-list place))) (defmethod push-item ((place aligned-sector) (item sentient-population)) (push item (sentients-list place))) ;; ------------------------ some world access code shortening functions (defmethod push-item ((place integer) (item plant)) (vector-push item (plant-instance-array *the-world*))) (defmethod push-item ((place integer) (item affliction)) (setf (aref (affliction-array *the-world*) place) item)) (defmethod push-sentient ((place integer) (item sentient-animal)) (setf (aref (sentient-array *the-world*) place) item)) (defmethod push-item ((place integer) (item animal)) (setf (aref (animal-array *the-world*) place) item)) (defmethod push-item ((place integer) (item faction)) (setf (aref (factions-array *the-world*) place) item)) (defmethod get-population-type ((pop farmed-plant-population)) (aref (plant-instance-array *the-world*) (species-index pop))) (defmethod get-population-type ((pop livestock-population)) (aref (animal-array *the-world*) (species-index pop))) (defmethod get-population-type ((pop animal-population)) (aref (animal-array *the-world*) (species-index pop))) (defmethod get-population-type ((pop sentient-population)) (aref (sentient-array *the-world*) (species-index pop))) (defun get-faction (position) (aref (factions-array *the-world*) position)) (defun get-owner (x y) (get-faction (controller-index (settlement (get-sector x y))))) (defun get-sector (x y) (aref (world-grid *the-world*) x y)) (defun current-date () (list (month-num *the-world*) (day-num *the-world*))) (defun get-plant (index) (aref (plant-instance-array *the-world*) index)) (defun get-products (index) (product-list (get-plant index))) ;;--------------------------------- get the names of things (defmethod get-name ((item farmed-plant-population)) (concatenate 'string (name (aref (plant-instance-array *the-world*) (species-index item))) " " (write-to-string (quantity item)) (if (equalp (quantity item) 1) " acre" " acres"))) (defmethod get-name ((item product)) (name item)) (defmethod get-name ((item plant)) (name item)) (defmethod get-name ((item menu)) (name item))
8,197
Common Lisp
.lisp
146
52.376712
98
0.725175
mike-1-2-3/EWRP6
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
9d1239032d451779760ccc46a10f76d8f6720ebe43e1201255667231e294cdc8
26,177
[ -1 ]
26,178
faction-instances.lisp
mike-1-2-3_EWRP6/data/faction-instances.lisp
#| Copyright (C) 2015 Mike Harris This program 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 3 of the License, or any later version. This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |# (defun make-factions () (push-item +earthlings+ (make-instance 'faction :name "Earthlings" :bellicose 6 :description "Your people." :color1 (sdl:color :r 41 :g 73 :b 255) :color2 (sdl:color :r 7 :g 33 :b 179))) (push-item +gliesens+ (make-instance 'faction :name "Gliesens" :bellicose 1 :description "They are aquatic, but have some water filled, mostly glass, buildings rising above the surface, or built on land. Their architecture is always symmetrical, and often includes beautifully carved columns, colored glass, and gems." :color1 (sdl:color :r 255 :g 255 :b 255) :color2 (sdl:color :r 138 :g 226 :b 255))) (push-item +nebulites+ (make-instance 'faction :name "Nebulites" :bellicose 7 :description "They rarely leave massive, clay, domes. They build large statues of bizarre creatures, with expressions that would be deranged if made by humans." :color1 (sdl:color :r 173 :g 78 :b 0) :color2 (sdl:color :r 143 :g 64 :b 0))) (push-item +cygnites+ (make-instance 'faction :name "Cygnites" :bellicose 6 :description "It's hard to tell what they are doing. Their structures frequently behave differently than you'd expect of solid matter, and odd, mechanical, constructs, are in constant motion around their towns." :color1 (sdl:color :r 244 :g 255 :b 191) :color2 (sdl:color :r 186 :g 201 :b 107))) (push-item +errrkruuu+ (make-instance 'faction :name "Errrkruuu" :bellicose 3 :description "They live in a single, floating, hive far above the ground, which is anchored by a thick organic cord. They have planted vast fields of plants from their home planet, and populated them with prey animals, which are their main source of food. " :color1 (sdl:color :r 255 :g 215 :b 38) :color2 (sdl:color :r 255 :g 177 :b 8))) (push-item +trrrmsss+ (make-instance 'faction :name "Trrrmsss" :bellicose 20 :description "They live in a single, floating, hive far above the ground, which is anchored by a thick organic cord. They hunt far and wide. Including us! We barely escaped." :color1 (sdl:color :r 219 :g 26 :b 0) :color2 (sdl:color :r 150 :g 18 :b 0))) (push-item +ribes+ (make-instance 'faction :name "Ribes" :bellicose 10 :description "They live in huts, and are constantly fighting each other. When one of them dies, they throw it in a fire without any ceremony. They herd creatures that look like obese, headless, pigs, which they impale and eat raw, and alive." :color1 (sdl:color :r 106 :g 133 :b 105) :color2 (sdl:color :r 120 :g 112 :b 89))))
3,311
Common Lisp
.lisp
42
72.285714
262
0.706532
mike-1-2-3/EWRP6
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
9dbf886508b6720233527731e143ca54914482c390ad235cdfb1daddd96f9984
26,178
[ -1 ]
26,179
goods-instances.lisp
mike-1-2-3_EWRP6/data/goods-instances.lisp
#| Copyright (C) 2015 Mike Harris This program 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 3 of the License, or any later version. This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |# (defun make-goods () (let ((goods (goods-array *the-world*))) (setf (aref goods +shoddy-spear+) (make-instance 'ranged :name "Shoddy spear" :yield 1 :hours 2 :tools (list +stone-knife+) :armor-piercing 1 :accuracy 1 :fatality-chance 15 :damage 20)) (setf (aref goods +simple-bow+) (make-instance 'ranged :name "Simple bow" :yield 1 :hours 32 :tools (list +stone-knife+) :good-mats (list (list +thread+ 1)) :armor-piercing 1 :accuracy 2 :fatality-chance 15 :damage 20)) (setf (aref goods +shoddy-shield+) (make-instance 'armor :name "Shoddy shield" :yield 1 :hours 4 :tools (list +stone-knife+) :hardness 1 :coverage 1 :weight 5)) (setf (aref goods +stone-knife+) (make-instance 'melee :name "Stone knife" :yield 1 :hours 8 :armor-piercing 1 :accuracy 1 :fatality-chance 10 :damage 20)) (setf (aref goods +stone-axe+) (make-instance 'melee :name "Stone axe" :yield 1 :hours 8 :tools (list +stone-knife+) :armor-piercing 2 :accuracy 1 :fatality-chance 30 :damage 40)) (setf (aref goods +bone-needles+) (make-instance 'good :name "Bone needles" :yield 1 :hours 4 :tools (list +stone-knife+))) (setf (aref goods +stone-pot+) (make-instance 'good :name "Stone pot" :yield 1 :hours 32)) (setf (aref goods +stone-hoe+) (make-instance 'good :name "Stone hoe" :yield 1 :hours 8 :tools (list +stone-knife+))) (setf (aref goods +basic-plow+) (make-instance 'good :name "Basic plow" :yield 1 :hours 32 :effectiveness 2 :tools (list +stone-axe+ +stone-knife+))) (setf (aref goods +loom+) (make-instance 'good :name "Loom set" :yield 1 :hours 64 :tools (list +stone-knife+ +stone-axe+) :good-mats (list (list +bone-needles+ 3)))) (setf (aref goods +thread+) (make-instance 'good :name "Thread" :yield 1 :hours 8 :mats (list (list +fibers+ 1)))) (setf (aref goods +net+) (make-instance 'good :name "Net" :yield 1 :hours 4 :good-mats (list (list +thread+ 2)))) (setf (aref goods +shoddy-textiles+) (make-instance 'good :name "Shoddy textile" :yield 5 :hours 10 :tools (list +loom+) :good-mats (list (list +thread+ 4)))) (setf (aref goods +leather+) (make-instance 'good :name "Leather" :yield 5 :hours 16 :tools (list +stone-knife+) :mats (list (list +skins+ 1)))) (setf (aref goods +leather-scales+) (make-instance 'good :name "Leather scales" :yield 20 :hours 2 :tools (list +stone-pot+ +stone-knife+) :good-mats (list (list +leather+ 1)))) (setf (aref goods +lamellar+) (make-instance 'armor :name "Lamellar" :yield 1 :hours 64 :hardness 4 :coverage 5 :weight 5 :tools (list +stone-pot+ +stone-knife+) :good-mats (list (list +leather+ 1) (list +leather-scales+ 200 ))))))
3,426
Common Lisp
.lisp
64
48.828125
92
0.675209
mike-1-2-3/EWRP6
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
7ee294e4aef3e50e4e756ffb0783f5dbb61bae4f009376ae29e42f9232762b63
26,179
[ -1 ]
26,180
goods.lisp
mike-1-2-3_EWRP6/data/goods.lisp
#| Copyright (C) 2015 Mike Harris This program 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 3 of the License, or any later version. This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |# (defclass job () ((workers-used :initarg :workers-used :accessor workers-used) (hours-remaining :initarg :hours-remaining :accessor hours-remaining) (job-id :initarg :job-id :accessor job-id) (index :initarg :index :accessor index) ;;basic goods index, or military power, because lazy (yield :initarg :yield :accessor yield :initform nil) (tools :initarg :tools :accessor tools :initform nil) (destination :initarg :destination :accessor destination :initform nil) (origin :initarg :origin :accessor origin :initform (selected-town)))) (defclass good (product) ((hours :initarg :hours :accessor hours) (effectiveness :initarg :effectiveness :accessor effectiveness :initform 1) (mats :initarg :mats :accessor mats :initform nil) ;; list of lists (index, num) (good-mats :initarg :good-mats :accessor good-mats :initform nil) (tools :initarg :tools :accessor tools :initform nil) (techs :initarg :techs :accessor techs :initform nil))) (defclass melee (good) ((armor-piercing :initarg :armor-piercing :accessor armor-piercing) (accuracy :initarg :accuracy :accessor accuracy) (fatality-chance :initarg :fatality-chance :accessor fatality-chance) (damage :initarg :damage :accessor damage))) (defclass ranged (good) ((armor-piercing :initarg :armor-piercing :accessor armor-piercing) (accuracy :initarg :accuracy :accessor accuracy) (fatality-chance :initarg :fatality-chance :accessor fatality-chance) (damage :initarg :damage :accessor damage))) (defclass armor (good) ((hardness :initarg :hardness :accessor hardness) (coverage :initarg :coverage :accessor coverage) (weight :initarg :weight :accessor weight)))
2,367
Common Lisp
.lisp
43
51.162791
95
0.751513
mike-1-2-3/EWRP6
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
afa79ec0c8984b002927fbb5961040dd0eff80aebb14d0730edfaf5fd1e2024e
26,180
[ -1 ]
26,181
repl-interface.lisp
mike-1-2-3_EWRP6/interfaces/repl-interface.lisp
#| Copyright (C) 2015 Mike Harris This program 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 3 of the License, or any later version. This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |# (defun popup (message) (print message)) (defun show-settlement-info () (let ((place (settlement (selected-sector)))) (print "total-workforce") (print (total-workforce place)) (print "hours available") (print (labor-hours-available place)) (print "hours used") (print (labor-hours-used place)) (print "livestock list") (dolist (f (livestock-list place)) (print (quantity f)) (print (name (get-population-type f)))) (print "farms list") (dolist (f (farms-list place)) (print (quantity f)) (print (name (get-population-type f)))))) (defun show-sector-info () (let ((place (selected-sector))) (print "arable") (print (arable place)) (print "cleared") (print (cleared place)) (print "animals list") (dolist (f (animals-list place)) (print (quantity f)) (print (name (get-population-type f)))))) (defun show-world-information () (print "plants") (dotimes (i +total-types-of-plants+) (print (name (aref (plant-instance-array *the-world*) i)))) (print "animal-array") (dotimes (i +total-types-of-animals+) (print (name (aref (animal-array *the-world*) i)))) (print "sentient array") (dotimes (i +total-types-of-sentients+) (print (name (aref (sentient-array *the-world*) i))))) (defun calendar () (print "hour:") (print (hour-num *the-world*)) (print "day:") (print (day-num *the-world*)) (print "month:") (print (month-num *the-world*)) (print "year:") (print (year-num *the-world*)))
2,211
Common Lisp
.lisp
60
32.466667
73
0.672123
mike-1-2-3/EWRP6
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
d8ad181f3b9e761ef53e930c5766cee96059d08b2d2af88361d2ef6cfdad730a
26,181
[ -1 ]
26,182
menu.lisp
mike-1-2-3_EWRP6/interfaces/menu.lisp
#| Copyright (C) 2015 Mike Harris This program 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 3 of the License, or any later version. This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |# (defclass prompt-info () ((prompt-string :initarg :prompt-string :accessor prompt-string) (input-type :initarg :input-type :accessor input-type :initform 'integer) (trailing-string :initarg :trailing-string :accessor trailing-string))) (defclass alert () ((strings :initarg :strings :accessor strings :initform nil) (title :initarg :title :accessor title :initform nil) (result-func :initarg :result-func :accessor result-func) (prompts :initarg :prompts :accessor prompts :initform nil))) (defclass menu () ((parent :initarg :parent :accessor parent) (action :initarg :action :accessor action :initform nil) (selected-info-box :initarg :selected-info-box :accessor selected-info-box :initform nil) (selected-prompts :initarg :selected-prompts :accessor selected-prompts :initform nil) (child-action :initarg :child-action :accessor child-action :initform nil) (child-prompts :initarg :child-prompts :accessor child-prompts :initform nil) (child-info-box :initarg :child-info-box :accessor child-info-box :initform nil) (name :initarg :name :accessor name) (items :initarg :items :accessor items :initform nil))) (defmethod push-item ((place menu) (item prompt-info)) (push item (child-prompts place))) (defmethod push-item ((place menu) (item menu)) (push item (items place))) (defun print-menu-tree (menu) (dolist (i (items menu)) (if (equalp (type-of i) 'menu) (print-menu-tree i)) (print (get-name i))))
2,155
Common Lisp
.lisp
41
48.707317
92
0.741076
mike-1-2-3/EWRP6
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
4d145ee8fcfcf4e566dc9c33ec42a91ca7e338648dfb47950af833987f57c063
26,182
[ -1 ]
26,183
menu-instances.lisp
mike-1-2-3_EWRP6/interfaces/menu-instances.lisp
#| Copyright (C) 2015 Mike Harris This program 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 3 of the License, or any later version. This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |# (defun generate-goods-strings () (let ((good (aref (goods-array *the-world*) (selected-item (the-menu-state *the-world*)))) (strs nil)) (push (concatenate 'string "One worker will make " (write-to-string (yield good)) ", takes " (write-to-string (hours good)) " hours.") strs) strs)) (defun generate-surroundings-strings () (with-slots (rainfall avg-summer-temp) (selected-sector) (let ((strs nil) (temp (- (avg-summer-temp (selected-sector)) (* 10 (abs (- 6 (month-num *the-world*))))))) (incf temp (+ -10 (random 20))) (cond ((< rainfall 10) (push "Only isolated clumps of succulents grow in the cracked earth." strs)) ((< rainfall 30) (push "The dry soil only supports scrublands and plains." strs)) ((< rainfall 50) (push "There is a fair amount of alien vegetation around." strs)) ((< rainfall 70) (push "The vegetation is very thick, the air is humid." strs)) (t (push "The air is saturated and the vegetation is incredibly dense." strs))) (cond ((< temp 30) (push "It's freezing." strs)) ((< temp 60) (push "It's quite chilly." strs)) ((< temp 70) (push "It's a cool day." strs)) ((< temp 80) (push "It's very nice outside!" strs)) ((< temp 100) (push "It's a bit hot." strs)) (t (push "The heat is oppressive." strs))) strs))) (defun get-selected-child () (with-slots (current-menu selected-item) (the-menu-state *the-world*) (with-slots (items) current-menu (if (typep items 'list) (nth selected-item items) (if (typep items 'array) (aref items selected-item)))))) (defun generate-census-strings () (let ((strs nil)) (push (concatenate 'string "Workers available: " (write-to-string (idle-workers (selected-town)))) strs) (dolist (population (sentients-list (selected-town))) (push (concatenate 'string (write-to-string (quantity population)) " " (name (get-population-type population)) "s.") strs)) strs)) (defun generate-basic-goods-strings () (let ((strs nil)) (dotimes (i +total-goods+) (push (concatenate 'string (name (aref (goods-array *the-world*) i)) ": " (write-to-string (aref (good-stores (selected-town)) i))) strs)) strs)) (defun generate-mats-strings () (let ((strs nil)) (dotimes (i +total-materials+) (push (concatenate 'string (name (aref (mats-array *the-world*) i)) ": " (write-to-string (aref (mat-stores (selected-town)) i))) strs)) strs)) (defun generate-food-stores-strings () (let ((stores (ceiling (+ (* 7 (aref (food-stores (selected-town)) +fat+)) (* 4 (aref (food-stores (selected-town)) +carbs+))) (* (total-workforce (selected-town)) 2000 30)))) (cond ((> stores 0) (list (concatenate 'string "We have food for about " (write-to-string stores) " months."))) ((> stores -2) (list "We are at half rations.")) (t (list "We are basically out of food."))))) (defun generate-designations-strings () (let ((acres 0)) (dolist (farm (get-farms)) (incf acres (quantity farm))) (list (concatenate 'string "Acres in use: " (write-to-string acres)) "Press enter to remove designations or view details."))) (defun generate-acreage-strings () (with-slots (arable cleared salt-water fresh-water) (selected-sector) (list (concatenate 'string "Arable land: " (write-to-string arable)) (concatenate 'string "Available cleared land: " (write-to-string cleared)) (concatenate 'string "Salt water: " (write-to-string salt-water)) (concatenate 'string "Fresh water: " (write-to-string fresh-water))))) (defun generate-medical-strings () (let ((affs (afflictions-list (settlement (selected-sector))))) (if (null affs) (let ((r (random 4))) (cond ((equalp r 0) (list "Some children are playing happily.")) ((equalp r 1) (list "An old man is singing ZZ Top songs rather poorly.")) ((equalp r 2) (list "The head medic is tending his flowers.")) ((equalp r 3) (list "The head medic is putting a splint on a wounded bird.")))) (progn (let ((medical-strings nil)) (dolist (affliction affs) (push (aref (descriptions (aref (affliction-array *the-world*) (first affliction))) (second affliction)) medical-strings)) medical-strings))))) (defun generate-farm-strings () (if (null (get-farms)) (list "No land has been designated.") (list "Press enter to free land." (concatenate 'string "Farm status: " (if (tended (nth (selected-item (the-menu-state *the-world*)) (get-farms))) "well tended" "fallow - not enough workers to tend the plants."))))) ;;----------------------- sector selected menu (defun make-main-menu () (let ((menu-entry (make-instance 'menu :parent nil :name (concatenate 'string "Sector: " (write-to-string (cursor-x *the-world*)) ", " (write-to-string (cursor-y *the-world*)))))) (let ((submenu (make-instance 'menu :parent menu-entry :name "Look around"))) (push-item menu-entry submenu) (push-item submenu (make-instance 'menu :parent submenu :name "Surroundings" :selected-info-box #'generate-surroundings-strings)) (push-item submenu (make-instance 'menu :parent submenu :name "Medic's hut" :selected-info-box #'generate-medical-strings))) (let ((submenu (make-instance 'menu :parent menu-entry :name "Designate"))) (push-item menu-entry submenu) ;; (push-item submenu (make-instance 'menu :parent submenu :name "Fishing Ground")) (let ((subsubmenu (make-instance 'menu :parent submenu :name "Clear Land" :action #'clear-acres :selected-prompts (list (make-instance 'prompt-info :prompt-string "How many people?" :input-type 'integer :trailing-string "") (make-instance 'prompt-info :prompt-string "How many acres?" :input-type 'integer :trailing-string ""))))) (push-item submenu subsubmenu)) ;; (push-item submenu (make-instance 'menu :parent submenu :name "Clear Land")) (let ((subsubmenu (make-instance 'menu :parent submenu :name "Farms" :items (plant-instance-array *the-world*) :child-action #'add-farm))) (push-item subsubmenu (make-instance 'prompt-info :prompt-string "How many acres?" :input-type 'integer :trailing-string "")) (push-item submenu subsubmenu))) (let ((submenu (make-instance 'menu :parent menu-entry :name "Inventories"))) (push-item menu-entry submenu) (push-item submenu (make-instance 'menu :parent submenu :name "Census" :selected-info-box #'generate-census-strings)) (push-item submenu (make-instance 'menu :parent submenu :name "Food Supplies" :selected-info-box #'generate-food-stores-strings)) (push-item submenu (make-instance 'menu :parent submenu :name "Basic Goods" :selected-info-box #'generate-basic-goods-strings)) (push-item submenu (make-instance 'menu :parent submenu :name "Raw Materials" :selected-info-box #'generate-mats-strings)) (push-item submenu (make-instance 'menu :parent submenu :name "Designations" :items #'get-farms :child-action #'remove-farm :child-info-box #'generate-farm-strings :selected-info-box #'generate-designations-strings)) (push-item submenu (make-instance 'menu :parent submenu :name "Acreage" :selected-info-box #'generate-acreage-strings))) (let ((submenu (make-instance 'menu :parent menu-entry :name "Give orders"))) (push-item menu-entry submenu) (let ((subsubmenu (make-instance 'menu :parent submenu :name "Forage" :action #'send-foragers :selected-prompts (list (make-instance 'prompt-info :prompt-string "How many?" :input-type 'integer :trailing-string "people"))))) (push-item submenu subsubmenu)) (let ((subsubmenu (make-instance 'menu :parent submenu :name "Explore" :action #'send-explorers :selected-prompts (list (make-instance 'prompt-info :prompt-string "Destination X cor?" :input-type 'integer :trailing-string "") (make-instance 'prompt-info :prompt-string "Destination y cor?" :input-type 'integer :trailing-string "") (make-instance 'prompt-info :prompt-string "Send how many?" :input-type 'integer :trailing-string ""))))) (push-item submenu subsubmenu)) (let ((subsubmenu (make-instance 'menu :parent submenu :name "Make goods" :child-info-box #'generate-goods-strings :items (goods-array *the-world*) :child-action #'order-goods))) (push-item subsubmenu (make-instance 'prompt-info :prompt-string "How many goods?" :input-type 'integer :trailing-string "")) (push-item submenu subsubmenu)) (let ((subsubmenu (make-instance 'menu :parent submenu :name "Fish" :action #'send-fishers :selected-prompts (list (make-instance 'prompt-info :prompt-string "How many?" :input-type 'integer :trailing-string ""))))) (push-item submenu subsubmenu)) (let ((subsubmenu (make-instance 'menu :parent submenu :name "Hunt" :action #'send-hunters :selected-prompts (list (make-instance 'prompt-info :prompt-string "How many?" :input-type 'integer :trailing-string ""))))) (push-item submenu subsubmenu))) ;; (push-item submenu (make-instance 'menu :parent submenu :name "Hunt"))) ;; (push-item submenu (make-instance 'menu :parent submenu :name "Explore")) menu-entry))
10,514
Common Lisp
.lisp
225
40.031111
92
0.646967
mike-1-2-3/EWRP6
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
2d9f15eb523a1df1e0ef762c87980d07b3989514b8e31b021a444e530e3b0529
26,183
[ -1 ]
26,184
states.lisp
mike-1-2-3_EWRP6/interfaces/states.lisp
#| Copyright (C) 2015 Mike Harris This program 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 3 of the License, or any later version. This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |# (defgeneric screen-resized (game-state)) (defgeneric process-key-event (game-state key unicode)) (defgeneric draw (game-state)) ;;------------------------------------------ Input Game State (defclass input-game-state () ((prompt-queue :initarg :prompt-queue :accessor prompt-queue :initform nil) (input-string :initarg :input-string :accessor input-string :initform "") (y-cor :initarg :y-cor :accessor y-cor :initform 5) ;; beginning y of current, three lined form (results-list :initarg :results-list :accessor results-list :initform nil) (resulting-func :initarg :resulting-func :accessor resulting-func :initform nil))) (defgeneric next-prompt (input)) (defmethod next-prompt ((input input-game-state)) (with-slots (prompt-queue y-cor input-string resulting-func results-list) input (pop prompt-queue) (setf input-string "") (if prompt-queue (progn (incf y-cor (+ 2 (* 3 (sdl:char-height *font*)))) (draw-prompt y-cor (prompt-string (first prompt-queue)) (trailing-string (first prompt-queue)))) (progn (apply resulting-func results-list) (setf resulting-func nil results-list nil) (next-game-state))))) (defmethod draw ((game-state input-game-state)) (with-slots (y-cor input-string) game-state (draw-menu-item input-string sdl:*yellow* 5 (+ 2 y-cor (sdl:char-height *font*))) (sdl:update-display))) (defmethod process-key-event ((game-state input-game-state) key unicode) (with-slots (input-string y-cor prompt-queue results-list) game-state (when (sdl:key= key :sdl-key-backspace) (when (> (length input-string) 0) (clear-line (+ y-cor (sdl:char-height *font*) 2)) (setf input-string (subseq input-string 0 (- (length input-string) 1))))) (when (and (> unicode 47) (< unicode 58)) (if (equalp (input-type (first prompt-queue)) 'integer) (setf input-string (concatenate 'string input-string (list (code-char unicode)))))) (when (or (equalp unicode 32) (and (> unicode 47) (not (equalp unicode 92)) (< unicode 123))) (when (equalp (input-type (first prompt-queue)) 'string) (setf input-string (concatenate 'string input-string (list (code-char unicode)))))) (when (or (sdl:key= key :sdl-key-return) (sdl:key= key :sdl-key-kp-enter)) (when (null (input-type (first prompt-queue))) (next-prompt game-state)) (when (> (length input-string) 0) (if (equalp (input-type (first prompt-queue)) 'integer) (push (parse-integer input-string) results-list) (push input-string results-list)) (next-prompt game-state))))) ;;------------------------------------------- Menu Game State (defclass menu-game-state () ((root-menu :initarg :root-menu :accessor root-menu) (current-menu :initarg :current-menu :accessor current-menu) (selected-item :initarg :selected-item :accessor selected-item :initform 0) (max-displayed :initarg :max-displayed :accessor max-displayed :initform (- (floor (/ *screenh* (sdl:char-height *font*))) 1)) (first-element :initarg :first-element :accessor first-element :initform 0) (total-elements :initarg :total-elements :accessor total-elements :initform 4))) (defmethod screen-resized ((game-state menu-game-state)) (setf (max-displayed game-state) (- (floor (/ *screenh* (sdl:char-height *font*))) 1))) (defmethod draw ((game-state menu-game-state)) (with-slots (current-menu selected-item max-displayed first-element total-elements) game-state (draw-menu current-menu selected-item max-displayed first-element) (if (typep (items current-menu) 'list) (when (selected-info-box (nth selected-item (items current-menu))) (draw-sectors) (draw-info-box (selected-info-box (nth selected-item (items current-menu)))))) (when (and (child-info-box current-menu) (items current-menu)) (draw-sectors) (draw-info-box (child-info-box current-menu))))) (defmethod process-key-event ((game-state menu-game-state) key unicode) (with-slots (current-menu selected-item max-displayed first-element total-elements) game-state (with-slots (items child-prompts child-action child-info-box action selected-prompts) current-menu (when (or (sdl:key= key :sdl-key-return) (sdl:key= key :sdl-key-kp-enter)) (if child-prompts (set-state-to-input (get-name (aref items selected-item)) child-prompts child-action) (if child-action (progn (funcall child-action selected-item)) (progn (if (typep (nth selected-item items) 'menu) (progn (if (selected-prompts (nth selected-item items)) (set-state-to-input (name (nth selected-item items)) (selected-prompts (nth selected-item items)) (action (nth selected-item items)))) (when (items (nth selected-item items)) (setf current-menu (nth selected-item items)) (setf selected-item 0))))))) (update-menu-elements)) (when (sdl:key= key :sdl-key-escape) (if (equalp (parent current-menu) nil) (set-state-to-sector) (progn (if child-info-box (draw-sectors) (if (typep (get-selected-child) 'menu) (if (selected-info-box (get-selected-child)) (draw-sectors)))) (setf current-menu (parent current-menu)) (setf selected-item 0) (update-menu-elements) (setf selected-item 0)))) (when (sdl:key= key :sdl-key-down) (if (equalp (- total-elements 1) selected-item) (setf selected-item 0) (incf selected-item 1))) (when (sdl:key= key :sdl-key-up) (if (equalp selected-item 0) (setf selected-item (- total-elements 1)) (decf selected-item 1)))))) (defun update-menu-elements () (with-slots (the-menu-state) *the-world* (with-slots (total-elements current-menu selected-item) the-menu-state (with-slots (items) current-menu (if (equalp (type-of items) 'function) (setf total-elements (length (funcall items))) (setf total-elements (length items))) (if (>= selected-item total-elements) (decf selected-item 1)))))) ;;------------------------------------------sector selection state (defclass sector-selection-state () ((redraw :initarg :redraw :accessor redraw :initform t) (img-array :initarg :img-array :accessor img-array :initform (make-array +total-graphics+)) (top-left-x :initarg :top-left-x :accessor top-left-x :initform 0) ;; start points for drawing (top-left-y :initarg :top-left-y :accessor top-left-y :initform 0) (max-tiles-x :initarg :max-tiles-x :accessor max-tiles-x :initform (floor (- *screenw* 220) 50)) (max-tiles-y :initarg :max-tiles-y :accessor max-tiles-y :initform (floor (- *screenh* (+ 10 (sdl:char-height *font*))) 50)))) (defmethod draw ((game-state null))) ;;draw nothing after quit event (defmethod draw ((game-state sector-selection-state)) (if (equalp (redraw game-state) t) (progn (draw-sectors) (draw-sector-title)) (setf (redraw game-state) t))) (defmethod process-key-event ((game-state sector-selection-state) key unicode) (with-slots (img-array top-left-x top-left-y max-tiles-x max-tiles-y redraw) game-state (with-slots (cursor-x cursor-y) *the-world* ;; Debug cheat key - make sure to comment out the start timer line in startup.lisp too ;; (when (sdl:key= key :sdl-key-y) ;; (setf (mutex *the-world*) t) ;; (process-some-ticks 250)) (when (sdl:key= key :sdl-key-t) (let ((q nil)) (push (make-instance 'prompt-info :trailing-string "" :prompt-string "Y coordinate?" :input-type 'integer) q) (push (make-instance 'prompt-info :trailing-string "" :prompt-string "X coordinate?" :input-type 'integer) q) (set-state-to-input "Teleport" q #'teleport))) (when (sdl:key= key :sdl-key-q) (save) (setf (mutex *the-world*) t) (cleanup) (sdl:push-quit-event)) (when (or (sdl:key= key :sdl-key-return) (sdl:key= key :sdl-key-kp-enter)) (if (not (settlement (selected-sector))) (if (> (player-knowledge (selected-sector)) 1) (progn (draw-info-box (generate-acreage-strings)) (setf redraw nil))) (if (zerop (controller-index (settlement (selected-sector)))) (set-state-to-menu)))) (when (sdl:key= key :sdl-key-left) (when (> cursor-x 0) (if (equalp cursor-x top-left-x) (decf top-left-x 1)) (decf cursor-x 1))) (when (sdl:key= key :sdl-key-right) (when (< cursor-x (- +map-size+ 1)) (if (equalp cursor-x (- (+ top-left-x max-tiles-x) 1)) (incf top-left-x 1)) (incf cursor-x 1))) (when (sdl:key= key :sdl-key-down) (when (< cursor-y (- +map-size+ 1)) (if (equalp cursor-y (- (+ top-left-y max-tiles-y) 1)) (incf top-left-y 1)) (incf cursor-y 1))) (when (sdl:key= key :sdl-key-up) (when (> cursor-y 0) (if (equalp cursor-y top-left-y) (decf top-left-y 1)) (decf cursor-y 1)))))) (defun load-graphics (the-selection-state) ;; (setf (aref (img-array the-selection-state) +grassland1+) ;; (sdl:load-image "interfaces/grassland1.png")) (setf (aref (img-array the-selection-state) +grassland2+) (sdl:load-image "interfaces/grassland2.png")) ;; (setf (aref (img-array the-selection-state) +grassland3+) ;; (sdl:load-image "interfaces/grassland3.png")) ;; (setf (aref (img-array the-selection-state) +grassland4+) ;; (sdl:load-image "interfaces/grassland4.png")) ;; (setf (aref (img-array the-selection-state) +desert1+) (sdl:load-image "interfaces/desert1.png")) (setf (aref (img-array the-selection-state) +desert2+) (sdl:load-image "interfaces/desert2.png")) (setf (aref (img-array the-selection-state) +forest1+) (sdl:load-image "interfaces/forest1.png")) (setf (aref (img-array the-selection-state) +mountain2+) (sdl:load-image "interfaces/mountain2.png")) (setf (aref (img-array the-selection-state) +mountain3+) (sdl:load-image "interfaces/mountain3.png")) (setf (aref (img-array the-selection-state) +hill1+) (sdl:load-image "interfaces/hill1.png")) (setf (aref (img-array the-selection-state) +hill2+) (sdl:load-image "interfaces/hill2.png")) ;; (setf (aref (img-array the-selection-state) +woodland1+) (sdl:load-image "interfaces/woodland1.png")) (setf (aref (img-array the-selection-state) +ocean1+) (sdl:load-image "interfaces/ocean1.png"))) ;; (setf (aref (img-array the-selection-state) +ocean2+) (sdl:load-image "interfaces/ocean2.png"))) (defmethod screen-resized ((game-state sector-selection-state)) (setf (max-tiles-x game-state) (floor (- *screenw* 220) 50)) (setf (max-tiles-y game-state) (floor (- *screenh* (+ 10 (sdl:char-height *font*))) 50))) ;;--------------------- changing states (defun set-state-to-menu () (with-slots (current-game-state the-menu-state) *the-world* (setf current-game-state the-menu-state (current-menu current-game-state) (root-menu current-game-state) (name (root-menu current-game-state)) (concatenate 'string "Sector: " (write-to-string (cursor-x *the-world*)) ", " (write-to-string (cursor-y *the-world*))))) (update-menu-elements)) (defun set-state-to-sector () (setf (current-game-state *the-world*) (the-sector-state *the-world*))) (defun set-state-to-input (title prompt-queue func) (clear-menu) (draw-title title 5 5) (setf (y-cor (the-input-state *the-world*)) (+ 5 (sdl:char-height *title-font*))) (if (input-type (first prompt-queue)) (draw-prompt (y-cor (the-input-state *the-world*)) (prompt-string (first prompt-queue)) (trailing-string (first prompt-queue)))) (setf (prompt-queue (the-input-state *the-world*)) prompt-queue) (setf (resulting-func (the-input-state *the-world*)) func) (push (current-game-state *the-world*) (queued-game-states *the-world*)) (setf (current-game-state *the-world*) (the-input-state *the-world*))) (defun next-game-state () (setf (current-game-state *the-world*) (pop (queued-game-states *the-world*))) (if (showing-alert? *the-world*) (progn (setf (showing-alert? *the-world*) nil) (next-alert))))
12,616
Common Lisp
.lisp
252
45.714286
105
0.67948
mike-1-2-3/EWRP6
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
19af6de187252ff1bddac003e139051647ef670dbccbe0badd60dcd4d356f335
26,184
[ -1 ]
26,185
sdl-interface.lisp
mike-1-2-3_EWRP6/interfaces/sdl-interface.lisp
#| Copyright (C) 2015 Mike Harris This program 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 3 of the License, or any later version. This program 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 this program. If not, see <http://www.gnu.org/licenses/>. |# ;;------------------------------------ sector stuff (defun draw-sector-title () (clear-menu) (sdl:draw-string-solid (concatenate 'string "Sector: " (write-to-string (cursor-x *the-world*)) ", " (write-to-string (cursor-y *the-world*))) (sdl:point :x 5 :y 5) :color sdl:*white* :font *title-font*) (let ((green (sdl:color :r 99 :g 250 :b 82))) (sdl:draw-string-solid "enter" (sdl:point :x 5 :y 30) :color green :font *font*) (sdl:draw-string-solid " - select" (sdl:point :x (+ 5 (* *char-width* 5)) :y 30) :color sdl:*white* :font *font*) (sdl:draw-string-solid "t" (sdl:point :x 5 :y (+ 30 *char-height* +line-spacing+)) :color green :font *font*) (sdl:draw-string-solid " - teleport" (sdl:point :x (+ 5 *char-width*) :y (+ 30 *char-height* +line-spacing+)) :color sdl:*white* :font *font*) (sdl:draw-string-solid "q" (sdl:point :x 5 :y (+ 30 (* 2 (+ +line-spacing+ *char-height*)))) :color green :font *font*) (sdl:draw-string-solid " - save and quit" (sdl:point :x (+ 5 *char-width*) :y (+ 30 (* 2 (+ +line-spacing+ *char-height*)))) :color sdl:*white* :font *font*))) (defun draw-sectors () (with-slots (img-array max-tiles-x max-tiles-y top-left-x top-left-y) (the-sector-state *the-world*) (sdl:draw-box (sdl:rectangle :x 210 :y 10 :w (* +tile-size+ max-tiles-x) :h (* +tile-size+ max-tiles-y)) :color sdl:*black*) (dotimes (y max-tiles-y) (dotimes (x max-tiles-x) (if (> (player-knowledge (get-sector (+ x top-left-x) (+ y top-left-y))) 0) (progn (sdl:draw-surface-at (aref img-array (tile-id (get-sector (+ x top-left-x) (+ y top-left-y)))) (sdl:point :x (+ (* x 50) 210) :y (+ (* y 50) 10))) (if (settlement (get-sector (+ x top-left-x) (+ y top-left-y))) (highlight-sector x y (color1 (get-owner (+ x top-left-x) (+ y top-left-y))) (color2 (get-owner (+ x top-left-x) (+ y top-left-y))))))))) (highlight-sector (- (cursor-x *the-world*) top-left-x) (- (cursor-y *the-world*) top-left-y) sdl:*yellow* (if (settlement (get-sector (cursor-x *the-world*) (cursor-y *the-world*))) (color2 (get-owner (cursor-x *the-world*) (cursor-y *the-world*))) (sdl:color :r 218 :g 165 :b 32))))) (defun highlight-sector (x-pos y-pos color1 color2) (let ((offset 49) (x1 (+ 210 (* x-pos 50))) (y1 (+ 10 (* y-pos 50)))) (sdl:draw-shape (list (sdl:point :x x1 :y y1) (sdl:point :x (+ offset x1) :y y1) (sdl:point :x (+ x1 offset) :y (+ y1 offset)) (sdl:point :x x1 :y (+ y1 offset)) (sdl:point :x x1 :y y1)) :color color1) (incf x1 1) (incf y1 1) (decf offset 2) (sdl:draw-shape (list (sdl:point :x x1 :y y1) (sdl:point :x (+ offset x1) :y y1) (sdl:point :x (+ x1 offset) :y (+ y1 offset)) (sdl:point :x x1 :y (+ y1 offset)) (sdl:point :x x1 :y y1)) :color color2) (incf x1 1) (incf y1 1) (decf offset 2) (sdl:draw-shape (list (sdl:point :x x1 :y y1) (sdl:point :x (+ offset x1) :y y1) (sdl:point :x (+ x1 offset) :y (+ y1 offset)) (sdl:point :x x1 :y (+ y1 offset)) (sdl:point :x x1 :y y1)) :color color1))) (defun teleport (y x) (with-slots (top-left-x top-left-y max-tiles-x max-tiles-y) (the-sector-state *the-world*) (with-slots (cursor-x cursor-y) *the-world* (if (and (>= x 0) (< x +map-size+)) (setf cursor-x x)) (if (and (>= y 0) (< y +map-size+)) (setf cursor-y y)) (if (> (- x (floor max-tiles-x 2)) 0) (if (< (+ x (ceiling max-tiles-x 2)) +map-size+) (setf top-left-x (- x (floor max-tiles-x 2))) (setf top-left-x (- +map-size+ max-tiles-x))) (setf top-left-x 0)) (if (> (- y (floor max-tiles-y 2)) 0) (if (< (+ y (ceiling max-tiles-y 2)) +map-size+) (setf top-left-y (- y (floor max-tiles-y 2))) (setf top-left-y (- +map-size+ max-tiles-y))) (setf top-left-y 0))))) ;;-------------------------------------------- message bar (defun message (text) (sdl:draw-box (sdl:rectangle :x 210 :y (- *screenh* (+ 2(sdl:char-height *font*))) :w (- *screenw* +menu-width+ 1) :h (sdl:char-height *font*)) :color sdl:*black*) (sdl:draw-string-solid text (sdl:point :x 210 :y (- *screenh* (+ 2 (sdl:char-height *font*)))) :color sdl:*white* :font *font*)) (defun draw-date () (sdl:draw-box (sdl:rectangle :x 5 :y (- *screenh* (+ 2(sdl:char-height *font*))) :w 200 :h (sdl:char-height *font*)) :color sdl:*black*) (sdl:draw-string-solid (concatenate 'string (write-to-string (month-num *the-world*)) "/" (write-to-string (day-num *the-world*)) "/" (write-to-string (year-num *the-world*)) " " (write-to-string (hour-num *the-world*)) ":00 ") (sdl:point :x 5 :y (- *screenh* (+ 2 (sdl:char-height *font*)))) :color sdl:*white* :font *font*)) (defun draw-loading-item (text x y) (sdl:draw-string-solid text (sdl:point :x x :y y) :color sdl:*white* :font *font*) (sdl:update-display)) ;;--------------------------------------------Menu stuff (defun clear-line (y) (sdl:draw-box (sdl:rectangle :x 5 :y y :w 200 :h (+ 2 (sdl:char-height *font*))) :color (sdl:color :r 0 :g 0 :b 60))) (defun draw-prompt (y-start text-1 text-2) (draw-menu-item text-1 sdl:*white* 5 y-start) (clear-line (+ y-start (sdl:char-height *font*) 2)) (draw-menu-item text-2 sdl:*white* 5 (+ 4 (* 2 (sdl:char-height *font*)) y-start))) (defun draw-menu-item (text color x y) (sdl:draw-string-solid text (sdl:point :x x :y y) :color color :font *font*)) (defun clear-menu () (sdl:draw-box (sdl:rectangle :x 2 :y 2 :w (- +menu-width+ 3) :h (- *screenh* (+ 2(sdl:char-height *font*)))) :color sdl:*black*)) (defun draw-title (text x y) (sdl:draw-string-solid text (sdl:point :x x :y y) :color sdl:*white* :font *title-font*)) (defmethod draw-menu-items ((m-items function) (first-elt integer) (selected integer) (max integer)) (draw-menu-items (funcall m-items) first-elt selected max)) (defmethod draw-menu-items ((m-items list) (first-elt integer) (selected integer) (max integer)) (let ((i 0) (y (+ 5 (sdl:char-height *title-font*)))) (dolist (item m-items) (if (and (>= i first-elt) (< i max)) (progn (if (equalp i selected) (draw-menu-item (get-name item) sdl:*yellow* 5 y) (draw-menu-item (get-name item) sdl:*white* 5 y)) (incf y (sdl:char-height *font*)))) (incf i 1)))) (defmethod draw-menu-items ((m-items array) (first-elt integer) (selected integer) (max integer)) (let ((y (+ 5 (sdl:char-height *title-font*)))) (if (< (length m-items) max) (setf max (length m-items))) (dotimes (i max) (progn (if (equalp i selected) (draw-menu-item (name (aref m-items i)) sdl:*yellow* 5 y) (draw-menu-item (name (aref m-items i)) sdl:*white* 5 y)) (incf y (sdl:char-height *font*)))))) (defun draw-menu (current-menu selected max first-elt) (clear-menu) (draw-title (name current-menu) 5 5) (draw-menu-items (items current-menu) first-elt selected max)) ;;-------------------- decorations (defun draw-borders () (sdl:draw-shape (list (sdl:point :x 1 :y 1) (sdl:point :x (1- *screenw*) :y 1) (sdl:point :x (1- *screenw*) :y (1- *screenh*)) (sdl:point :x 1 :y (1- *screenh*)) (sdl:point :x 1 :y 1)) :color sdl:*yellow*)) (defun draw-sector-border () (with-slots (max-tiles-x max-tiles-y) (the-sector-state *the-world*) (sdl:draw-shape (list (sdl:point :x (- +menu-width+ 1) :y 2) (sdl:point :x (- +menu-width+ 1) :y (- *screenh* 2))) :color (sdl:color :r 73 :g 95 :b 102)))) ;; ---------------------------- Info box (defun break-up-string (item) (let* ((max-chars (floor (- *screenw* (+ 45 235)) *char-width*)) (len (length item)) (new-strings) (cur-char 0) (end 0) (next-char 0)) (loop (if (> (+ cur-char max-chars) len) (progn (push (subseq item cur-char) new-strings) (return)) (setf end (+ cur-char max-chars))) (if (setf next-char (position #\ item :from-end t :start cur-char :end end)) (progn (push (subseq item cur-char next-char) new-strings)) (progn (push (subseq item next-char) new-strings) (return))) (setf cur-char (1+ next-char))) new-strings)) (defun draw-info-box (strings) (if (typep strings 'function) (setf strings (funcall strings))) (let* ((newstrings nil) (total-lines 0) (total-items (length strings)) (maxheight (- *screenh* 70)) (height 0) (cury 35)) (dolist (str strings) (if (typep str 'function) (setf str (funcall str))) (dolist (s (break-up-string str)) (push s newstrings) (incf total-lines 1)) (push nil newstrings)) (setf height (+ (* total-lines (+ 1 *char-height* )) (* total-items +line-spacing+))) (if (> height maxheight) (progn (setf height maxheight) (setf total-items (floor height (+ +line-spacing+ *char-height*))))) (sdl:draw-box (sdl:rectangle :x 235 :y 35 :w (- *screenw* 280) :h height) :color sdl:*black*) (sdl:draw-shape (list (sdl:point :x 235 :y 35) (sdl:point :x (- *screenw* 45) :y 35) (sdl:point :x (- *screenw* 45) :y (+ height 35)) (sdl:point :x 235 :y (+ height 35)) (sdl:point :x 235 :y 35)) :color sdl:*yellow*) (dolist (str newstrings) (if str (progn (sdl:draw-string-solid str (sdl:point :x (+ 235 +line-spacing+) :y cury) :color sdl:*white* :font *font*) (incf cury (+ 1 *char-height*))) (incf cury +line-spacing+)))))
10,501
Common Lisp
.lisp
253
36.011858
103
0.581847
mike-1-2-3/EWRP6
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
36bf09eca5199d4eba0e0e554838f5b10250025f0cb919b6df4ef26afe273be6
26,185
[ -1 ]
26,226
layers.asd
Leon-Focker_layers/layers.asd
(asdf:defsystem #:layers :version "0.1" :default-component-class "cl-source-file.lsp" :description "generative music library" :author "Leon Focker" :license "GNU General Public License v3.0" :depends-on (:cl-pcg :imago) ;(:clm :slippery-chicken) :serial t :components ((:file "src/all"))) ;; EOF layers.asd
324
Common Lisp
.asd
10
29.7
56
0.709265
Leon-Focker/layers
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
2c7949fe9973a74a8b38bac84f2adfc9b26c381859cccaa0a656e011a34de49e
26,226
[ -1 ]
26,227
sampler-cluster.pd
Leon-Focker_layers/pd/sampler-cluster.pd
#N canvas 886 252 850 482 12; #X obj 14 10 inlet; #X obj 50 129 metro 10; #X floatatom 50 242 5 0 0 0 - - - 0; #X obj 50 158 f 0; #X obj 60 184 + 10; #X msg 14 137 0; #X obj 50 101 r start; #X obj 50 403 s; #X obj 666 384 symbol; #X text 58 372 time since last sample was triggered; #X msg 666 358 clock-\$1; #X obj 50 210 / 1000; #X obj 603 268 inlet; #X obj 551 165 f; #X obj 583 165 + 1; #X floatatom 551 189 5 0 0 0 - - - 0; #X obj 516 150 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000; #X msg 583 139 0; #X obj 256 235 == 0; #X obj 217 260 spigot; #X obj 217 316 sampler; #X obj 297 260 spigot; #X obj 297 316 sampler; #X obj 375 260 spigot; #X obj 375 316 sampler; #X obj 455 260 spigot; #X obj 455 316 sampler; #X obj 336 235 == 1; #X obj 414 235 == 2; #X obj 494 235 == 3; #X obj 537 111 moses 4; #X obj 666 63 loadbang; #X obj 666 297 f \$1; #X floatatom 666 321 5 0 0 0 - - - 0; #X obj 397 101 spigot; #X obj 436 82 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000 0 1; #X obj 396 48 list split 9; #X obj 247 287 spigot; #X obj 327 287 spigot; #X obj 405 287 spigot; #X obj 485 287 spigot; #X obj 171 67 print sample; #X obj 367 131 t a b; #X obj 326 29 t a a; #X connect 0 0 5 0; #X connect 0 0 43 0; #X connect 1 0 3 0; #X connect 2 0 7 0; #X connect 3 0 4 0; #X connect 3 0 11 0; #X connect 4 0 3 1; #X connect 5 0 3 0; #X connect 6 0 1 0; #X connect 8 0 7 1; #X connect 10 0 8 0; #X connect 11 0 2 0; #X connect 12 0 37 0; #X connect 12 0 38 0; #X connect 12 0 39 0; #X connect 12 0 40 0; #X connect 13 0 14 0; #X connect 13 0 15 0; #X connect 13 0 30 0; #X connect 14 0 13 1; #X connect 15 0 18 0; #X connect 15 0 27 0; #X connect 15 0 28 0; #X connect 15 0 29 0; #X connect 16 0 13 0; #X connect 17 0 13 0; #X connect 18 0 19 1; #X connect 18 0 37 1; #X connect 19 0 20 0; #X connect 20 0 24 1; #X connect 21 0 22 0; #X connect 22 0 26 1; #X connect 23 0 24 0; #X connect 24 0 20 1; #X connect 25 0 26 0; #X connect 26 0 22 1; #X connect 27 0 21 1; #X connect 27 0 38 1; #X connect 28 0 23 1; #X connect 28 0 39 1; #X connect 29 0 25 1; #X connect 29 0 40 1; #X connect 30 1 17 0; #X connect 31 0 32 0; #X connect 31 0 35 0; #X connect 32 0 33 0; #X connect 32 0 26 3; #X connect 32 0 24 3; #X connect 32 0 20 3; #X connect 32 0 22 3; #X connect 33 0 10 0; #X connect 34 0 42 0; #X connect 35 0 34 1; #X connect 36 1 35 0; #X connect 37 0 20 2; #X connect 38 0 22 2; #X connect 39 0 24 2; #X connect 40 0 26 2; #X connect 42 0 19 0; #X connect 42 0 21 0; #X connect 42 0 23 0; #X connect 42 0 25 0; #X connect 42 1 16 0; #X connect 43 0 34 0; #X connect 43 1 36 0;
2,615
Common Lisp
.cl
112
22.348214
66
0.668797
Leon-Focker/layers
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
816182db9a25696e1fda82b1b1a6b30c05c59b927d7fa570e535cf60704b0bf6
26,227
[ -1 ]
26,228
export-with-clm.lsp
Leon-Focker_layers/src/export-with-clm.lsp
(in-package :ly) (defun swap-nth (n value ls) (loop for i from 0 and j in ls collect (if (= i n) value j))) ;; *** get-list-of-clm-calls ;;; get a list of lists, containing all information needed to feed ;;; Michael Edwards' samp1 and render layers as a .wav file (defun get-list-of-clm-calls (layers &key (reset-layers nil)) (when reset-layers (reset-layers layers)) (let* ((hm-layers (length (data layers))) (times (loop repeat hm-layers collect 0))) ; list of times the respective layers are at (prog1 (loop until break with break ;; check which layer has the minimal current time value for min-val = (apply #'min times) for index = (- hm-layers (length (member min-val times))) ;; get next sample for that layer for sample = (play-this (nth index (data layers)) :printing nil :output-for-unix t) collect (unless break (when sample (list (nth 1 sample) ; layer-id (nth index times) ; time (nth 2 sample) ; file (nth 3 sample) ; duration (nth 4 sample) ; start (nth 5 sample) ; attack (nth 6 sample) ; decay (nth 7 sample) ; amplitude (nth 8 sample) ; loop-flag (nth 10 sample)))) ; panorama ;; set new time value for the last played layer do (setf times (swap-nth index (+ (nth index times) (nth 3 sample)) times)) (when (>= min-val (* *total-duration* 0.995)) (setf break t))) (format t "~&getting calls for clm...") (when reset-layers (reset-layers layers))))) (in-package :clm) (let ((file "/home/leon/lisp/edwards/samp1.ins")) (if (probe-file file) (load (compile-file file)) (error "~&~a not found, please replace with your path to Michael Edwards~ samp1 instrument" file))) ;; *** calls-to-samp1 ;;; this is a helper function for layers-to-clm ;;; it can call itself recursively, which is why it needed to be seperate (defun calls-to-samp1 (calls ids) (loop for call in calls and i from 0 do (when (and (member (first call) ids) (not (equal (pathname-name (nth 2 call)) "rest"))) ;; get all parameters and name them (let* ((id (nth 0 call)) (time (nth 1 call)) (file (nth 2 call)) (dur (nth 3 call)) (start (nth 4 call)) (attack (/ (nth 5 call) 1000)) (decay (/ (nth 6 call) 1000)) (max-dur (- (clm::sound-duration file) start)) (duration (if (> dur max-dur) max-dur (+ dur decay 0.01))) (amplitude (nth 7 call)) (loop-flag (nth 8 call)) (call-again (and loop-flag (> dur max-dur))) (panorama (nth 9 call))) ;; samp1 would reverse the sound, not just loop it - that's why ;; sounds that are supposed to loop have to be called again: (when call-again (calls-to-samp1 (list (list id (+ time max-dur) file (- dur max-dur) 0 0.01 decay amplitude loop-flag panorama)) ids)) ;; call to samp1: (samp1 file time :duration duration :start start :amp-env (if call-again '(0 0 0.1 1 99.9 1 100 0) `(0 0 ,(* (/ attack (+ dur decay) 100)) 1 ,(* (/ dur (+ dur decay)) 100) 1 100.1 0)) :amp amplitude :degree panorama ;; to cope with samples of any samplerate: :srt (/ (clm::sound-srate file) 48000) ;;loop has to happen as a separate call ))))) ;; *** layers-to-clm ;;; gets a layers-object and renders out a soundfile (constant faders) (defun layers-to-clm (layers &optional list-of-layer-ids) (let* ((calls (ly::get-list-of-clm-calls layers)) (ids (if list-of-layer-ids list-of-layer-ids (ly::get-ids layers)))) (with-sound (:header-type mus-riff :sampling-rate 48000 :channels 2 :play nil :scaled-to 0.95 :output (concatenate 'string ly::*default-sample-dir* "layers.wav")) (calls-to-samp1 calls ids)))) (in-package :ly) (defun layers-to-clm (layers &optional list-of-layer-ids) (clm::layers-to-clm layers list-of-layer-ids))
4,142
Common Lisp
.cl
109
31.587156
89
0.602236
Leon-Focker/layers
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
999ac14d3aace237c3b34520fbb227106d2e866825c19ac239d594c458db67d5
26,228
[ -1 ]
26,230
3-4-1-2-datei-spielen.pd
Leon-Focker_layers/pd/3-4-1-2-datei-spielen.pd
#N canvas 520 326 585 427 12; #X msg 58 85 open voice.wav; #X msg 182 108 start; #X msg 183 132 stop; #X obj 191 219 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 58 264 dac~; #X obj 58 221 *~ 0.7; #X obj 58 189 readsf~ 2; #X obj 115 221 *~ 0.7; #X text 45 18 3.4.1.2. datei abspielen; #X text 358 340 Johannes Kreidler; #X text 349 366 www.pd-tutorial.com; #X connect 0 0 6 0; #X connect 1 0 6 0; #X connect 2 0 6 0; #X connect 5 0 4 0; #X connect 6 0 5 0; #X connect 6 1 7 0; #X connect 6 2 3 0; #X connect 7 0 4 1;
558
Common Lisp
.l
21
24.571429
69
0.64432
Leon-Focker/layers
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
fb7c05038acdc779d8829e887cc9960f8849013d14c1921e94065ac85f977c65
26,230
[ -1 ]
26,231
old-sampler.pd
Leon-Focker_layers/pd/old-sampler.pd
#N canvas 1991 106 1275 762 12; #X obj 116 19 inlet; #X obj 116 44 unpack s f f f f f f s f, f 117; #X text 122 66 file; #X text 335 66 start; #X text 428 67 attack; #X text 539 69 decay; #X text 638 68 amp; #X text 738 67 loop?; #X text 838 69 id; #X text 944 68 pan; #X text 231 67 length; #X obj 116 207 del 0; #X obj 116 239 t b b; #X obj 160 206 pack s f; #X msg 160 234 set open \$1 \$2; #X msg 160 258 open E:/code/layers/samples/one-shots/drums/kick1.wav 14400; #X obj 160 611 readsf~ 2, f 16; #X symbolatom 830 549 10 0 0 0 - - -; #X msg 1050 555 play-\$1; #X obj 1050 581 symbol; #X msg 1050 666 set layer\$1; #X obj 766 685 throw~; #X obj 830 574 s; #X msg 848 495 id\$1; #X obj 848 523 symbol; #X obj 215 639 *~; #X obj 160 639 *~; #X obj 215 665 *~; #X obj 160 665 *~; #X obj 269 695 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 995 532 symbol; #X msg 995 508 panning-\$1; #X obj 932 553 s; #X obj 1050 476 f; #X obj 1050 447 inlet; #X obj 116 91 t b s b, f 13; #X obj 218 91 * 1000; #X obj 116 318 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X msg 116 521 start; #X obj 58 142 / 1000; #X msg 58 517 0; #X msg 200 498 stop; #X text 293 392 length; #X text 295 432 decay; #X obj 345 456 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 200 471 del 5; #X obj 422 540 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X msg 422 600 1 10; #X obj 291 619 line~; #X obj 356 138 spigot; #X obj 58 97 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1 ; #X obj 320 161 +; #X obj 320 187 * 48000; #X msg 422 487 set 1 \$1; #X msg 345 600 0 5; #X msg 524 487 set 0 \$1; #X obj 524 416 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 626 593 f; #X obj 626 645 line~; #X obj 728 695 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 24 710 spigot; #X text 1100 446 sampler id input; #X obj 770 600 s; #X obj 770 431 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 385 473 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X floatatom 10 171 5 0 0 0 - - -; #X msg 58 540 5; #X msg 524 600 0 500; #X obj 524 208 moses 5; #X msg 524 234 5; #X msg 626 619 \$1 30; #N canvas 421 321 592 398 timer 0; #X obj 83 239 outlet; #X obj 10 9 inlet; #X floatatom 165 202 10 0 0 0 - - -; #X obj 101 9 inlet; #X text 144 9 length; #X text 52 7 start; #X obj 10 69 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1 ; #X obj 83 109 f; #X obj 165 155 / 1000; #X msg 10 35 1; #X msg 46 35 0; #X floatatom 115 44 5 0 0 0 - - -; #X obj 226 9 inlet; #X text 274 8 incf; #X obj 83 134 moses 0; #X obj 226 108 +; #X obj 170 44 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 226 35 * 1000; #X obj 10 88 metro 10; #X obj 111 109 - 10; #X msg 339 80 0; #X obj 339 11 r start; #X obj 339 37 select 0; #X obj 339 62 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X connect 1 0 9 0; #X connect 3 0 7 1; #X connect 3 0 11 0; #X connect 6 0 18 0; #X connect 7 0 14 0; #X connect 7 0 15 1; #X connect 7 0 19 0; #X connect 8 0 2 0; #X connect 9 0 6 0; #X connect 10 0 6 0; #X connect 10 0 15 0; #X connect 11 0 7 1; #X connect 12 0 17 0; #X connect 14 0 0 0; #X connect 14 0 10 0; #X connect 14 1 8 0; #X connect 15 0 7 1; #X connect 16 0 11 0; #X connect 17 0 15 0; #X connect 18 0 7 0; #X connect 19 0 7 1; #X connect 20 0 7 0; #X connect 21 0 22 0; #X connect 22 0 23 0; #X connect 23 0 20 0; #X coords 0 -1 1 1 140 25 1 100 200; #X restore 152 391 pd timer; #X obj 24 239 t b b; #X obj 285 348 inlet; #N canvas 168 247 592 398 timer 0; #X obj 83 239 outlet; #X obj 10 9 inlet; #X floatatom 165 202 10 0 0 0 - - -; #X obj 101 9 inlet; #X text 144 9 length; #X text 52 7 start; #X obj 10 69 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1 ; #X obj 83 109 f; #X obj 165 155 / 1000; #X msg 10 35 1; #X msg 46 35 0; #X floatatom 115 44 5 0 0 0 - - -; #X obj 226 9 inlet; #X text 274 8 incf; #X obj 10 88 metro 10; #X obj 111 109 - 10; #X obj 83 134 moses 0; #X obj 226 108 +; #X connect 1 0 9 0; #X connect 3 0 7 1; #X connect 3 0 11 0; #X connect 6 0 14 0; #X connect 7 0 15 0; #X connect 7 0 16 0; #X connect 7 0 17 1; #X connect 8 0 2 0; #X connect 9 0 6 0; #X connect 10 0 6 0; #X connect 12 0 17 0; #X connect 14 0 7 0; #X connect 15 0 7 1; #X connect 16 0 0 0; #X connect 16 0 10 0; #X connect 16 1 8 0; #X connect 17 0 7 1; #X coords 0 -1 1 1 140 25 1 100 200; #X restore 151 431 pd timer; #X obj 355 360 r start; #X obj 355 386 select 0; #X connect 0 0 1 0; #X connect 1 0 35 0; #X connect 1 1 36 0; #X connect 1 2 51 0; #X connect 1 3 53 0; #X connect 1 4 68 0; #X connect 1 5 57 0; #X connect 1 6 59 0; #X connect 1 7 17 0; #X connect 1 8 32 0; #X connect 11 0 12 0; #X connect 12 0 37 0; #X connect 12 1 15 0; #X connect 13 0 14 0; #X connect 14 0 15 0; #X connect 15 0 16 0; #X connect 16 0 26 0; #X connect 16 1 25 0; #X connect 16 2 29 0; #X connect 17 0 22 0; #X connect 18 0 19 0; #X connect 19 0 62 1; #X connect 20 0 21 0; #X connect 23 0 24 0; #X connect 24 0 22 1; #X connect 25 0 27 0; #X connect 26 0 28 0; #X connect 27 0 21 0; #X connect 28 0 21 0; #X connect 29 0 60 0; #X connect 30 0 32 1; #X connect 31 0 30 0; #X connect 33 0 18 0; #X connect 33 0 20 0; #X connect 33 0 23 0; #X connect 33 0 31 0; #X connect 34 0 33 0; #X connect 35 0 11 0; #X connect 35 1 13 0; #X connect 35 2 49 0; #X connect 36 0 71 1; #X connect 37 0 38 0; #X connect 37 0 71 0; #X connect 38 0 16 0; #X connect 38 0 66 0; #X connect 38 0 46 0; #X connect 39 0 51 1; #X connect 40 0 65 0; #X connect 41 0 40 0; #X connect 41 0 16 0; #X connect 44 0 45 0; #X connect 44 0 54 0; #X connect 45 0 41 0; #X connect 46 0 47 0; #X connect 47 0 48 0; #X connect 48 0 25 1; #X connect 48 0 26 1; #X connect 49 0 64 0; #X connect 50 0 49 1; #X connect 51 0 52 0; #X connect 52 0 13 1; #X connect 53 0 47 0; #X connect 54 0 48 0; #X connect 55 0 67 0; #X connect 56 0 67 0; #X connect 56 0 63 0; #X connect 56 0 74 0; #X connect 57 0 70 0; #X connect 58 0 27 1; #X connect 58 0 28 1; #X connect 59 0 60 1; #X connect 60 0 72 0; #X connect 63 0 62 0; #X connect 64 0 54 0; #X connect 65 0 39 0; #X connect 65 0 50 0; #X connect 65 0 11 1; #X connect 66 0 65 0; #X connect 67 0 48 0; #X connect 68 0 69 0; #X connect 68 1 55 0; #X connect 68 1 74 1; #X connect 69 0 55 0; #X connect 69 0 74 1; #X connect 70 0 58 0; #X connect 71 0 56 0; #X connect 72 0 38 0; #X connect 72 1 15 0; #X connect 73 0 71 2; #X connect 73 0 74 2; #X connect 74 0 44 0; #X connect 75 0 76 0; #X connect 76 0 44 0;
6,517
Common Lisp
.l
273
22.871795
68
0.664798
Leon-Focker/layers
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
d1dc6776cc5d71db852c2070bafe78787d6755c8912ebf2d54328bac81d98564
26,231
[ -1 ]
26,233
osc-sc-eval.pd
Leon-Focker_layers/pd/osc-sc-eval.pd
#N canvas 712 366 600 460 10; #X obj 13 163 mrpeach/udpsend; #X obj 13 138 mrpeach/packOSC; #X obj 12 216 mrpeach/unpackOSC; #X obj 130 46 loadbang; #X obj 130 69 f \$0; #X obj 12 47 inlet; #X obj 12 352 outlet; #X obj 13 90 pack s f; #X obj 216 267 loadbang; #X obj 216 290 f \$0; #X obj 12 329 route osc; #X msg 217 312 symbol OSC-SC-EVAL-\$1; #X msg 13 113 send (/osc-sc osc-sc-eval-\$2 \$1); #X obj 12 238 symbol; #X obj 12 282 route list /OSC-SC; #X obj 12 305 route /OSC-SC; #X text 6 7 OSC<->SC example patch courtesy of Simon Bahr.This needs the zexy and mrpeach libraries.; #N canvas 0 96 450 300 l2s 0; #X obj 23 516 list tosymbol; #X obj 86 203 list fromsymbol; #X obj 86 149 list split 1; #X obj 86 99 until; #X obj 86 124 list append; #X obj 180 149 bang; #X obj 86 362 list prepend; #X obj 200 362 t a; #X obj 23 393 list append; #X obj 86 338 list append 32; #X obj 23 49 t b b a b, f 27; #X obj 86 177 makefilename %s; #X obj 23 21 inlet; #X obj 23 540 outlet; #X obj 167 312 list fromsymbol; #X obj 167 262 list append \$1; #X obj 167 237 loadbang; #X obj 205 21 inlet; #X obj 205 49 symbol; #X obj 167 285 route symbol; #X obj 23 417 t l l, f 10; #X obj 80 443 list length; #X obj 23 491 list split; #X obj 80 467 - 1; #X connect 0 0 13 0; #X connect 1 0 9 0; #X connect 2 0 11 0; #X connect 2 1 4 1; #X connect 2 2 5 0; #X connect 3 0 4 0; #X connect 4 0 2 0; #X connect 5 0 3 1; #X connect 6 0 7 0; #X connect 6 0 8 1; #X connect 7 0 6 1; #X connect 8 0 20 0; #X connect 9 0 6 0; #X connect 10 0 8 0; #X connect 10 1 3 0; #X connect 10 2 4 1; #X connect 10 3 6 1; #X connect 10 3 8 1; #X connect 11 0 1 0; #X connect 12 0 10 0; #X connect 14 0 9 1; #X connect 15 0 19 0; #X connect 16 0 15 0; #X connect 17 0 18 0; #X connect 18 0 14 0; #X connect 19 0 14 0; #X connect 20 0 22 0; #X connect 20 1 21 0; #X connect 21 0 23 0; #X connect 22 0 0 0; #X connect 23 0 22 1; #X restore 12 68 pd l2s; #N canvas 0 96 450 300 s2l 0; #X obj 105 281 list fromsymbol; #X obj 72 175 list split 1; #X obj 72 118 until; #X obj 72 146 list append; #X obj 188 363 t l; #X obj 105 363 list prepend; #X obj 39 390 list append; #X obj 39 363 spigot; #X obj 72 332 f 1; #X obj 105 332 t f b; #X obj 12 363 f 0; #X obj 39 414 route bang; #X obj 96 461 list prepend; #X obj 96 437 list tosymbol; #X obj 72 306 sel 32; #X obj 105 231 list append \$1; #X obj 105 206 loadbang; #X obj 33 63 list fromsymbol; #X obj 33 38 symbol; #X obj 33 12 inlet; #X obj 33 484 list append; #X obj 172 175 bang; #X obj 33 85 t b b l b, f 20; #X obj 178 461 t a; #X obj 33 511 outlet; #X obj 105 254 route symbol; #X obj 173 38 symbol; #X obj 173 12 inlet; #X connect 0 0 14 1; #X connect 1 0 14 0; #X connect 1 1 3 1; #X connect 1 2 21 0; #X connect 2 0 3 0; #X connect 3 0 1 0; #X connect 4 0 5 1; #X connect 5 0 4 0; #X connect 5 0 6 1; #X connect 6 0 11 0; #X connect 7 0 6 0; #X connect 7 0 5 1; #X connect 7 0 10 0; #X connect 8 0 7 1; #X connect 9 0 5 0; #X connect 9 1 7 0; #X connect 10 0 7 1; #X connect 11 1 13 0; #X connect 12 0 20 1; #X connect 12 0 23 0; #X connect 13 0 12 0; #X connect 14 0 8 0; #X connect 14 1 9 0; #X connect 15 0 25 0; #X connect 16 0 15 0; #X connect 17 0 22 0; #X connect 18 0 17 0; #X connect 19 0 18 0; #X connect 20 0 24 0; #X connect 21 0 6 0; #X connect 21 0 2 1; #X connect 22 0 20 0; #X connect 22 1 2 0; #X connect 22 2 3 1; #X connect 22 3 5 1; #X connect 22 3 12 1; #X connect 22 3 6 1; #X connect 22 3 20 1; #X connect 23 0 12 1; #X connect 25 0 0 0; #X connect 26 0 0 0; #X connect 27 0 26 0; #X restore 12 260 pd s2l; #X obj 12 192 mrpeach/udpreceive 5000; #X obj 50 47 r send-to-sc; #X obj 414 121 pack s f; #X msg 459 97 5000; #X obj 396 96 symbol; #X msg 414 142 connect \$1 \$2; #X obj 396 71 r ip; #X obj 459 73 r port; #X connect 1 0 0 0; #X connect 2 0 13 0; #X connect 3 0 4 0; #X connect 4 0 7 1; #X connect 5 0 17 0; #X connect 7 0 12 0; #X connect 8 0 9 0; #X connect 9 0 11 0; #X connect 10 0 6 0; #X connect 11 0 10 1; #X connect 12 0 1 0; #X connect 13 0 18 0; #X connect 14 0 15 0; #X connect 15 0 10 0; #X connect 17 0 7 0; #X connect 18 0 14 0; #X connect 19 0 2 0; #X connect 20 0 17 0; #X connect 21 0 24 0; #X connect 22 0 21 1; #X connect 23 0 21 0; #X connect 24 0 0 0; #X connect 25 0 23 0; #X connect 26 0 22 0;
4,264
Common Lisp
.l
180
22.688889
68
0.678012
Leon-Focker/layers
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
482cbb454de4b795f7fadb9b1e57160b626c1f7e36257186d210e2df7f38e794
26,233
[ -1 ]
26,234
sampler-backup.pd
Leon-Focker_layers/pd/sampler-backup.pd
#N canvas 565 103 1261 808 12; #X obj 116 19 inlet; #X obj 116 44 unpack s f f f f f f s f, f 117; #X text 122 66 file; #X text 335 66 start; #X text 428 67 attack; #X text 539 69 decay; #X text 638 68 amp; #X text 738 67 loop?; #X text 838 69 id; #X text 928 68 pan; #X text 231 67 length; #X obj 116 209 del 0; #X obj 116 239 t b b; #X obj 160 208 pack s f; #X msg 160 234 set open \$1 \$2; #X msg 160 260 open E:/code/layers/samples/no-input/accents/accent9.wav 240; #X obj 160 682 readsf~ 2, f 16; #X symbolatom 830 620 10 0 0 0 - - -; #X msg 1050 626 play-\$1; #X obj 1050 652 symbol; #X msg 1050 737 set layer\$1; #X obj 766 758 throw~; #X obj 830 645 s; #X msg 848 568 id\$1; #X obj 848 594 symbol; #X obj 215 710 *~; #X obj 160 710 *~; #X obj 215 736 *~; #X obj 160 736 *~; #X obj 269 766 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 995 603 symbol; #X msg 995 579 panning-\$1; #X obj 932 624 s; #X obj 1050 547 f; #X obj 1050 518 inlet; #X obj 116 91 t b s b, f 13; #X obj 218 91 * 1000; #X obj 116 318 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X msg 116 453 start; #X obj 58 140 / 1000; #X msg 58 451 0; #X msg 200 430 stop; #X obj 200 333 del; #X obj 200 369 del; #X text 228 333 length; #X text 232 370 decay; #X obj 345 390 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 200 405 del 5; #X obj 422 474 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X msg 422 669 1 10; #X obj 291 690 line~; #X obj 345 112 spigot; #X obj 58 97 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1 ; #X obj 320 161 +; #X obj 320 187 * 48000; #X msg 422 421 set 1 \$1; #X msg 345 669 0 5; #X msg 524 669 0 500; #X msg 524 421 set 0 \$1; #X obj 524 354 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 626 664 f; #X msg 626 690 \$1 10; #X obj 626 716 line~; #X obj 728 766 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 24 781 spigot; #X obj 24 194 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X text 1100 517 sampler id input; #X obj 770 673 s; #X obj 770 369 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 345 415 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X floatatom 58 189 5 0 0 0 - - -; #X msg 58 474 5; #X connect 0 0 1 0; #X connect 1 0 35 0; #X connect 1 1 36 0; #X connect 1 2 53 0; #X connect 1 3 55 0; #X connect 1 4 58 0; #X connect 1 4 43 1; #X connect 1 5 60 0; #X connect 1 6 63 0; #X connect 1 7 17 0; #X connect 1 8 32 0; #X connect 11 0 12 0; #X connect 12 0 37 0; #X connect 12 1 15 0; #X connect 13 0 14 0; #X connect 14 0 15 0; #X connect 15 0 16 0; #X connect 16 0 26 0; #X connect 16 1 25 0; #X connect 16 2 29 0; #X connect 17 0 22 0; #X connect 18 0 19 0; #X connect 19 0 67 1; #X connect 20 0 21 0; #X connect 23 0 24 0; #X connect 24 0 22 1; #X connect 25 0 27 0; #X connect 26 0 28 0; #X connect 27 0 21 0; #X connect 28 0 21 0; #X connect 29 0 64 0; #X connect 30 0 32 1; #X connect 31 0 30 0; #X connect 33 0 18 0; #X connect 33 0 20 0; #X connect 33 0 23 0; #X connect 33 0 31 0; #X connect 34 0 33 0; #X connect 35 0 11 0; #X connect 35 1 13 0; #X connect 35 2 51 0; #X connect 36 0 42 1; #X connect 37 0 38 0; #X connect 37 0 42 0; #X connect 38 0 16 0; #X connect 38 0 71 0; #X connect 38 0 48 0; #X connect 39 0 53 1; #X connect 40 0 70 0; #X connect 41 0 40 0; #X connect 41 0 16 0; #X connect 42 0 59 0; #X connect 43 0 46 0; #X connect 46 0 47 0; #X connect 46 0 56 0; #X connect 47 0 41 0; #X connect 48 0 49 0; #X connect 49 0 50 0; #X connect 50 0 25 1; #X connect 50 0 26 1; #X connect 51 0 69 0; #X connect 52 0 51 1; #X connect 53 0 54 0; #X connect 54 0 13 1; #X connect 55 0 49 0; #X connect 56 0 50 0; #X connect 57 0 50 0; #X connect 58 0 57 0; #X connect 59 0 43 0; #X connect 59 0 57 0; #X connect 59 0 68 0; #X connect 60 0 61 0; #X connect 61 0 62 0; #X connect 62 0 27 1; #X connect 62 0 28 1; #X connect 63 0 64 1; #X connect 64 0 65 0; #X connect 65 0 11 0; #X connect 68 0 67 0; #X connect 69 0 56 0; #X connect 70 0 39 0; #X connect 70 0 52 0; #X connect 70 0 11 1; #X connect 71 0 70 0;
4,095
Common Lisp
.l
168
23.375
71
0.669213
Leon-Focker/layers
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
8494103fe82a4ce830fb00431a0e08c77cc74c90af8dd659e6c6bbad224de08e
26,234
[ -1 ]
26,235
balance.pd
Leon-Focker_layers/pd/balance.pd
#N canvas 0 50 377 265 12; #X obj 34 152 cos~; #X obj 83 154 cos~; #X obj 185 67 hsl 100 15 0 0.25 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 4950 1; #X obj 16 178 *~; #X obj 65 180 *~; #X obj 182 10 loadbang; #X msg 182 34 0.125; #X obj 29 217 dac~; #X obj 15 10 inlet~; #X obj 64 10 inlet~; #X obj 114 10 inlet; #X obj 278 133 +~ 0.75; #X msg 182 87 \$1 10; #X obj 182 113 line~; #X connect 0 0 3 1; #X connect 1 0 4 1; #X connect 2 0 12 0; #X connect 3 0 7 0; #X connect 4 0 7 1; #X connect 5 0 6 0; #X connect 6 0 2 0; #X connect 8 0 3 0; #X connect 9 0 4 0; #X connect 10 0 2 0; #X connect 11 0 1 0; #X connect 12 0 13 0; #X connect 13 0 0 0; #X connect 13 0 11 0;
674
Common Lisp
.l
30
21.466667
72
0.641304
Leon-Focker/layers
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
b7c69c6e809f5ecc4532f6d85221f2fdac830f65a990e7ba3cf53823755bc7eb
26,235
[ -1 ]
26,236
sample-pair.pd
Leon-Focker_layers/pd/sample-pair.pd
#N canvas 95 367 897 432 12; #X obj 14 195 spigot; #X obj 53 178 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1; #X obj 84 194 spigot; #X obj 123 177 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 1; #X obj 176 158 loadbang; #X obj 78 116 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X obj 14 10 inlet; #X obj 176 184 f \$1; #X obj 15 318 sampler; #X obj 87 318 sampler; #X floatatom 176 210 5 0 0 0 - - -; #X obj 439 76 metro 10; #X floatatom 439 189 5 0 0 0 - - -; #X obj 439 105 f 0; #X obj 449 131 + 10; #X msg 403 84 0; #X obj 439 48 r start; #X obj 439 273 s; #X obj 365 254 symbol; #X text 451 234 time since last sample was triggered; #X msg 365 228 clock-\$1; #X obj 136 29 list split 9; #X obj 111 97 spigot; #X obj 176 82 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 1; #X obj 439 157 / 1000; #X obj 272 164 inlet; #X obj 234 242 spigot; #X obj 287 242 spigot; #X connect 0 0 8 0; #X connect 1 0 0 1; #X connect 1 0 26 1; #X connect 2 0 9 0; #X connect 3 0 2 1; #X connect 3 0 27 1; #X connect 4 0 3 0; #X connect 4 0 7 0; #X connect 4 0 23 0; #X connect 5 0 3 0; #X connect 5 0 1 0; #X connect 6 0 0 0; #X connect 6 0 2 0; #X connect 6 0 21 0; #X connect 6 0 15 0; #X connect 6 0 22 0; #X connect 7 0 10 0; #X connect 7 0 8 3; #X connect 7 0 9 3; #X connect 8 0 9 1; #X connect 9 0 8 1; #X connect 10 0 20 0; #X connect 11 0 13 0; #X connect 12 0 17 0; #X connect 13 0 14 0; #X connect 13 0 24 0; #X connect 14 0 13 1; #X connect 15 0 13 0; #X connect 16 0 11 0; #X connect 18 0 17 1; #X connect 20 0 18 0; #X connect 21 1 23 0; #X connect 22 0 5 0; #X connect 23 0 22 1; #X connect 24 0 12 0; #X connect 25 0 26 0; #X connect 25 0 27 0; #X connect 26 0 8 2; #X connect 27 0 9 2;
1,729
Common Lisp
.l
72
23.013889
68
0.667471
Leon-Focker/layers
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
9bc61fde9f88ea5c1cb792058889e59f365e77015b70704f94c36d96907e4d2c
26,236
[ -1 ]
26,237
sampler.pd
Leon-Focker_layers/pd/sampler.pd
#N canvas 227 77 1657 852 12; #X obj 116 19 inlet; #X obj 116 44 unpack s f f f f f f s f, f 117; #X text 122 66 file; #X text 335 66 start; #X text 428 67 attack; #X text 539 69 decay; #X text 638 68 amp; #X text 738 67 loop?; #X text 838 69 id; #X text 944 68 pan; #X text 231 67 length; #X obj 116 207 del 0; #X obj 116 239 t b b; #X obj 160 172 pack s f; #X msg 160 268 set open \$1 \$2; #X msg 160 292 open E:/code/layers/samples/phrases/drums/drumloops9.wav 0; #X obj 160 639 readsf~ 2, f 16; #X symbolatom 830 577 10 0 0 0 - - - 0; #X msg 1050 694 set layer\$1; #X obj 766 713 throw~; #X obj 830 602 s; #X msg 848 523 id\$1; #X obj 848 551 symbol; #X obj 215 667 *~; #X obj 160 667 *~; #X obj 215 693 *~; #X obj 160 693 *~; #X obj 269 723 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000; #X obj 995 560 symbol; #X msg 995 536 panning-\$1; #X obj 932 579 s; #X obj 1050 504 f; #X obj 1050 475 inlet; #X obj 116 91 t b s b, f 13; #X obj 218 91 * 1000; #X obj 116 318 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000; #X msg 116 549 start; #X text 293 392 length; #X text 295 460 decay; #X obj 353 484 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000; #X obj 435 568 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000; #X msg 422 608 1 10; #X obj 291 647 line~; #X obj 271 197 spigot; #X obj 320 127 +; #X obj 320 153 * 48000; #X msg 422 515 set 1 \$1; #X msg 353 608 0 5; #X msg 524 515 set 0 \$1; #X obj 546 444 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000; #X obj 626 621 f; #X obj 626 673 line~; #X obj 728 723 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000 0 1; #X obj 24 738 spigot; #X text 1100 474 sampler id input; #X msg 524 608 0 100; #X obj 524 208 moses 5; #X msg 524 234 5; #X msg 626 647 \$1 30; #N canvas 616 343 592 398 timer 0; #X obj 83 239 outlet; #X obj 10 9 inlet; #X floatatom 165 202 10 0 0 0 - - - 0; #X obj 101 9 inlet; #X text 144 9 length; #X text 52 7 start; #X obj 10 69 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000 0 1; #X obj 83 109 f; #X obj 165 155 / 1000; #X msg 10 35 1; #X msg 46 35 0; #X floatatom 115 44 5 0 0 0 - - - 0; #X obj 226 9 inlet; #X text 274 8 incf; #X obj 83 134 moses 0; #X obj 226 108 +; #X obj 170 44 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000; #X obj 226 35 * 1000; #X obj 10 88 metro 10; #X obj 111 109 - 10; #X msg 344 86 0; #X obj 344 17 r start; #X obj 344 43 select 0; #X obj 344 68 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000; #X connect 1 0 9 0; #X connect 3 0 7 1; #X connect 3 0 11 0; #X connect 6 0 18 0; #X connect 7 0 14 0; #X connect 7 0 15 1; #X connect 7 0 19 0; #X connect 8 0 2 0; #X connect 9 0 6 0; #X connect 10 0 6 0; #X connect 10 0 15 0; #X connect 11 0 7 1; #X connect 12 0 17 0; #X connect 14 0 0 0; #X connect 14 0 10 0; #X connect 14 1 8 0; #X connect 15 0 7 1; #X connect 16 0 11 0; #X connect 17 0 15 0; #X connect 18 0 7 0; #X connect 19 0 7 1; #X connect 21 0 22 0; #X connect 22 0 23 0; #X connect 23 0 20 0; #X coords 0 -1 1 1 140 25 1 100 200; #X restore 152 392 pd timer; #X obj 24 273 t b b; #N canvas 973 287 592 398 timer 0; #X obj 83 239 outlet; #X obj 10 9 inlet; #X floatatom 165 202 10 0 0 0 - - - 0; #X obj 101 9 inlet; #X text 144 9 length; #X text 52 7 start; #X obj 10 69 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000 0 1; #X obj 83 109 f; #X obj 165 155 / 1000; #X msg 10 35 1; #X msg 46 35 0; #X floatatom 115 44 5 0 0 0 - - - 0; #X obj 226 9 inlet; #X text 274 8 incf; #X obj 10 88 metro 10; #X obj 83 134 moses 0; #X obj 226 108 +; #X obj 111 109 - 10; #X connect 1 0 9 0; #X connect 3 0 7 1; #X connect 3 0 11 0; #X connect 6 0 14 0; #X connect 7 0 15 0; #X connect 7 0 16 1; #X connect 7 0 17 0; #X connect 8 0 2 0; #X connect 9 0 6 0; #X connect 10 0 6 0; #X connect 12 0 16 0; #X connect 14 0 7 0; #X connect 15 0 0 0; #X connect 15 0 10 0; #X connect 15 1 8 0; #X connect 16 0 7 1; #X connect 17 0 7 1; #X coords 0 -1 1 1 140 25 1 100 200; #X restore 151 459 pd timer; #X obj 353 360 r start; #X obj 353 386 select 0; #X obj 454 354 inlet; #X text 428 334 new trigger; #X obj 454 399 t b f; #X obj 452 196 outlet; #X obj 208 499 del 5; #X msg 208 523 stop; #X obj 25 182 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000 0 1; #X floatatom 65 214 5 0 0 0 - - - 0; #X obj 65 108 / 1000; #X msg 65 542 0; #X msg 65 568 5; #X obj 546 417 spigot; #X msg 585 333 1; #X msg 596 417 0; #X obj 452 110 - 100; #X obj 452 134 moses 5; #X msg 452 158 5; #X text 9 157 playing?; #X obj 728 743 == 0; #X obj 728 768 tgl 15 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000 0 1; #X obj 65 783 spigot; #X obj 965 169 inlet; #X obj 965 193 unpack f f; #X obj 1032 227 moses; #X text 1020 171 set-n; #X floatatom 1050 60 5 0 0 0 - - - 0; #X obj 1051 375 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000; #X obj 454 378 del 1; #X connect 0 0 1 0; #X connect 1 0 33 0; #X connect 1 1 34 0; #X connect 1 2 44 0; #X connect 1 3 46 0; #X connect 1 4 56 0; #X connect 1 4 89 0; #X connect 1 5 50 0; #X connect 1 6 52 0; #X connect 1 7 17 0; #X connect 1 8 30 0; #X connect 11 0 12 0; #X connect 12 0 35 0; #X connect 12 1 15 0; #X connect 13 0 14 0; #X connect 14 0 15 0; #X connect 15 0 16 0; #X connect 16 0 24 0; #X connect 16 1 23 0; #X connect 16 2 27 0; #X connect 17 0 20 0; #X connect 18 0 19 0; #X connect 21 0 22 0; #X connect 22 0 20 1; #X connect 23 0 25 0; #X connect 24 0 26 0; #X connect 25 0 19 0; #X connect 26 0 19 0; #X connect 27 0 53 0; #X connect 27 0 84 0; #X connect 28 0 30 1; #X connect 29 0 28 0; #X connect 31 0 18 0; #X connect 31 0 21 0; #X connect 31 0 29 0; #X connect 32 0 31 0; #X connect 33 0 11 0; #X connect 33 1 13 0; #X connect 33 2 43 0; #X connect 34 0 59 1; #X connect 34 0 78 0; #X connect 35 0 36 0; #X connect 35 0 59 0; #X connect 35 0 76 0; #X connect 36 0 16 0; #X connect 36 0 40 0; #X connect 36 0 74 0; #X connect 39 0 68 0; #X connect 39 0 47 0; #X connect 40 0 41 0; #X connect 41 0 42 0; #X connect 42 0 23 1; #X connect 42 0 24 1; #X connect 43 0 39 0; #X connect 44 0 45 0; #X connect 45 0 13 1; #X connect 46 0 41 0; #X connect 47 0 42 0; #X connect 48 0 55 0; #X connect 49 0 55 0; #X connect 49 0 61 0; #X connect 50 0 58 0; #X connect 51 0 25 1; #X connect 51 0 26 1; #X connect 52 0 53 1; #X connect 52 0 82 0; #X connect 53 0 60 0; #X connect 55 0 42 0; #X connect 56 0 57 0; #X connect 56 1 48 0; #X connect 56 1 61 1; #X connect 56 1 87 1; #X connect 57 0 48 0; #X connect 57 0 87 1; #X connect 58 0 51 0; #X connect 59 0 75 0; #X connect 60 0 36 0; #X connect 60 1 15 0; #X connect 61 0 39 0; #X connect 62 0 63 0; #X connect 63 0 39 0; #X connect 64 0 90 0; #X connect 64 0 91 0; #X connect 66 0 75 0; #X connect 66 1 48 0; #X connect 66 1 61 1; #X connect 68 0 69 0; #X connect 69 0 16 0; #X connect 69 0 73 0; #X connect 70 0 43 1; #X connect 71 0 72 0; #X connect 71 0 70 0; #X connect 71 0 11 1; #X connect 72 0 44 1; #X connect 73 0 71 0; #X connect 74 0 71 0; #X connect 75 0 77 0; #X connect 75 0 49 0; #X connect 76 0 75 1; #X connect 77 0 75 1; #X connect 78 0 79 0; #X connect 79 0 80 0; #X connect 79 1 67 0; #X connect 80 0 67 0; #X connect 82 0 83 0; #X connect 83 0 84 1; #X connect 84 0 73 0; #X connect 85 0 86 0; #X connect 86 0 59 1; #X connect 86 1 87 0; #X connect 87 0 48 0; #X connect 87 0 61 1; #X connect 91 0 66 0;
7,422
Common Lisp
.l
307
23.175896
73
0.671258
Leon-Focker/layers
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
ff110ef989e1d1d1e4bb6a3619aa2757e2a1ef7096036c2f5afc08e35fe38d3f
26,237
[ -1 ]
26,238
linear-log.pd
Leon-Focker_layers/pd/linear-log.pd
#N canvas 562 462 392 226 10; #X obj 20 155 exp; #X obj 20 107 *; #X obj 20 130 +; #X obj 98 87 log; #X obj 194 84 log; #X obj 123 123 t b f; #X obj 123 145 -; #X obj 20 183 outlet; #X obj 20 19 inlet; #X obj 98 23 inlet; #X obj 194 24 inlet; #X obj 256 24 loadbang; #X obj 117 62 \$1; #X obj 213 59 \$2; #X msg 219 176 version 0.0.1; #X connect 0 0 7 0; #X connect 1 0 2 0; #X connect 2 0 0 0; #X connect 3 0 2 1; #X connect 3 0 5 0; #X connect 4 0 6 0; #X connect 5 0 6 0; #X connect 5 1 6 1; #X connect 6 0 1 1; #X connect 8 0 1 0; #X connect 9 0 3 0; #X connect 10 0 4 0; #X connect 11 0 13 0; #X connect 11 0 12 0; #X connect 12 0 3 0; #X connect 13 0 4 0; -------------- next part -------------- #N canvas 287 101 435 179 10; #X obj 45 88 rh_scalelog 1 100; #X floatatom 45 118 5 0 0 0 - - -; #X obj 48 57 hsl 128 15 0 1 0 0 empty empty empty -2 -8 0 10 -262144 -1 -1 0 1; #X msg 45 35 0.5; #X text 191 58 <- input: 0 to 1; #X text 187 116 <- input: 1 to 100 (log); #X obj 45 9 loadbang; #X connect 0 0 1 0; #X connect 2 0 0 0; #X connect 3 0 2 0; #X connect 6 0 3 0;
1,118
Common Lisp
.l
46
22.347826
69
0.601118
Leon-Focker/layers
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
1fcd9c4ae05199c955f33622c63b95b69a9058dfabdeaa2f1fb0f5a58d64a58c
26,238
[ -1 ]
26,239
osc-sc-eval-5000.pd
Leon-Focker_layers/pd/osc-sc-eval-5000.pd
#N canvas 2035 160 477 426 10; #X obj 13 163 mrpeach/udpsend; #X obj 13 138 mrpeach/packOSC; #X obj 12 216 mrpeach/unpackOSC; #X obj 130 46 loadbang; #X obj 130 69 f \$0; #X obj 12 47 inlet; #X obj 276 112 loadbang; #X obj 12 352 outlet; #X obj 13 90 pack s f; #X obj 216 267 loadbang; #X obj 216 290 f \$0; #X obj 12 329 route osc; #X msg 217 312 symbol OSC-SC-EVAL-\$1; #X msg 13 113 send (/osc-sc osc-sc-eval-\$2 \$1); #X obj 12 238 symbol; #X obj 12 282 route list /OSC-SC; #X obj 12 305 route /OSC-SC; #X text 6 7 OSC<->SC example patch courtesy of Simon Bahr.This needs the zexy and mrpeach libraries.; #N canvas 0 96 450 300 l2s 0; #X obj 23 516 list tosymbol; #X obj 86 203 list fromsymbol; #X obj 86 149 list split 1; #X obj 86 99 until; #X obj 86 124 list append; #X obj 180 149 bang; #X obj 86 362 list prepend; #X obj 200 362 t a; #X obj 23 393 list append; #X obj 86 338 list append 32; #X obj 23 49 t b b a b, f 27; #X obj 86 177 makefilename %s; #X obj 23 21 inlet; #X obj 23 540 outlet; #X obj 167 312 list fromsymbol; #X obj 167 262 list append \$1; #X obj 167 237 loadbang; #X obj 205 21 inlet; #X obj 205 49 symbol; #X obj 167 285 route symbol; #X obj 23 417 t l l, f 10; #X obj 80 443 list length; #X obj 23 491 list split; #X obj 80 467 - 1; #X connect 0 0 13 0; #X connect 1 0 9 0; #X connect 2 0 11 0; #X connect 2 1 4 1; #X connect 2 2 5 0; #X connect 3 0 4 0; #X connect 4 0 2 0; #X connect 5 0 3 1; #X connect 6 0 7 0; #X connect 6 0 8 1; #X connect 7 0 6 1; #X connect 8 0 20 0; #X connect 9 0 6 0; #X connect 10 0 8 0; #X connect 10 1 3 0; #X connect 10 2 4 1; #X connect 10 3 6 1; #X connect 10 3 8 1; #X connect 11 0 1 0; #X connect 12 0 10 0; #X connect 14 0 9 1; #X connect 15 0 19 0; #X connect 16 0 15 0; #X connect 17 0 18 0; #X connect 18 0 14 0; #X connect 19 0 14 0; #X connect 20 0 22 0; #X connect 20 1 21 0; #X connect 21 0 23 0; #X connect 22 0 0 0; #X connect 23 0 22 1; #X restore 12 68 pd l2s; #N canvas 0 96 450 300 s2l 0; #X obj 105 281 list fromsymbol; #X obj 72 175 list split 1; #X obj 72 118 until; #X obj 72 146 list append; #X obj 188 363 t l; #X obj 105 363 list prepend; #X obj 39 390 list append; #X obj 39 363 spigot; #X obj 72 332 f 1; #X obj 105 332 t f b; #X obj 12 363 f 0; #X obj 39 414 route bang; #X obj 96 461 list prepend; #X obj 96 437 list tosymbol; #X obj 72 306 sel 32; #X obj 105 231 list append \$1; #X obj 105 206 loadbang; #X obj 33 63 list fromsymbol; #X obj 33 38 symbol; #X obj 33 12 inlet; #X obj 33 484 list append; #X obj 172 175 bang; #X obj 33 85 t b b l b, f 20; #X obj 178 461 t a; #X obj 33 511 outlet; #X obj 105 254 route symbol; #X obj 173 38 symbol; #X obj 173 12 inlet; #X connect 0 0 14 1; #X connect 1 0 14 0; #X connect 1 1 3 1; #X connect 1 2 21 0; #X connect 2 0 3 0; #X connect 3 0 1 0; #X connect 4 0 5 1; #X connect 5 0 4 0; #X connect 5 0 6 1; #X connect 6 0 11 0; #X connect 7 0 6 0; #X connect 7 0 5 1; #X connect 7 0 10 0; #X connect 8 0 7 1; #X connect 9 0 5 0; #X connect 9 1 7 0; #X connect 10 0 7 1; #X connect 11 1 13 0; #X connect 12 0 20 1; #X connect 12 0 23 0; #X connect 13 0 12 0; #X connect 14 0 8 0; #X connect 14 1 9 0; #X connect 15 0 25 0; #X connect 16 0 15 0; #X connect 17 0 22 0; #X connect 18 0 17 0; #X connect 19 0 18 0; #X connect 20 0 24 0; #X connect 21 0 6 0; #X connect 21 0 2 1; #X connect 22 0 20 0; #X connect 22 1 2 0; #X connect 22 2 3 1; #X connect 22 3 5 1; #X connect 22 3 12 1; #X connect 22 3 6 1; #X connect 22 3 20 1; #X connect 23 0 12 1; #X connect 25 0 0 0; #X connect 26 0 0 0; #X connect 27 0 26 0; #X restore 12 260 pd s2l; #X obj 12 192 mrpeach/udpreceive 5000; #X obj 50 47 r send-to-sc; #X msg 276 136 connect 192.168.56.101 5000; #X connect 1 0 0 0; #X connect 2 0 14 0; #X connect 3 0 4 0; #X connect 4 0 8 1; #X connect 5 0 18 0; #X connect 6 0 22 0; #X connect 8 0 13 0; #X connect 9 0 10 0; #X connect 10 0 12 0; #X connect 11 0 7 0; #X connect 12 0 11 1; #X connect 13 0 1 0; #X connect 14 0 19 0; #X connect 15 0 16 0; #X connect 16 0 11 0; #X connect 18 0 8 0; #X connect 19 0 15 0; #X connect 20 0 2 0; #X connect 21 0 18 0; #X connect 22 0 0 0;
4,106
Common Lisp
.l
172
22.872093
68
0.680224
Leon-Focker/layers
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
05095d55ce331cf297631c2dddb0fd2f5faa1c9847ba09c8449d4bc5c67562e3
26,239
[ -1 ]
26,240
layer.lsp
Leon-Focker_layers/src/layer.lsp
;; ** layer ;;;; layer class - a lot of the magic is happening here (in-package :layers) ;; *** layer ;;; a layer with distinct soundfiles and properties ;;; one layer will send audio information to one mixer channel (defclass layer (stored-file-list) ((stored-file-list :accessor stored-file-list :initarg :stored-file-list :initform nil) (current-stored-file :accessor current-stored-file :initarg :current-stored-file :initform nil) (last-stored-file :accessor last-stored-file :initarg :last-stored-file :initform nil) (this-length :accessor this-length :initarg :this-length :initform 1) (play-length :accessor play-length :initarg :play-length :initform 1) (last-length :accessor last-length :initarg :last-length :initform 1) (remaining-duration :accessor remaining-duration :initarg :remaining-duration :initform 0) (structure :accessor structure :initarg :structure) (n-for-list-of-durations :accessor n-for-list-of-durations :initarg :n-for-list-of-durations :type integer) (list-of-durations :accessor list-of-durations :initarg :list-of-durations :initform nil) ;; alternative way to determine new rhythm: (use-rhythm-function :accessor use-rhythm-function :initarg :use-rhythm-function :initform nil) ;; the only argument when called is always the layer-object itself. (rhythm-function :accessor rhythm-function :initarg :rhythm-function :initform #'(lambda (ly) (declare (ignore ly)) 1)) ;; if nil, the layer will stop sending new information. (play :accessor play :initarg :play :initform t) (current-time :accessor current-time :initarg :current-time :initform 0) (panorama :accessor panorama :initarg :panorama :initform 45) (use-pan-of-layer :accessor use-pan-of-layer :initarg :use-pan-of-layer :initform t))) ;; *** initialize-instance ;;; called automatically, sets last-stored-file to current-s-f when initializing (defmethod initialize-instance :after ((ly layer) &rest initargs) (declare (ignore initargs)) (setf (current-stored-file ly) (first (data (stored-file-list ly))) (last-stored-file ly) (current-stored-file ly) (list-of-durations ly) (if (use-rhythm-function ly) (make-instance 'list-of-durations :data (list (funcall (rhythm-function ly) ly)) :current 0) (make-list-of-durations (structure ly)(n-for-list-of-durations ly))) (this-length ly) (see-current (list-of-durations ly)) (play-length ly) (this-length ly) (remaining-duration ly) (this-length ly))) ;; *** make-layer ;;; create a layer-object (defun make-layer (id stored-file-list structure &optional (n 0) (panorama 45) (use-pan-of-layer t) (error-fun #'warn) (rhythm-function #'(lambda (ly) (declare (ignore ly)) 1)) use-rhythm-function) (unless (equal (type-of stored-file-list) 'stored-file-list) (error "sfl in #'make-layer was not of type stored-file-list but: ~a" stored-file-list)) (check-sanity stored-file-list error-fun) (unless (subtypep (type-of structure) 'structure) (warn "sfl in #'make-layer was not of type structure: ~a, ~ using rhythm-funtion instead." structure) (setf structure nil use-rhythm-function 1)) (make-instance 'layer :id id :stored-file-list stored-file-list :structure structure :n-for-list-of-durations n :rhythm-function rhythm-function :use-rhythm-function use-rhythm-function :panorama panorama :use-pan-of-layer use-pan-of-layer)) ;; *** get-id-current-file ;;; id of the current stored-file (defmethod get-id-current-file ((ly layer)) (when (current-stored-file ly) (get-id (current-stored-file ly)))) ;; *** get-id-last-file ;;; id of the last stored-file (defmethod get-id-last-file ((ly layer)) (get-id (last-stored-file ly))) ;; *** print-object ;;; print the layer object (defmethod print-object ((ly layer) stream) (format stream "~%Layer ID: ~a ~ ~&current soundfile: ~a ~ ~&duration: ~a ~ ~&start: ~a" (id ly) (get-id-current-file ly) ;;(get-id-last-file ly) (play-length ly) (when (current-stored-file ly) (start (current-stored-file ly))) ;;(play ly) ;; (get-id (last-played (stored-file-list ly))) )) ;; *** print-layer ;;; print the layer object - deprecated ;;; (setf (symbol-function 'print-layer) #'print) ;; *** swap-stored-file-list ;;; swap the stored-file-list of a layer, even while playing (defmethod swap-stored-file-list ((ly layer) new-stored-file-list) (unless (equal (type-of new-stored-file-list) 'stored-file-list) (error "sfl in #'swap-stored-file-list was not of type stored-file-list ~ but: ~a" new-stored-file-list)) ;; don't do anything when both sfls are the same (unless (eq (stored-file-list ly) new-stored-file-list) (setf (stored-file-list ly) new-stored-file-list ;; after the stored-file-list has been swapped, set the current-stored-file ;; to the last played of the new stored-file-list (current-stored-file ly) (last-played (stored-file-list ly))) (format t "~& Layer ~a now plays ~a" (get-id ly) (get-id new-stored-file-list)))) ;; *** determine-new-stored-file ;;; will be called in 'get-next', after possibly changing the sfl etc. ;;; determines next sound file in current-stored-file-list depending on either: ;;; - length-dependant-list ;;; - markov list with fixed-seed-randomness ;;; - position in coordinate space and fixed-seed-randomness ;;; can receive a sub-sfl, containing only some stored-files ;;; then checks wheter the preferred-length matches, if no: repeat. (defmethod determine-new-stored-file ((ly layer)) (let ((data (data (stored-file-list ly)))) (loop for snd in data until break with break with new-id = ;; when current file has no length-dependant-list ;; a random number and the markov-list will decide. ;; else we use the length-dependant-list (handler-bind ((markov-list-is-nil #'(lambda (c) (error (text c) (get-id (current-stored-file ly))))) (no-value #'(lambda (c) (error (text c) 'get-sub-list-of-closest (id (stored-file-list ly))))) (weird-values #'(lambda (c) (error (text c) 'get-sub-list-of-closest (id (stored-file-list ly)))))) (cond (*use-sample-clouds* (decide-for-snd-file (get-sub-list-of-closest (stored-file-list ly) *x-y-z-position* :max-distance *cloud-radius*) (get-next *random-number*))) ((length-dependant-list (current-stored-file ly)) (decide-for-snd-file (length-dependant-list (current-stored-file ly)) (this-length ly))) (t (decide-for-snd-file (markov-list (current-stored-file ly)) (get-next *random-number*))))) do (when (eq (id snd) new-id) (setf break t) ;; check wheter chosen stored-file likes the length it would get (if (and *use-preferred-lengths* (preferred-length snd)) (if (and (> (this-length ly) (first (preferred-length snd))) (< (this-length ly) (second (preferred-length snd)))) (return snd) ;; if not, get a file that wants to be played (let ((ls '())) (loop for snd1 in data do (if (preferred-length snd1) ;; check whether file likes the current length (when (and (> (this-length ly) (first (preferred-length snd1))) (< (this-length ly) (second (preferred-length snd1)))) (push snd1 ls)) ;; if it has ne preferrences, add it as well (push snd1 ls))) (if (null ls) ;; when nobody wants to be played, play original one (return snd) ;; else choose at random :o (return (nth (floor (* (get-next *random-number*) (length ls))) ls))))) (return snd))) (when (and (eq snd (car (last data))) (not break)) (error "there is no file with ID: ~a in current-stored-file ~ list: ~a" new-id (get-id (stored-file-list ly))))))) ;; *** get-next ;;; moves on to the next stored sound file (defmethod get-next ((ly layer)) (unless ly (error "in get-next, the layer object is nil")) (unless (equal (type-of (stored-file-list ly)) 'stored-file-list) (error "get-next did not find a proper sfl in layer ~a: ~a" (id ly) (stored-file-list ly))) ;;(check-sanity (stored-file-list ly)) (unless (data (stored-file-list ly)) (error "stored-file-list of layer ~a seems to be empty" (id ly))) ;; get next duration: (let ((next-len 1)) (setf (last-stored-file ly) (current-stored-file ly) (current-time ly) (+ (current-time ly) (this-length ly)) next-len (if (use-rhythm-function ly) (progn (add-to-list (list-of-durations ly) (funcall (rhythm-function ly) ly)) (see-current (list-of-durations ly))) (get-next-by-time (current-time ly) (list-of-durations ly)))) ;; change sample-bank (sfl) of current layer depending on the ;; length of the next played soundfile -> next-len (cond ((< next-len (length-min (stored-file-list ly))) (swap-stored-file-list ly (if (sfl-when-shorter (stored-file-list ly)) (sfl-when-shorter (stored-file-list ly)) (stored-file-list ly)))) ((> next-len (length-max (stored-file-list ly))) (swap-stored-file-list ly (if (sfl-when-longer (stored-file-list ly)) (sfl-when-longer (stored-file-list ly)) (stored-file-list ly)))) (t )) ;; check wheter there is at least one file in the sfl that's not a rest (unless (or (data (stored-file-list ly)) (not (eq 'rest (get-id (first (data (stored-file-list ly))))))) (error "~&there are no sound files stored in sfl ~a" (get-id (stored-file-list ly)))) ;; when the (new) current event is actually a rest, ;; copy and use the last played markov list (when (eq 'rest (get-id (current-stored-file ly))) (setf-markov (current-stored-file ly) ;; if the last played is also a rest, use second file in list (cond ((data (markov-list (last-played (stored-file-list ly)))) (markov-list (last-played (stored-file-list ly)))) (t (loop for i in (data (stored-file-list ly)) when (markov-list i) do (return (markov-list i))))))) ;; error, if current file still has no markov-list (unless (data (markov-list (current-stored-file ly))) (error "~&No markov-list found in current-stored-file ~a in Layer~a" (get-id (current-stored-file ly)) (get-id ly))) ;; make the playback stop when the structure has ended (and *loop* is nil) (let ((ll (list-of-durations ly))) (when (and (= (current ll) (1- (length (data ll)))) (not *loop*) (not (use-rhythm-function ly))) (setf (play ly) nil))) ;; set time for the next sample and then actually determine the new sample (setf ;; sample-lengths (last-length ly) (this-length ly) ;; using pop, instead of #'get-next when using the rhythm-function (this-length ly) (if (use-rhythm-function ly) (pop (data (list-of-durations ly))) next-len) (play-length ly) (this-length ly) (remaining-duration ly) (this-length ly) ;; new-sample (current-stored-file ly) (determine-new-stored-file ly) ))) ;; *** update-times ;;; after chanigng a structure, similar to set-n, the timings for the next ;;; trigger etc might have shiftet. This updates those times. (defmethod update-times ((ly layer) current-time current-timer) (let* ((lod (data (list-of-durations ly))) (len (length lod)) ;; look for next trigger time and sum (new-next-trigger (loop for n from 0 and i = (nth (mod n len) lod) sum i into sum until (> sum current-time) finally (return sum))) (passed-timer (- *next-trigger* current-timer))) (setf (current-time ly) new-next-trigger ;; set this-length according to current position in list (this-length ly) (see-current (list-of-durations ly)) (remaining-duration ly) ;; time between last and next general trigger (+ passed-timer ;last-trigger until now (- new-next-trigger current-time))) ;now until end of sample ;; warn when negative remainder (when (< (remaining-duration ly) 0) (warn "something is off, remaining-duration for ~a is negative: ~a" (id ly) (remaining-duration ly))) (when *print-to-console* (format t "~&updated for layer ~a" (id ly))) (list 'update ;; time until next trigger (float (- *next-trigger* current-timer)) ;; reset-timer in pd? 0 ;; layer ID (id ly) ;; remaining time for currently played file (float (- new-next-trigger current-time)) ;; new decay (float (see-next (list-of-durations ly)))))) ;; *** reset ;;; updates the slots of a layer, when needed ;;; could be named #'reset... (defmethod reset-layer ((ly layer)) (setf (current-stored-file ly) (first (data (stored-file-list ly))) (last-stored-file ly) (current-stored-file ly) (list-of-durations ly) (make-list-of-durations (structure ly) (n-for-list-of-durations ly)) (this-length ly) (see-current (list-of-durations ly)) (play-length ly) (this-length ly) (remaining-duration ly) (this-length ly))) ;; *** reset-index ;;; sets current slot of the list-of-durations of a layer back to 0 (start of loop) (defmethod reset-index ((ly layer)) (setf (current (list-of-durations ly)) 0) (format t "~& current timing index of layer ~a set to ~a" (get-id ly) (current (list-of-durations ly)))) ;; *** play-this ;;; sends list with all necessary information to pd, so to play ;;; the current stored-file (defmethod play-this ((ly layer) &key (offset-start 0) (printing t) ;t (output-for-unix nil) (change-sampler t) (get-next t)) (unless (data (stored-file-list ly)) (error "stored-file-list of layer ~a seems to be empty" (id ly))) (if (and (or *loop* (play ly)) *start-stop*) (prog1 (list 'layer ;; layer id (which voice in PD to send to) (get-id ly) ;; soundfile (os-format-path (path (if get-next (current-stored-file ly) (last-stored-file ly))) (if (and *pd-on-windows* (not output-for-unix)) 'windows 'unix)) ;; soundfile-length in seconds, pd needs floats (float (play-length ly)) ;; start in seconds (float (mod (+ (if (eq (start (current-stored-file ly)) 'random) (if (> (duration (current-stored-file ly)) (this-length ly)) (random (- (duration (current-stored-file ly)) (this-length ly))) 0) (or (start (current-stored-file ly)) 0)) offset-start) (duration (current-stored-file ly)))) ;; attack in milliseconds 10 ;; decay in miliseconds (float (* 1000 ;; from seconds to miliseconds (let ((max-decay (see-next (list-of-durations ly))) (decay (decay (current-stored-file ly)))) (if (>= decay max-decay) max-decay decay)))) ;; amplitude (float (amplitude (current-stored-file ly))) ;; loop-flag (if (loop-flag (current-stored-file ly)) 1 0) ;; soundfile-id (displayed in PD) (if get-next (get-id-current-file ly) (get-id-last-file ly)) ;; panning (float (if (use-pan-of-layer ly) (panorama ly) (if (eq (panorama (current-stored-file ly)) 'random) (* 90 (get-next *random-number*)) (panorama (current-stored-file ly))))) ;; change sampler or use same as last? (if change-sampler 1 0)) (when printing (print ly)) (when get-next (get-next ly))) (prog1 (list 'layer ;; layer id (which voice in PD to send to) (get-id ly) ;; soundfile (os-format-path (path (if get-next (current-stored-file ly) (last-stored-file ly))) (if (and *pd-on-windows* (not output-for-unix)) 'windows 'unix)) ;; soundfile-length in seconds 0 ;; start in seconds 0 ;; attack in milliseconds 0 ;; decay in miliseconds 0 ;; amplitude 0 ;; loop-flag 0 ;; soundfile-id (displayed in PD) "stopped" ;; panning 45 ;; change sampler or use same as last? 0) ;; (setf (play ly) t) (format t "~&Playback for layer ~a ends now, last sound was ~a seconds" (get-id ly) (this-length ly))))) ;; *** update-list-of-durations (defmethod update-list-of-durations ((ly layer) &optional (current 0)) (setf (list-of-durations ly) (make-list-of-durations (structure ly) (n-for-list-of-durations ly) current))) ;;;; EOF layer.lsp
16,682
Common Lisp
.l
444
32.581081
83
0.649713
Leon-Focker/layers
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
08f80ba7b37a7edd20fbc90f98535d040cd3f58b00b411300fd23545e03e8a33
26,240
[ -1 ]
26,241
globals.lsp
Leon-Focker_layers/src/globals.lsp
;; ** globals ;;;; global variables for layers ;;;; some user settable, some not pls c: (in-package :layers) ;; *** custom setup (front end) (defparameter *total-duration* 100) (defparameter *seed* 5) ;; what is the maximum length for the smallest value in the structure? (defparameter *max-smallest-sample-length* 0.003) (defparameter *use-sample-clouds* t) ;; skips markov chains, uses x y z ;; when true, the layer decides the panorama value for all files played in it ;; when false, each file is panned according to its panorama value (defparameter *use-pan-of-layer* t) (defparameter *use-preferred-lengths* t) ; check wheter sf likes current length (defparameter *loop* nil) (defparameter *start-stop* t) (defparameter *pd-on-windows* t) ;; is your pd-version running on windows? (defparameter *load-risky-files* nil) ;; load clm and sketch,creates warnings :( (defparameter *print-to-console* nil) (defparameter *cloud-radius* .3) ;; *** not for user (back end) (defparameter *all-layers* '()) ;; list with all layers objects that were called (defparameter *random-number* nil) (defparameter *next-trigger* 0) ;; time until next sample(s) will be triggered in ms (defparameter *default-sample-dir* (format nil "~a~a" (parent-dir *layers-home-dir*) "/samples")) (defparameter *x-y-z-position* (vector 0 0 0)) (defparameter *score-file* nil) ;; set which file to reload to reset (defparameter *layers-buffer* '()) ;; variable used to temporarily store data (defparameter *debug* '()) ;; hopefully not needed for now (defparameter *current-time* 0) (defparameter *current-timer* 0) ;;;; EOF globals.lsp
1,613
Common Lisp
.l
33
47.69697
84
0.74302
Leon-Focker/layers
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
d3c2f27e0bb4aba1db2d7297b09a55f4208c195f3e747ca3fbdd2212ce903124
26,241
[ -1 ]
26,242
list-of-durations.lsp
Leon-Focker_layers/src/list-of-durations.lsp
;; ** list-of-durations ;;;; list-of-durations class (in-package :layers) ;; *** class ;;; a structure is a list of list-of-durations, for the l-o-d, we choose one ;;; of those lists (defclass list-of-durations (list-object) ((structure :accessor structure :initarg :structure :initform nil))) ;; *** make-list-of-durations ;;; initialize a list-of-durations object (defmethod make-list-of-durations ((st structure) &optional (n 0) (current 0)) (make-instance 'list-of-durations :data (nth n (data st)) :structure st :current current)) ;; *** get-next-by-time ;;; don't just get the next value in the list, use decider and the current time (defmethod get-next-by-time (current-time (ll list-of-durations)) (when (data ll) (let* ((data (data ll))) (progn (setf (current ll) (decider (mod (/ current-time *total-duration*) 1.0) data)) (when (= (current ll) (length data)) (setf (current ll) 0)) ;;(format t "~&index: ~a~&current: ~a" (current ll) current-time) (nth (current ll) data))))) ;; EOF list-of-durations.lsp
1,061
Common Lisp
.l
28
35.285714
79
0.680623
Leon-Focker/layers
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
a9acab9e409cdd28fca5fa98ca668809e99f43d3bc40f6f39b5865fa9418bc8e
26,242
[ -1 ]
26,243
markov.lsp
Leon-Focker_layers/src/markov.lsp
;; ** markov ;;;; markov-list-object (in-package :layers) ;; *** markov-list ;;; list of pairs of soundfile-ids and allocated relative odds (defclass markov-list (list-object) ()) ;; *** make-markov-list ;;; make an instance of markov-list (defun make-markov-list (id ml) (make-instance 'markov-list :data ml :id id)) ;;; example: #|(make-markov-list 'test '(("/E/test.wav" 5) ("/E/test1.wav" 2) ("/E/test2.wav" 7)))|# ;; *** decide-for-snd-file ;;; returns the car of the chosen sublist of a markov-list object ;;; (the id of the next soundfile) (defmethod decide-for-snd-file ((ml markov-list) random-number) (unless (data ml) (error 'markov-list-is-nil :text "~&when determinig the new soundfile, ~ the markov-list of the current soundfile ~a is nil")) (let* ((ls (loop for i in (data ml) collect (cadr i)))) (handler-bind ((no-value #'(lambda (c) (error (text c) "decide-for-snd-file with markov-list" ls)))) (car (nth (decider random-number ls) (data ml)))))) ;; *** make-load-file (defmethod make-load-file ((ml markov-list) &optional environment) (declare (ignore environment)) `(make-instance 'markov-list :id ',(id ml) :data ',(data ml))) ;;;; EOF markov.lsp
1,263
Common Lisp
.l
38
29.736842
70
0.646141
Leon-Focker/layers
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
f72078cda264a950f798d977306dc51b1852ddc69a0a9133a50a5dbca1f48435
26,243
[ -1 ]
26,244
base-object.lsp
Leon-Focker_layers/src/base-object.lsp
;; ** base-object ;;;; nothing thrilling going on here (in-package :layers) ;; *** base-object ;;; as simple as it gets (defclass base-object () ((id :accessor id :initarg :id :initform nil) (data :accessor data :initarg :data :initform nil))) ;; *** get-id ;;; get the id of an object (defmethod get-id ((bo base-object)) (id bo)) ;;;; EOF base-object.lsp
368
Common Lisp
.l
13
26.461538
55
0.669516
Leon-Focker/layers
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
87f3d7989739edb88b787e004d239dfee1cd9af9154257a8c99d499f4a84f608
26,244
[ -1 ]
26,245
stored-file-list.lsp
Leon-Focker_layers/src/stored-file-list.lsp
;; ** stored-file-list ;;;; sfl class, storing and categorising soundfiles etc. (in-package :layers) ;; *** stored-file-list ;;; list of stored files, no doubles (defclass stored-file-list (list-object) ;; this helps to switch sfls dependant on the next play-length ((length-min :accessor length-min :initarg :length-min :initform 0) (length-max :accessor length-max :initarg :length-max :initform 100) (sfl-when-shorter :accessor sfl-when-shorter :initarg :sfl-when-shorter :initform nil) (sfl-when-longer :accessor sfl-when-longer :initarg :sfl-when-longer :initform nil) (last-played :accessor last-played :initarg :last-played :initform nil))) (defmethod print-object ((sfl stored-file-list) stream) (format stream "<STORED-FILE-LIST ~a>" (id sfl))) ;; *** make-stored-file-list ;;; make an instance of stored-file-list (defun make-stored-file-list (id data &key (length-min 0) (length-max 100) sfl-when-shorter sfl-when-longer) (make-instance 'stored-file-list :id id :data data :length-min length-min :length-max length-max :sfl-when-shorter sfl-when-shorter :sfl-when-longer sfl-when-longer :last-played (first data))) ;; *** subordinate-stored-file-list ;;; only contains a list of stored-files and its probability weight ;;; designed for one time use, eg. (result of get-sub-list-of-closest) (defclass subordinate-stored-file-list (list-object) ()) ;; *** make-subordinate-stored-file-list (defun make-subordinate-stored-file-list (id data) (make-instance 'subordinate-stored-file-list :id id :data data)) ;; *** decide-for-snd-file ;;; returns the id of the chosen soundfile, based on the subordinate-sfl it got (defmethod decide-for-snd-file ((sub-sfl subordinate-stored-file-list) random-number) (let* ((weights '()) (ids '()) (ls (sort (data sub-sfl) #'(lambda (x y) (> (car x) (car y)))))) (loop for i in ls do (push (car i) weights) (push (get-id (cadr i)) ids)) (nth (decider random-number weights) ids))) ;; *** get-ids ;;; get ids of all stored-files in stored-file-list (defmethod get-ids ((sfl stored-file-list)) (loop for sf in (data sfl) collect (get-id sf))) ;; *** get-all ;;; gets list of all values in a slot of the stored-file ins stored-file-list (defmethod get-all (slot (sfl stored-file-list) &optional error) (loop for sf in (data sfl) do (when (and (not (funcall slot sf)) error) (error "get-all found no value for ~a in sf ~a" slot (id sf))) collect (funcall slot sf))) ;; *** get-coordinates ;;; get coordinates of all stored-files in stored-file-list as '((x1 y1 z1 )...) (defmethod get-coordinates ((sfl stored-file-list)) (loop for sf in (data sfl) do (unless (and (x sf) (y sf) (z sf)) (error "In get-coordinates, not all coordinates were given for sf: ~a" (id sf))) collect (list (x sf) (y sf) (z sf)))) ;; *** get-paths ;;; show all paths to all sounds on the sfl (defmethod get-paths ((sfl stored-file-list)) (loop for p in (data sfl) collect (path p))) ;; *** get-sub-list-of-closest ;;; get a list of soundfiles which are close to current position in x,y,z (defmethod get-sub-list-of-closest ((sfl stored-file-list) current-position &key (max-distance 0.6)) ;; maybe change? (let* ((min 10) (closest) (ls '())) ;; no distance should ever be greater when x,y,z are < 1 (unless (data sfl) (error 'no-value)) (loop for sf in (data sfl) do ;; get distance between point of sf and current position (let ((dis (distance-between-points (vector (x sf) (y sf) (z sf)) current-position))) (when (< dis min) (setf min dis) (setf closest sf)) (when (< dis max-distance) (push (list (/ 1 (+ 0.01 dis)) sf) ls)))) ;; when no point is close enough, at least return the closest one (unless closest (error 'weird-values)) (when (= min 0) (setf min 0.00001)) (when (null ls) (push (list (/ 1 min) closest) ls)) ;;(print (id (cadar (data (make-subordinate-stored-file-list 'closest-files ls))))) (make-subordinate-stored-file-list 'closest-files ls))) ;; *** auto-scale-mapping ;;; automatically scale all x, y and z values ;;; to optimally fill out coordinate space (defmethod auto-scale-mapping ((sfl stored-file-list) &key remap) (let* ((len (length (data sfl))) (all-x (sort (get-all 'x sfl t) #'<)) (all-y (sort (get-all 'y sfl t) #'<)) (all-z (sort (get-all 'z sfl t) #'<)) (x-min (first all-x)) (y-min (first all-y)) (z-min (first all-z)) (x-max (car (last all-x))) (y-max (car (last all-y))) (z-max (car (last all-z)))) (if remap (loop for sf in (data sfl) do (setf (x sf) (/ (position (x sf) all-x) len) (y sf) (/ (position (y sf) all-y) len) (z sf) (/ (position (z sf) all-z) len))) (loop for sf in (data sfl) do (setf (x sf) (/ (- (x sf) x-min) (- x-max x-min)) (y sf) (/ (- (y sf) y-min) (- y-max y-min)) (z sf) (/ (- (z sf) z-min) (- z-max z-min))))))) ;; *** store-file-in-list ;;; stores a stored-file object in a stored-file-list, when its id is unique (defmethod store-file-in-list ((sf stored-file) (sfl stored-file-list) &key (warn-if-double t)) (if (null (data sfl)) (setf (data sfl) (list sf)) (let* ((double (member (id sf) (get-ids sfl)))) (if double (progn (when warn-if-double (warn (format nil "the id ~a is already in the sfl ~a ~ and will be replaced" (get-id sf) (get-id sfl)))) (setf (data sfl) (remove-nth (- (length (data sfl)) (length double)) (data sfl))) (push sf (data sfl))) (push sf (data sfl))))) (unless (last-played sfl) (setf (last-played sfl) sf))) ;; *** folder-to-stored-file-list ;;; bunch-add all soundfiles in a folder to a stored-file-list ;;; auto-map - analyzes and maps the file automatically in a x y z space ;;; f1, f2, f3 are the mapping functions for x y z, leave them nil for default ;;; fft-size must be a power of 2 and starts at the beginning of the sample ;;; when fft-size is nil, the biggest one possible is chosen ;;; auto-scale-mapping - scales all mapping values to range from 0 to 1 ;;; remap - allows for rearranging of the files within the x y z space (defmethod folder-to-stored-file-list ((sfl stored-file-list) folder &key id-uniquifier markov-list analyse auto-map f1 f2 f3 fft-size auto-scale-mapping remap (start 0) (decay 0) ; in seconds (panorama 45) loop-flag (path-to-folder "")) (let* ((dir (format nil "~a~a" path-to-folder folder)) (files (sc::get-sndfiles dir)) (names (loop for i in files collect (pathname-name i))) (ids '())) (when (null files) (warn "no soundfiles found in ~a" dir)) (loop for file in files and name in names for id = (read-from-string (if id-uniquifier (format nil "~a-~a" id-uniquifier name) name)) do (handler-case (store-file-in-list (prog1 (let* ((sf (make-stored-file id file ;;:markov '() :decay decay :start start :directory "" :panorama panorama :loop-flag loop-flag))) (cond ((and analyse (not auto-map)) (analyse-soundfile sf)) (auto-map (map-soundfile sf :f1 f1 :f2 f2 :f3 f3 :fft-size fft-size)) (t sf))) (format t "~&storing file: ~a" id) ;; if no error until here, push id into ids (push id ids)) sfl) (t (error) ;; This block will be executed for any type of error (format t "~&An error occurred while storing ~a: ~&~A~%" file error)))) (setf ids (reverse ids)) (loop for sf in (data sfl) for markov = (make-markov-list (id sf) (loop for i in ids for markov = (assoc i markov-list) collect (list i (if markov (cadr markov) 1)))) do (setf (markov-list sf) markov) (check-sanity sf #'error)) (when auto-scale-mapping (auto-scale-mapping sfl :remap remap)))) ;; *** set-alternate-sfls ;;; set a few slots important for switching betweend sfls in a layer ;;; -> when the next cue is too short or too long for the current sfl, ;;; which sfl is next? (defmethod set-alternate-sfls ((sfl stored-file-list) length-min length-max sfl-when-shorter sfl-when-longer) (setf (length-min sfl) length-min (length-max sfl) length-max (sfl-when-shorter sfl) sfl-when-shorter (sfl-when-longer sfl) sfl-when-longer)) (defparameter *stored-file-list* (make-stored-file-list 'test nil)) ;; *** combine-stored-file-lists ;;; combine two stored-file-lists into a new one (defmethod combine-stored-file-lists ((sfl1 stored-file-list) (sfl2 stored-file-list) new-id) (make-stored-file-list new-id (append (data sfl1) (data sfl2)) :length-min (length-min sfl1) :length-max (length-max sfl1) :sfl-when-shorter (sfl-when-shorter sfl1) :sfl-when-longer (sfl-when-longer sfl1))) ;; *** check-mapping ;;; checks wheter any x, y or z value is not between 0 and 1, ;;; maybe does more in the future (defmethod check-mapping ((sfl stored-file-list)) (loop for x in (get-all 'x sfl) and y in (get-all 'y sfl) and z in (get-all 'z sfl) do (when (or (> (max x y z) 1) (< (min x y z) 0)) (warn "~&found x, y or z value that is not in bounds 0 - 1 in sfl ~a" (get-id sfl))))) ;; *** make-load-form (defmethod make-load-form ((sfl stored-file-list) &optional environment) (declare (ignore environment)) `(make-instance 'stored-file-list :id ',(id sfl) :data ,(cons 'list (loop for sf in (data sfl) collect (make-load-form sf))) :length-min ',(length-min sfl) :length-max ',(length-max sfl) ;;:sfl-when-shorter ',(sfl-when-shorter sfl) ;;:sfl-when-longer ',(sfl-when-longer sfl) ;;:last-played ',(last-played sfl) )) ;; *** check-sanity (defmethod check-sanity ((sfl stored-file-list) &optional (error-fun #'warn)) (unless (loop for sf in (data sfl) always (and (equal (type-of sf) 'stored-file) (check-sanity sf error-fun))) (funcall error-fun "not all elements of sfl ~a are sane stored-files" (id sfl))) (loop for slot in '(length-min length-max) do (unless (and (numberp (funcall slot sfl)) (<= 0 (funcall slot sfl))) (funcall error-fun "werid ~a for stored-file ~a" slot (id sfl)))) (loop for slot in '(sfl-when-longer sfl-when-shorter) do (unless (or (not (funcall slot sfl)) (equal (type-of (funcall slot sfl)) 'stored-file-list) (funcall error-fun "werid ~a for stored-file ~a" slot (id sfl))))) (loop for slot in '(last-played) do (unless (or (not (funcall slot sfl)) (equal (type-of (funcall slot sfl)) 'stored-file) (funcall error-fun "werid ~a for stored-file ~a" slot (id sfl))))) t) ;; *** store-in-text-file ;;; store a sfl in a text file, so the analysis can be skipped by reading in ;;; the soundfiles. (defmethod store-in-text-file ((sfl stored-file-list) &optional file) (let* ((file (or file (format nil "~a~a-load-file.txt" *src-dir* (id sfl))))) (sc::write-to-file file (make-load-form sfl)) (format t "~&wrote ~a into ~a" (id sfl) file))) ;;;; EOF stored-file-list.lsp
11,338
Common Lisp
.l
296
33.783784
87
0.639985
Leon-Focker/layers
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
aba764e999825c7d8a02ad354d9b2af2d01882c8e384e5df52874ce92dd406fc
26,245
[ -1 ]
26,246
structure.lsp
Leon-Focker_layers/src/structure.lsp
;; ** structure ;;;; stucture and fractal-structure class (in-package :layers) ;; *** structure class and fractal-structure class ;;; a list of lists of durations and some information about it - for example ;;; how it was generated. (defclass structure (list-object) ;; when this is t, re-generate the structure everytime the *total-duration* ;; is changed - for simple structures this means, that all sublists will ;; be of length *total-duration* after that. ((depends-on-total-length :accessor depends-on-total-length :initarg :depends-on-total-length :initform nil) (depth-of-structure :accessor depth-of-structure :initarg :depth-of-structure :type integer :initform 0) (type :accessor type :initarg :type :initform 'simple))) (defclass fractal-structure (structure) ((seed :accessor seed :initarg :seed) (rules :accessor rules :initarg :rules) (ratios :accessor ratios :initarg :ratios))) (defmethod initialize-instance :after ((st structure) &rest initargs) (declare (ignore initargs)) (let* (new-data) (unless (listp (data st)) (error "data in make-structure must be a list: ~a" (data st))) (setf new-data (loop for ls in (data st) when (listp ls) collect ls)) (unless (and (car new-data) (loop for ls in new-data always (loop for i in ls always (numberp i)))) (error "data in make-structure seems to be faulty: ~a" (data st))) (setf (data st) new-data (depth-of-structure st) (length new-data)))) ;; *** print-object (defmethod print-object ((st structure) stream) (format stream "~&Structure ID: ~a ~ ~&depth: ~a" (id st) (depth-of-structure st))) ;; *** scale-smallest-value-to (defmethod scale-smallest-value-to ((st structure) new-smallest-value) (let* ((data (data st)) (minimum (apply #'min (first data))) (scaler (/ new-smallest-value minimum))) (setf (data st) (loop for ls in data collect (if (atom ls) (* ls scaler 1.0) (loop for i in ls collect (* i scaler))))) st)) ;; *** scale-biggest-value-to (defmethod scale-biggest-value-to ((st structure) new-biggest-value) (let* ((data (data st)) (maximum (apply #'max (first data))) (scaler (/ new-biggest-value maximum))) (setf (data st) (loop for ls in data collect (if (atom ls) (* ls scaler 1.0) (loop for i in ls collect (* i scaler))))) st)) ;; *** scale-structure ;;; loop through all lists in the data of a structure and scale the duration ;;; of each to the target-duration (defmethod scale-structure ((st structure) target-duration) (setf (data st) (loop for ls in (data st) collect (scale-list-to-sum ls target-duration)))) ;; *** re-gen-structure ;;; in case the *total-duration* changed, ;;; this function will generate a new structure, based on the initial arguments (defmethod re-gen-structure ((st structure)) (print st) (when (depends-on-total-length st) (setf (data st) (case (type st) (lindenmayer (lindenmayer *total-duration* (seed st) (rules st) (ratios st))) (compartmentalise (compartmentalise *total-duration* (seed st) (rules st) (ratios st))) (simple (scale-structure st *total-duration*)) (t (error "re-gen-structure does not know how to gen structure of~ type ~a" (type st))))) (format t "structure ~a was regenerated" (id st)))) ;; *** make-structure and make-fractal-structure ;;; generate a structure-object (defun make-structure (id data &optional depends-on-total-length) (make-instance 'structure :id id :data data :depends-on-total-length (when depends-on-total-length))) ;;; takes several arguments to generate a structure using the lindenmayer fun. ;;; total-length: length of the structure (and piece) in seconds. ;;; EXAMPLE #| (make-fractal-structure '(2) '((1 ((2 1))) (2 ((3 1 3))) (3 ((2)))) '((1 1) (2 5) (3 .2))) |# (defun make-fractal-structure (seed rules ratios &key id (duration *total-duration*) (type 'lindenmayer) (smallest *max-smallest-sample-length*) fixed-duration) ;; sanity (unless (listp seed) (error "malformed seed ~a, must be a list." seed)) (unless (when (listp rules) (loop for i in rules always (listp i))) (error "malformed rules ~a, must be of type '((1 (2 1)) (2 (1 2)))" rules)) (unless (when (listp ratios) (loop for i in ratios always (listp i))) (error "malformed ratios ~a, must be of type '((1 .2) (2 .6))" ratios)) (unless (= (length rules) (length ratios)) (error "malformed rules and ratios, should be the same length not ~a and ~a" (length rules) (length ratios))) (make-instance 'fractal-structure :id (or id seed) :data (funcall type duration seed rules ratios smallest) :seed seed :type type :rules rules :ratios ratios :depends-on-total-length (unless fixed-duration (when (= duration *total-duration*) t)))) ;; *** visualize-structure ;;; use the imago library to visualize the structure. (load (probe-file (format nil "~a~a" *src-dir* "show-structure.lsp"))) ;;;; EOF structure.lsp
5,170
Common Lisp
.l
137
33.59854
80
0.666268
Leon-Focker/layers
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
46af10c4687d79eb2638de433f4aec1233f9036aee9caffdf04452b192c14d77
26,246
[ -1 ]
26,247
fplay.lsp
Leon-Focker_layers/src/fplay.lsp
;; ** fplay (in-package :ly) #| ;; *** dynamic-collect ;;; give any amount of arguments to a collect in a loop in a macro :) ;;; naybe useless? (defmacro dynamic-collect (&rest rest) `(loop for i in (quote ,rest) collect 'collect collect i)) (defmacro dynamic-collect-ls (rest) `(loop for i in ,rest collect 'collect collect i)) |# ;; *** name-var ;;; name a variable after the following scheme: ;;; i = 1 => name, i = 2 => name2, i = 3 => name3 ... (defmacro name-var (name i) `(progn (unless (symbolp ,name) (error "name must be a symbol in name-var: ~a" ,name)) (unless (numberp ,i) (error "i must be an number in name-var: ~a" ,i)) (if (<= ,i 1) ,name (read-from-string (format nil "~a~a" ,name ,i))))) ;; *** name-var-highest (defmacro name-var-highest (name i arg-list) `(let* ((ass (assoc ,name ,arg-list)) (len (1- (length ass))) (n (min ,i len))) (name-var ,name n))) ;; *** get-loop-vars ;;; return a list with statements of type 'for var-name = var-def' ;;; arg-list - list of lists, these contain a name for a variable ;;; as first element, then how those varable is defined in the loop ;;; if there is more than one definition (eg. the sublist is longer ;;; than 2 elements, (1- length) variables will be created. The first ;;; variable is always called var-name, after that: var-name2, var-name3... ;;; The definition can also be a string and will. ;;; There is one exception: when var-name = time, 'with is used, not 'for. ;;; EXAMPLE #| (get-loop-vars '((time 5) (duration) (rhythm (nth i ls)) (sound 2 "4 then 5"))) => (WITH TIME = 5 FOR RHYTHM = (NTH I LS) FOR SOUND = 2 FOR SOUND2 = 4 THEN 5) |# (defmacro get-loop-vars (arg-list) `(progn (unless (listp ,arg-list) (error "arg-list in get-loop-vars must be a list: ~a" ,arg-list)) (loop for el in (loop for var in ,arg-list for len = (length var) for var-name = (first var) for substring = (when (> (length (string var-name)) 3) (subseq (string var-name) 0 4)) for flag = (or (equal "TIME" substring)) do (unless (symbolp var-name) (error "invalid name for a variable: ~a" var-name)) (when (> len 10) (warn "are you sure about ~a different instances of ~a?" len var-name)) append (when (> len 1) (loop for i from 1 for var-def in (cdr var) collect (if flag 'with 'for) collect (name-var var-name i) collect '= collect var-def))) append (if (stringp el) (string-to-list el) (list el))))) ;; *** merge-var-lists ;;; push elements from list 'from into list 'into, but only if no sublist with ;;; the same first element is already in 'into. (defmacro merge-var-lists (from into) `(progn (unless (and (listp ,from) (listp ,into)) (error "from and into in merge-var-lists must be lists: ~a, ~a" ,from ,into)) (loop for el in ,from unless (assoc (first el) ,into) do (push el ,into)))) ;; *** fplay-get-loop-vars ;;; this is basically the body of fplay: ;;; collects all variable names and definitions that are needed for fplay ;;; and then generates them using #'get-loop-vars. There's probably still a few ;;; bugs that I haven't discovered yet. ;;; no pretty error message if sound is nil and file doesnt get anything useful (defmacro fplay-get-loop-vars (start-time end-time arg-list) `(progn (loop for i in ,arg-list unless (listp i) do (error "argument ~a in fplay is malformed." i)) (let* ((max-len (1- (apply #'max (mapcar #'length ,arg-list)))) ;; to render only some voices, enable these and replace max-len ;(from (or (second (assoc 'from ,arg-list)) 1)) ;(to (or (second (assoc 'to ,arg-list)) max-len)) (rthm (assoc 'rhythm ,arg-list)) (tim (assoc 'time ,arg-list)) (con (assoc 'condition ,arg-list)) (snd (assoc 'sound ,arg-list)) (print (assoc 'printing ,arg-list)) (total-times (max 2 (length rthm) (length tim))) (all-vars '())) ;; add as many 'time, 'condition, and 'line variables as needed (merge-var-lists (list (loop for i from 0 below total-times collect (if (= 0 i) 'time (if tim (nth (1- (min i (1- (length tim)))) (cdr tim)) ,start-time))) (loop for i from 0 below total-times collect (if (= 0 i) 'condition (if con (nth (1- (min i (1- (length con)))) (cdr con)) `(<= ,(name-var 'time i) ,,end-time)))) (loop for i from 0 below total-times collect (if (= 0 i) 'line `(/ (- ,(name-var 'time i) ,,start-time) (- ,,end-time ,,start-time))))) all-vars) ;; get user-defined variables in the mix (merge-var-lists ,arg-list all-vars) ;; starting with some stubs for error messages, not sure yet if this is ;; usefull, since more often than not i will first run into an error and ;; then eval this. #+nil(merge-var-lists (list (loop for i from 0 below (max 2 (length snd)) collect (if (= 0 i) 'errors `(unless ,(name-var 'sound i) (error "~a is nil at i = ~a" ',(name-var 'sound i) i))))) all-vars) ;; add sufficient 'file variables (merge-var-lists (list (loop for i from 0 below (max 2 (length snd)) collect (if (= 0 i) 'file `(path ,(name-var 'sound i))))) all-vars) ;; add all other variables that are not set through arg-list (merge-var-lists `((sfl nil) (sound nil) (rhythm (1+ ,,end-time)) (duration nil) (reflect nil) (reverse nil) (start 0) (end 0) (srt 1) (width 5) (srt-env '(0 0 100 0)) (srt-scaler 1.0) (amp 1.0) (amp-env '(0 1 100 1)) (degree 45) (distance 0) (rev-env '(0 1 100 1)) (rev-amt 0) (channel 0) (out-channels nil) (printing nil)) all-vars) ;; get all neccessary variables: (append (get-loop-vars (reverse all-vars)) ;; while: (append '(while) (list (loop for i from 0 below (max 2 (length rthm)) collect (if (= 0 i) 'or (name-var 'condition i))))) ;; error cases: `(do ,@(loop for i in '(rhythm file) collect `(unless ,i (error "~&~a returned with nil in fplay" ',i))) ,@(loop for i from 1 to max-len collect `(when (and ,(name-var-highest 'duration i all-vars) (<= ,(name-var-highest 'duration i all-vars) 0.0001)) (setf ,(name-var-highest 'condition i all-vars) nil)))) ;; instrument calls: (loop for i from 1 to max-len append (list 'when (name-var-highest 'condition i all-vars) 'collect `(funcall (lambda () (samp0 ,(name-var-highest 'file i all-vars) ,(name-var-highest 'time i all-vars) :duration ,(name-var-highest 'duration i all-vars) :reflect ,(name-var-highest 'reflect i all-vars) :reverse ,(name-var-highest 'reverse i all-vars) :start ,(name-var-highest 'start i all-vars) :end ,(name-var-highest 'end i all-vars) :srt ,(name-var-highest 'srt i all-vars) :width ,(name-var-highest 'width i all-vars) :srt-env ,(name-var-highest 'srt-env i all-vars) :srt-scaler ,(name-var-highest 'srt-scaler i all-vars) :amp ,(name-var-highest 'amp i all-vars) :amp-env ,(name-var-highest 'amp-env i all-vars) :degree ,(name-var-highest 'degree i all-vars) :distance ,(name-var-highest 'distance i all-vars) :rev-env ,(name-var-highest 'rev-env i all-vars) :rev-amt ,(name-var-highest 'rev-amt i all-vars) :channel ,(name-var-highest 'channel i all-vars) :out-channels ,(name-var-highest 'out-channels i all-vars) :printing nil ))))) ;; printing: `(do ,@(loop for i from 1 to max-len when (nth (max 0 (1- (min i (1- (length print))))) (cdr print)) collect `(when ,(name-var-highest 'condition i all-vars) (format t "~&time: ~a" ,(name-var-highest 'time i all-vars)) (when (equal (type-of ,(name-var-highest 'sound i all-vars)) 'stored-file) (format t "~&sound: ~a" (id ,(name-var-highest 'sound i all-vars)))) (format t "~&duration: ~a" ,(name-var-highest 'duration i all-vars)) (format t "~&srate-conversion: ~a" ,(name-var-highest 'srt i all-vars)) (format t "~&reverse: ~a" ,(name-var-highest 'reverse i all-vars)) (format t "~&degree: ~a" ,(name-var-highest 'degree i all-vars)))) ;; increasing the different times: ,@(loop for i from 1 to (1- (length (assoc 'time all-vars))) collect `(incf ,(name-var 'time i) ,(name-var-highest 'rhythm i all-vars)))))))) ;; *** fplay ;;; A very handy Macro to call samp0 instrument for use in clm ;;; start-time - the initial value for 'time (see below) ;;; end-time - when 'time is > end-time, the loop stops. ;;; REST: All following arguments should be of type list and will create lexical ;;; variables. Like for #'let the first element should be the name for the ;;; variable and the next argument is how it shall be defined. However the list ;;; can be as long as you want. For every definition another variable is ;;; created. For example: (rhythm 2 1) would create rhythm and define it as 2 ;;; and also rhythm2 and define it as 1. The variables can have any name, but ;;; some names already have a meaning within fplay. fplay will create n calls ;;; to samp0, where n is the maximum length of definitions for a variable. So ;;; if you define 'rhythm as (rhythm 2 1 (nth (mod i 2) '(3 4))), at least ;;; three different calls to samp0 are generated. If some variables have less ;;; definitions than others, the last one will be used. ;;; The following variables are always created internally by fplay and can also ;;; be used within the variables the user defines. 'Time and 'condition can ;;; also be altered. ;;; time - this is given to samp0 as time argument and will be increased by ;;; 'rhythm at the end of each iteration. 'time usually starts at 'start-time. ;;; condition - while this is t, the loop keeps going. ;;; Usually is (<= time end-time) ;;; line - this is basically defined as (/ passed-time entire-time), but ;;; depends on start-time and end-time. I treat it as the 'x value for any ;;; function that wants to know the relative time within fplay. If you ;;; don't modify 'time this should always be within 0 and 1. ;;; These variable-names have a predefined meaning within fplay but cannot be ;;; used within the definition of user-defined variables unless they are ;;; previously defined by the user: ;;; file - this is given to samp0 as its file argument and should be a path ;;; pointing to a soundfile. Its initial definition is (path sound) ;;; sound - this is a variable designed to hold a stored-file (see :layers). ;;; Initially defined as (first (data sfl)). ;;; sfl - a stored-file-list (see :layers). This can be thought of as the ;;; 'sample-library' that is used. But can also be totally ignored. ;;; rhythm - the time between this call to samp0 and the next one. 'Time ;;; will be increased by 'rhythm at the end of each iteration. However ;;; this is not neccessarily how long the sample will be played. ;;; If this is not provided, the sample should only play once. ;;; printing - when t, print sound, duration and time for isntrument call. ;;; If you want to access one of samp0's key-argument you can do so by ;;; creating a variable with the same name. For example: ;;; duration - how long the sample will be played. This is passed to samp0 as ;;; the :duration key-argument. Initially defined as nil - the sample will ;;; be played entirely. ;;; out-channels - how many channels the soundfile will have. If not specified ;;; this will be 2. For more than two channels locsig assumes them to be ;;; arranged in an equally spaced circle. ;;; ;;; For exemplary uses see https://github.com/Leon-Focker/feedback (defmacro fplay (start-time end-time &body body) `(progn (unless (and (numberp ,start-time) (numberp ,end-time)) (error "start-time and end-time must be numbers in fplay: ~a, ~a" ,start-time ,end-time)) (loop for i from 0 ,@(fplay-get-loop-vars start-time end-time body))))
12,176
Common Lisp
.l
260
42.207692
80
0.644183
Leon-Focker/layers
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
cc31a3ecce01717cff7ebafe6f306768189064113b3eb8367a7beb35b16f3603
26,247
[ -1 ]
26,248
utilities.lsp
Leon-Focker_layers/src/utilities.lsp
;; ** utilities ;;;; utility functions used in layers (in-package :layers) (defgeneric data (base-object) (:documentation "returns the data of any object")) (defgeneric id (base-object) (:documentation "returns the id of any object")) (defgeneric get-id (base-object) (:documentation "returns the id of any object")) (defgeneric next-trigger (layers-object &key current-time trigger-all) (:documentation "called for triggering new sounds")) #+nil(when *load-risky-files* (load (format nil "~a~a" *src-dir* "export-with-clm.lsp"))) ;; *** conditions (define-condition markov-list-is-nil (error) ((text :initarg :text :reader text))) (define-condition markov-list-is-empty (error) ((text :initarg :text :reader text))) (define-condition no-value (error) ((text :initarg :text :reader text :initform "~&when calling ~a some data was missing: ~&~a"))) (define-condition weird-values (error) ((text :initarg :text :reader text :initform "~&when calling ~a it noticed some weird values in: ~&~a"))) (define-condition id-not-found (error) ((text :initarg :text :reader text))) ;; *** load-from-file (defmethod load-from-file (file) (eval (read-from-file file))) ;; *** start-osc ;;; simple function to open the osc-call (defun start-osc (&optional ip port) (when ip (unless (vectorp ip) (error "ip must be a vector of form #(192 168 56 1) but is: ~a" ip))) (osc-call :send-ip (or ip #(192 168 56 1)) :listen-port (or port 5000) :send-port (or port 5000))) ;; *** layers-has-been-loaded ;;; function with no features whatsoever, other files can check wheter this one ;;; has been loaded by checking wheter this function is defined. (defun layers-has-been-loaded ()) ;; *** set-start-stop ;;; sets the global *start-stop* variable to t or nil (1 or 0 in pd) (defun set-start-stop (val &optional (time-left 0.02)) (declare (special *layers*)) (unless *layers* (error "in set-start-stop, *layers* is nil")) (prog1 (cond ((= val 0) (setf *start-stop* nil) (setf *next-trigger* (- *next-trigger* time-left))) ((= val 1) (setf *start-stop* t) (next-trigger *layers* :trigger-all t)) (t (error "~&set-start-stop got value ~a but needs either a 0 or 1" val))) (format t "~& *start-stop* has been set to ~a" *start-stop*))) ;; *** set-loop ;;; sets the global *loop* variable to t or nil (1 or 0 in pd) (defun set-loop (val) (cond ((= val 0) (setf *loop* nil)) ((= val 1) (setf *loop* t)) (t (error "~&set-loop got value ~a but needs either a 0 or 1" val))) (format t "~& *loop* has been set to ~a" *loop*)) ;; *** set-seed-to ;;; sets seed to new value (defun set-seed-to (seed) (setf *seed* seed) (format t "~& *seed* has been set to ~a" *seed*)) ;; *** set-cloud-radius-to ;;; sets *cloud-radius* to new value (defun set-cloud-radius-to (val) (setf *cloud-radius* val) (when *print-to-console* (format t "~& *cloud-radius* has been set to ~a" *cloud-radius*))) ;; *** get-current-times ;;; get the current-time and timer values from pd (defun get-current-times () (list 'TIMES 1)) ;; *** set-current-times ;;; a way for pd to send the times (defun set-current-times (time timer) (setf *current-time* time *current-timer* timer)) ;; *** set-total-length ;;; sets the global *total-duration* variable to value in seconds (defun set-total-length (len) (setf *total-duration* len) (let ((all-st '())) (loop for lys in *all-layers* do (loop for ly in (data lys) do (pushnew (structure ly) all-st))) (loop for st in all-st do (re-gen-structure st))) ;; ask pd for current time: (list 'TIME-U 1)) ;; *** set-current-times-for-update ;;; send time and then use them for the update (defun set-current-times-for-update (time timer) (setf *current-time* time *current-timer* timer) (update-times *layers* time timer) (format t "~& *total-duration* has been set to ~a" *total-duration*)) ;; *** set-print-to-console ;;; sets the globals *print-to-console* variable (defun set-print-to-console (val) (cond ((= val 0) (setf *print-to-console* nil)) ((= val 1) (setf *print-to-console* t)) (t (error "~&set-print-to-console got value ~a~ but needs either a 0 or 1" val))) (format t "~& *print-to-console* has been set to ~a" *print-to-console*)) ;; *** set-use-sample-clouds ;;; sets the global *total-duration* variable to value in seconds (defun set-use-sample-clouds (val) (cond ((= val 0) (setf *use-sample-clouds* nil)) ((= val 1) (setf *use-sample-clouds* t)) (t (error "~&set-use-sample-clouds got value ~a~ but needs either a 0 or 1" val))) (format t "~& *use-sample-clouds* has been set to ~a" *use-sample-clouds*)) ;; *** set-x-y-z ;;; sets the global *total-duration* variable to value in seconds (defun set-x-y-z (x y z) (setf *x-y-z-position* (vector x y z)) (when *print-to-console* (format t "~& *x-y-z-position* has been set to ~a" *x-y-z-position*))) ;; *** set-timer ;;; sets timer within pure data to value in ms, usually next-trigger is used to do this. (defun set-timer (time) (unless (numberp time) (error "time in set-timer must be a number")) (list 'timer time)) ;; *** current-timer ;;; can probably be deleted: ;;; when offsetting the timer, this function is called to check, wheter triggers ;;; need to be skipped (because they already should have happened) and another ;;; offset needs to be added to the timer, because it currently is negative #+nil(defun current-timer (current-timer) (unless (> current-timer 0) (;; skip next trigger points and get new offset (list 'timer-offset offset!!!!!!!!!!!!)))) ;; *** decider ;;; gets (random) value as chooser between 0 and 1 and a list ;;; of odds. Will return index of chosen element ;;; this was added to slippery chicken! #| (defun decider (chooser ls) (labels ((helper (chooser ls1 index sum) (cond ((null ls1) (1- (length ls))) ((< chooser sum) index) (t (helper chooser (cdr ls1) (+ index 1) (+ sum (rationalize (car ls1)))))))) (helper (sc::rescale (rationalize chooser) 0 1 0 (loop for i in ls sum (rationalize i))) (cdr ls) 0 (rationalize (car ls))))) |# ;; *** remove-nth ;;; remove nth element from list (defun remove-nth (n list) (declare (type (integer 0) n) (type list list)) (if (or (zerop n) (null list)) (cdr list) (cons (car list) (remove-nth (1- n) (cdr list))))) ;; *** nth-mod ;;; nth element from a list but if n > (length list), loop contents of list. (defun nth-mod (n ls) (nth (mod n (length ls)) ls)) ;; *** rotate ;;; rotate a list so that it starts with the specified index. (defun rotate (ls &optional (new-start-index 1)) (let* ((len (length ls)) (effective-index (mod new-start-index len))) (append (subseq ls effective-index) (subseq ls 0 effective-index)))) ;; *** push-key-value ;;; push a key-value pair to a (p)list. (defmacro push-key-value (key value place) `(progn (push ,value ,place) (push ,key ,place))) ;; *** setf-key-value ;;; set key to value in (p)list. (defmacro setf-key-value (plist key value) `(setf (getf ,plist ,key) ,value)) ;; *** re-order ;;; take a list and a new-order as input. The latter should be a list of ;;; indices, which will then be used to re-order the first list. If the ;;; new-order list is not long enough, all elements that have not been used will ;;; be appended. If some index in new-order is too big, the mod will be taken. ;;; If the same index appears twice, the element following the already chosen ;;; one will be taken. ;;; (re-order '(a b c d e) '(4 1 3 2 0)) => '(e b d c a) ;;; (re-order '(a b c d e) '(3 4 1)) => '(d e b a c) ;;; (re-order '(a b c d e) '(2 3 4 6 0 1)) => '(c d e b a) ;;; (re-order '(a b c d e) '(0 3 7 0 7 3 5)) => '(a d c b e) ;;; (re-order '(a b c d e) '(0 0 0)) => '(a b c d e) (defun re-order (ls new-order) (let* ((len (length ls)) (all-i (loop for i from 0 below len collect i))) (append (loop repeat len for index in new-order for j from 0 collect (do ((n (mod index len) (mod (+ n 1) len))) ((member n all-i) (progn (when (member n all-i) (setf all-i (remove n all-i))) (nth n ls))))) (loop for n in all-i collect (nth n ls))))) ;; *** depth ;;; the depth of a (possibly) nested list (defun depth (ls) (labels ((iter (ls level) (if (listp ls) (let ((sublevels '())) (dolist (s ls) (push (iter s (1+ level)) sublevels)) (apply #'max (cons level sublevels))) level))) (iter ls 0))) ;; *** rqq-depth (defun rqq-depth (ls) (apply #'max (labels ((iter (ls level) (loop for div in ls append (if (listp div) (iter (second div) (1+ level)) (list level))))) (iter (second ls) 0)))) ;; *** normalize-depth ;;; Modifies a list, wrapping parts of it in new lists, ;;; so that every element is at uniform depth. (defun normalize-depth (ls &optional (in-place t)) (unless in-place (setq ls (copy-seq ls))) (let ((max-depth (loop for element in ls maximize (depth element)))) (loop for i below (length ls) do (loop while (< (depth (nth i ls)) max-depth) do (setf (nth i ls) (list (nth i ls))))) (loop for element in ls do (when (listp element) (normalize-depth element))) ls)) ;; *** mirrors ;;; formerly calles alternating-modulo ;;; mirrors input value between min and max value (defun mirrors (value min max) (labels ((helper (val) (cond ((> val max) (helper (- max (- val max)))) ((< val min) (helper (+ min (- min val)))) (t val)))) (helper value))) ;; *** get-start-times (defun get-start-times (list-of-durations) (loop for i in list-of-durations and sum = 0 then (+ sum i) collect sum)) ;; *** get-durations ;;; collect the durations in a certain section of a certain layer (defun get-durations (list-of-start-times) (let ((ls (avoid-repetition (sort list-of-start-times #'<) t))) (loop for time in (cdr ls) with last = (car ls) collect (- time last) do (setf last time)))) ;; *** get-durations-within ;;; collect the durations in a certain section of a certain layer (defun get-durations-within (durations min max) (loop for i in durations sum i into sum while (< sum max) when (> sum min) collect i)) ;; *** get-start-times-within ;;; collect the start-times in a certain section of a certain layer (defun get-start-times-within (durations min max) (loop for i in durations sum i into sum while (< sum max) when (> sum min) collect sum)) ;; *** scale-list-to-sum ;;; scale the elements in a list so that the sum of that list is *argument* (defun scale-list-to-sum (ls &optional (target-sum 1)) (let* ((sum (loop for i in ls sum (rationalize i))) (scaler (/ target-sum sum))) (loop for i in ls collect (* i scaler)))) ;; *** avoid-repetition ;;; in a list of elements, when an element appears twice in a row it is cut (defun avoid-repetition (ls &optional within-tolerance?) (loop for i in ls with last unless (if within-tolerance? (equal-within-tolerance last i 1.0d-5) (equal last i)) collect i do (setf last i))) ;; *** insert ;;; insert an element into list at index (defun insert (ls index newelt) (if (= 0 index) (push newelt ls) (push newelt (cdr (nthcdr (1- index) ls)))) ls) ;; *** insert-multiple ;;; insert multiple elements on multiple indices in a list (defun insert-multiple (ls index-list newelt-list) (let* ((len (length newelt-list))) (unless (= (length index-list) len) (error "both index-list and newelt-list in insert-multiple should have ~ the same length")) (loop for i from 0 and el in ls when (member i index-list) append (loop for j in index-list and new in newelt-list when (= i j) collect new) collect el))) ;; *** dry-wet (defun dry-wet (dry wet mix) (let ((mix (min 1 (max mix 0)))) (+ (* wet mix) (* dry (- 1 mix))))) ;; *** soundfile-duration ;;; get the duration of a soundfile in seconds (defun soundfile-duration (path) (clm::sound-duration path)) ;; *** soundfile-framples ;;; get the number of framples (number of samples / channels) (defun soundfile-framples (path) (clm::sound-framples path)) ;; *** soundfile-samplerate ;;; samplerate of the soundfile (defun soundfile-samplerate (path) (clm::sound-srate path)) ;; *** biggest-jump ;;; discrete derivation maximum i guess? (defun biggest-jump (ls) (loop for i in (cdr ls) with last = (car ls) maximize (abs (- last i)) do (setf last i))) ;; *** biggest-jump-up (defun biggest-jump-up (ls) (loop for i in (cdr ls) with last = (car ls) maximize (- i last) do (setf last i))) ;; *** biggest-jump-down (defun biggest-jump-down (ls) (loop for i in (cdr ls) with last = (car ls) maximize (- last i) do (setf last i))) ;; *** reduce-by ;;; reduces a list by factor (100 elements to 10 elements, factor 10) ;;; using averages (defun reduce-by (ls &optional (factor 10)) (unless (integerp factor) (error "reduce-by needs a factor that is an integer, not ~a" factor)) (let* ((new '())) (loop for i from 1 and e in ls with sum = 0 do (incf sum (/ e factor)) (when (= (mod i factor) 0) (push sum new) (setf sum 0))) (reverse new))) ;; *** get-beat-prox ;;; check how close a number is to a "beat" aka an even subdivision of 1 ;;; => As I now know, this is basically a variation on Thomae's function, ;;; but with a set amount of levels and inverted weighting (ON the beat = 0) ;;; (loop for i from 0 to 1 by .125 collect (get-beat-prox i)) ;;; => (0 3 2 3 1 3 2 3 0) ;;; ;;; (visualize (loop for i from 0 to 1 by .01 collect (get-beat-prox i 7))) ;;; " _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _" ;;; " _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ " ;;; " " ;;; " __ _ _ _ _ _ _ __ " ;;; " _ _ _ _ " ;;; " _ _ " ;;; " " ;;; " _ " ;;; "_ " (defun get-beat-prox (i &optional (how-many-levels 4)) ;;(unless (<= 0 i 1) (error "i must be between 0 and 1, not ~a" i)) (unless (and (integerp how-many-levels) (< 1 how-many-levels 100)) (error "silly value for how-many-levels: ~a" how-many-levels)) (round (log (denominator (rational (/ (round (* (mod i 1) (expt 2 (1- how-many-levels)))) (expt 2 (1- how-many-levels))))) 2))) ;; alias (setf (symbol-function 'beat-proximity) #'get-beat-prox) (setf (symbol-function 'thomaes-function) #'get-beat-prox) ;; *** rqq-to-indispensability and rqq-to-indispensability-function ;;; This is basically a really flexible and complicated version of ;;; get-beat-prox, inspired by Clarence Barlows rhythm theory of ;;; indispensibility and Marc Evansteins implementation of it. ;;; Instead of repeatedly splitting a bar into halfs, as get-beat-prox does ;;; it, you can specify any division of a bar by using rqq notation. ;;; Also, every beat (or division) has a unique weight. ;;; Compare this: ;;; ;;; (loop for i from 0 to 1 by .125 collect (get-beat-prox i)) ;;; => (0 3 2 3 1 3 2 3 0) ;;; ;;; (loop for i from 0 to 1 by 0.125 collect ;;; (funcall (rqq-to-indispensability-function ;;; '(2 ((2 ((2 (1 1)) (2 (1 1)))) (2 ((2 (1 1)) (2 (1 1))))))) i)) ;;; => (0 7 3 5 1 6 2 4 0) ;;; ;;; (loop for i from 0 to 1 by 0.125 collect ;;; (funcall (rqq-to-indispensability-function ;;; '(8 (1 1 1 1 1 1 1 1))) i)) ;;; => (0 7 6 5 4 3 2 1 0) ;;; ;;; when step-function? is t, don't interpolate between values ;;; ;;; RETURNS a function, whose input should be a number (defun rqq-to-indispensability-function (rqq &optional step-function?) (let* ((dur-list (rqq-to-durations rqq)) (sum (loop for i in dur-list sum i)) (indis (rqq-to-indispensability rqq)) (env '())) (setf dur-list (mapcar #'(lambda (x) (/ x sum)) dur-list)) (setf env (loop for dur in (append dur-list '(0)) and y in (append indis (first (list indis))) collect x collect y sum dur into x)) (if step-function? (lambda (x) (nth (decider (mod x 1) dur-list) indis)) (lambda (x) (envelope-interp (mod x 1) env))))) (defun rqq-to-durations (rqq) (mapcar #'(lambda (x) (/ 1 x)) (mapcar #'parse-rhythm-symbol (car (parse-rhythms (rqq-divide rqq) .35))))) (defun indispensability-enumerate (ls) (let* ((fls (flatten ls)) (new-ls (copy-list fls)) (len (length fls)) (mx (apply #'max fls))) (loop for i from 0 to mx with backwards with cnt with n = 0 do (setf cnt (count i fls)) ;; Stellschraube: wann backwards t (setf backwards (> i 0)) (if (<= cnt 2) (loop for el in (if backwards (reverse fls) fls) for j from 0 do (when (= i el) (setf (nth (if backwards (- (1- len) j) j) new-ls) n) (incf n))) (loop for el in (reverse fls) for j downfrom (1- len) with k = 0 with m = n do (when (= i el) (setf (nth j new-ls) (if (and (not backwards) (= k (1- cnt))) m (if backwards n (1+ n)))) (incf n) (incf k))))) new-ls)) ;; *** rqq-to-indispensability ;;; (defun rqq-to-indispensability (rqq) (labels ((iter (ls) (let* ((len (length ls)) (ls (if (<= len 2) (loop for el in ls with i = 0 collect (if (listp el) (iter (second el)) (prog1 i (incf i)))) ; incf always? (loop for el in ls for k from 0 for i = 0 then (- len k) collect (if (listp el) (iter (second el)) i))))) (indispensability-enumerate ls)))) (iter (second rqq)))) ;; *** apply-indispensability ;;; returns the amplitude values for a list of rhythms according to an ;;; indispensability function: ;;; beats: a list of durations. These durations are kind of like bars, ;;; in that the indispensability-function is applied to each of these durations ;;; if there is more rhythms than bars to be filled they are ignored. ;;; rhythms: a list of durations, for which we want to get a list of ;;; amplitude-values. If there are more bars to be filled than available ;;; rhythms, they are ignored. ;;; indispensability-function: a function that returns an amplitude value ;;; for an input value (x) between 0 and 1. ;;; See #'rqq-to-indispensability-function. ;;; returns a list of numbers. (defun apply-indispensability (beats rhythms indispensability-function) (let* ((duration (apply #'+ beats))) (loop for rthm in rhythms for sum = 0 then (+ sum rthm) until (>= sum duration) with beat-sum = 0 with last-beat-i = 0 for progress = (rationalize (/ sum duration)) for current-beat-i = (decider progress beats) for current-beat = (nth current-beat-i beats) with position = 0 do (unless (= current-beat-i last-beat-i) (incf beat-sum (nth last-beat-i beats)) (setf last-beat-i current-beat-i)) ;; position in current beat: (setf position (- sum beat-sum)) collect (funcall indispensability-function (rationalize (/ position current-beat)))))) ;; *** list-interp ;;; looks at a list as a series of y values, spaced equally from 0 to max-x ;;; give any rational x to return interpolated result between two y values (defun list-interp (x list &optional (max-x (1- (length list)))) (let* ((len (1- (length list))) last-y next-y inter) (cond ((<= x 0) (first list)) ((>= x max-x) (car (last list))) (t (setf last-y (nth (floor (* (/ x max-x) len)) list) next-y (nth (ceiling (* (/ x max-x) len )) list) inter (mod (* (/ x max-x) len) 1)) (+ (* inter next-y) (* (- 1 inter) last-y)))))) ;; *** make-list-into-function ;;; curried list-interp (defun make-list-into-function (list duration) ; &optional last-at-what-x) (lambda (x) (list-interp x list duration))) ;; alias (setf (symbol-function 'list-to-function) #'make-list-into-function) ;; *** lists-to-envelopes ;;; combine a list of x-values and one of y-values into an envelope (defun lists-to-envelopes (x-list y-list) (unless (= (length x-list) (Length y-list)) (error "the lists given to lists-to-envelopes should be of the same length ~ but are of length: ~a and ~a" (length x-list) (length y-list))) (let* ((envelopes '())) (loop for x in x-list and y in y-list with new-env with last-x = 0 do (when (< x last-x) (push (reverse new-env) envelopes) (setf new-env '())) (push x new-env) (push y new-env) (setf last-x x) finally (push (reverse new-env) envelopes)) (reverse envelopes))) ;; *** make-function-into-env (defun make-function-into-env (function &optional (from 0) (to 1) (step .1)) (unless (and (numberp from) (numberp to) (numberp step)) (error "from, to and step in #'make-function-into-env must be a number")) (unless (<= from to) (error "'from' should be <= than 'to' but they are: ~a ~a" from to)) (loop for x from from to to by step collect x collect (funcall function x))) ;; alias (setf (symbol-function 'function-to-env) #'make-function-into-env) ;; *** combine-envelopes ;;; take a list of envelopes and a list of durations and combine all ;;; envelopes into one. #| (combine-envelopes '((0 0 1 1) (0 3 5 3)) '(5 5)) => '(0.0 0 5.0 1 5.0001 3 10.0 3) |# (defun combine-envelopes (list-of-envelopes list-of-durations) (unless (= (length list-of-envelopes) (length list-of-durations)) (error "list-of-envelopes and list-of-durations should be the same length: ~ ~&~a ~a" list-of-envelopes list-of-durations)) (let* ((starts (cons 0 (loop for i in list-of-durations sum i into sum collect sum)))) (setf list-of-envelopes (loop for s in starts and e in (cdr starts) and env in list-of-envelopes and i from 0 do (when (> i 0) (setf s (+ s .0001))) collect (scale-env env 1 :first-x s :last-x e))) (flatten list-of-envelopes))) ;; *** flatness-of-list ;;; this might not be useful at all for anything but spectra (spectral flatnes) (defun flatness-of-list (ls) (let ((arithmetic-mean 0) (geometric-mean 0) (len (length ls))) (loop for i in ls do (when (= i 0) (setf i 0.000001)) (incf arithmetic-mean i) (incf geometric-mean (log i))) (setf arithmetic-mean (/ arithmetic-mean len)) (setf geometric-mean (exp (/ geometric-mean len))) (/ geometric-mean arithmetic-mean))) ;; *** find-with-id ;;; loop through list of objects, looking for object with specific id (defun find-with-id (id ls) (let* ((res (loop for el in ls do (when (eq id (get-id el)) (return el))))) (unless res (error 'id-not-found :text (format nil "~&id ~a not found in given list" id))) res)) ;; *** distance-between-points ;;; distance between two points p1 and p2, ;;; both need to be vectors with the same length (defun distance-between-points (p1 p2) (unless (and (vectorp p1) (vectorp p2) (= (length p1) (length p2))) (error "~&both arguments need to be same-length vectors in function ~ distance-between-points, ~%args: ~a ~a" p1 p2)) (sqrt (loop for q across p1 and p across p2 sum (expt (- q p) 2.0)))) ;; *** max-of-array ;;; max of an array (defun max-of-array (array &optional abs?) (loop for i across array maximize (if abs? (abs i) i))) ;; *** max-of-array-with-index ;;; max of an array and the index at which it first occurs (defun max-of-array-with-index (array &optional abs?) (loop for i from 0 and el across array with max = 0 with max-i when (> (if abs? (abs el) el) max) do (setf max el max-i i) finally (return `(,max ,max-i)))) ;; *** multiply-arrays ;;; copied from Common Lisp Music - for some reason they got rid of this... (defun multiply-arrays (rdat window) (let ((len (min (length rdat) (length window)))) (loop for i from 0 below len do (setf (aref rdat i) (* (aref rdat i) (aref window i)))) rdat)) ;; *** get-spectral-centroid ;;; calulate the spectral centroid out of a list of frequency-magnitude pairs ;;; eq.: '((440 0.5) (630 0.46) (880 0.25)) (defun get-spectral-centroid (list-of-pairs) (let ((centroid 1)) (loop for pair in list-of-pairs sum (* (car pair) (cadr pair)) into sum1 sum (cadr pair) into sum2 do (setf centroid (/ sum1 sum2))) centroid)) ;; *** visualize stuff :) ;;; array or list as input (defun visualize (ls &key y-range (start 0) abs (scale t)) (when (arrayp ls) (setf ls (loop for i across ls collect i))) (when abs (setf ls (loop for i in ls collect (abs i)))) (let* ((matrix (make-array '(64 17) :initial-element 0.0)) (maxi (apply #'max (mapcar #'abs ls))) (y-range (if y-range y-range (if (= maxi 0) 1 maxi))) (len (length ls)) (size (if (or scale (>= (- len start) 64)) 64 (- len start)))) (loop for i from start below (+ size start) do (loop for j below 17 do (if (= (round (+ (* (/ (nth (mod (floor (+ start (if scale (* (/ i size) (- len start)) i))) len) ls) y-range) 8 (if abs 2 1)) (* 8 (if abs 0 1)))) j) (setf (aref matrix (- i start) j) 1) (setf (aref matrix (- i start) j) 0)))) (loop for j downfrom 16 to 0 do (print (apply 'concatenate 'string (loop for i below 64 collect (if (= (aref matrix i j) 1) "_" " "))))) "=)")) ;; *** taylor-polynom ;;; get taylor polynomial, pls check this again, probably false (defun second-order-taylor (ls x) (let* ((len (length ls)) (n (floor (* x len))) ;; list as function (f1 #'(lambda (n) (nth n ls))) ;; crooked derivative function (f2 #'(lambda (f n) (/ (- (funcall f (1+ n)) (funcall f (1- n))) (/ 2 len)))) (a (funcall f1 n)) (b (funcall f2 f1 n)) (c (funcall f2 #'(lambda (n) (funcall f2 f1 n)) n)) ) (lambda (x) (+ a (* b x) (* c (expt x 2)))))) ;; *** second-order-taylor-rotated ;;; bs function, not needed for now #+nil(defun second-order-taylor-rotated (ls x) (let* ((len (length ls)) (n (floor (* x len))) ;; list as function (f1 #'(lambda (x) (decider (/ x len) ls))) ;; crooked derivative function (f2 #'(lambda (f n) (/ (- (funcall f (1+ n)) (funcall f (1- n))) (/ 2 len)))) (a (funcall f1 n)) (b (funcall f2 f1 n)) (c (funcall f2 #'(lambda (n) (funcall f2 f1 n)) n)) ) (lambda (x) (+ a (* b x) (* c (expt x 2)))))) ;;;; EOF utilities.lsp
26,858
Common Lisp
.l
690
35.272464
100
0.619787
Leon-Focker/layers
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
3a9b767629c1dade61576a220091ddee5a93609b3a0778d2200fc18d6319c28e
26,248
[ -1 ]
26,249
generate-structure.lsp
Leon-Focker_layers/src/generate-structure.lsp
;; ** generate-structure ;;;; creating structures and structure-objects ;;;; TODO: error cases for lindenmayer and compartmentalise (in-package :layers) ;; *** scale-nested-to ;;; scale all values in the recursive structure to wanted length. ;;; returns flattened list (defun scale-nested-to (structure target-sum) (scale-list-to-sum (flatten structure) target-sum)) ;; *** lindenmayer ;;; generates a lindenmayer-like recursive list ;;; it's supposed to work in ratios though. ;;; an example of a resulting list could be: ;;; 2nd iteration: '((0.2 1 0.2)) ;;; which means, that the second part is 5 times as long as the other ones ;;; 3rd iteration: '(((5) (25 5) (5))) ;;; which normally should be '((5) (5 1) (5)) but the ratios are multiplied! ;;; the second list is 5 times as long as the other ones, see? ;;; 4th iteration: '((((1 5 1)) ((5 25 5) (25 5)) ((1 5 1)))) and so on... ;;; the arguments: ;;; seed - the starting list ("0th iteration") ;;; rules - set of rules for how each element will be substituted next itertion ;;; ratios - the ratio, that each element represents (defun lindenmayer (total-length seed rules ratios &optional smallest) (let* ((result seed) ; recursive list containing the elements (final 1) ; recursive list containing the ratios (collector '(1))) ; collect all results in this list (labels ((get-lists (res-ls fin-ls) ; define recursive function (if (atom (car res-ls)) ; check if list is still nested ;; if the current res-ls is flat, return two values: (values ;; firstly generate the result list, ;; replacing each element according to given rules (loop for element in res-ls collect (flatten (cadr (assoc element rules)))) ;; secondly generate the final list, by replacing ;; all elements with ratios and scaling them recursively (progn ; needed, since loop itself doesn't return res-ls ;; loop through all elements and check, if they match ;; an element from the replace-list (let ((sum (loop for i in res-ls sum i))) (loop for rep in ratios do (setf res-ls (loop for element in res-ls collect (if (eq (car rep) element) (* (cadr rep) (/ fin-ls sum)) element))))) res-ls)) ; by this point it should act. be called final ;; if the list is still nested, loop through al elements: ;; since we're working with a multiple-value bind, ;; this is a bit of a weird loop. ;; first we'll need two helping variables, since loop itself ;; can't return multiple values (if it can, teach me) (let (help1 help2) ;; now loop through the nested res-list (loop for l in res-ls ;; and through the fin-ls, if it's still nested for i from 0 for b = (if (atom fin-ls) fin-ls (nth i fin-ls)) ;; now we bind the two values that get-lists will return do (multiple-value-bind (r f) (get-lists l b) ;; save those values into the helping variables (progn (push r help1) (push f help2)))) ;; and finally return the two values (values (reverse help1) (reverse help2)))))) ;; loop for how many recursions you like (not more than 20 please) (loop until break for i from 0 with break do (setf (values result final) ; bind the two returned values (get-lists result final)) (push (scale-nested-to final total-length) collector) (when (or (< (apply #'min (car collector)) (or smallest *max-smallest-sample-length*)) ;; we never want more than 20 recursions, though we will ;; probably never even go beyond 10 (> i 20)) (setf break t)))) ;; output ;;(format t "~&next result: ~a" result) ;;(format t "~&final: ~a" final) collector)) ;; *** compartmentalise ;;; similar to lindenmayer but (defun compartmentalise (total-length seed rules ratios &optional smallest) (let* ((result seed) ; recursive list containing the elements (final 1) ; recursive list containing the ratios (collector '(1))) ; collect all results in this list (labels ((get-lists (res-ls fin-ls) ; define recursive function (if (atom (car res-ls)) ; check if list is still nested ;; if the current res-ls is flat, return two values: (values ;; firstly generate the result list, ;; replacing each element according to given rules (loop for element in res-ls collect (flatten (cadr (assoc element rules)))) ;; secondly generate the final list, by replacing ;; all elements with ratios and scaling them recursively (progn ; needed, since loop itself doesn't return res-ls ;; loop through all elements and check, if they match ;; an element from the replace-list (loop for rep in ratios do (setf res-ls (loop for element in res-ls collect (rationalize (if (eq (car rep) element) (cadr rep) element))))) (let ((sum (loop for i in res-ls sum i))) (setf res-ls (loop for element in res-ls collect (* element (/ (rationalize fin-ls) sum))))) res-ls)) ; by this point it should act. be called final ;; if the list is still nested, loop through al elements: ;; since we're working with a multiple-value bind, ;; this is a bit of a weird loop. ;; first we'll need two helping variables, since loop itself ;; can't return multiple values (if it can, teach me) (let (help1 help2) ;; now loop through the nested res-list (loop for l in res-ls ;; and through the fin-ls, if it's still nested for i from 0 for b = (if (atom fin-ls) fin-ls (nth i fin-ls)) ;; now we bind the two values that get-lists will return do (multiple-value-bind (r f) (get-lists l b) ;; save those values into the helping variables (progn (push r help1) (push f help2)))) ;; and finally return the two values (values (reverse help1) (reverse help2)))))) ;; loop for how many recursions you like (not more than 20 please) (loop until break for i from 0 with break do (setf (values result final) ; bind the two returned values (get-lists result final)) (push (scale-nested-to final total-length) collector) (when (or (< (apply #'min (car collector)) (or smallest *max-smallest-sample-length*)) ;; we never want more than 20 recursions, though we will ;; probably never even go beyond 10 (> i 20)) (setf break t)))) ;; output ;;(format t "~&next result: ~a" result) ;;(format t "~&final: ~a" final) collector)) ;;; example: #| (lindenmayer 60 '(2) '((1 ((2 1))) (2 ((3 1 3))) (3 ((2)))) '((1 1) (2 5) (3 .2))) |# ;;;; EOF generate-structure.lsp
6,875
Common Lisp
.l
166
35.746988
79
0.641504
Leon-Focker/layers
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
a6b833f1f1595c6de4a76956a3a7a2a444dc107191667d76a581894e85f13051
26,249
[ -1 ]
26,250
list-object.lsp
Leon-Focker_layers/src/list-object.lsp
;; ** list-object ;;;; basic list object (in-package :layers) ;; *** list-object ;;; just a very basic list object with basic methods (defclass list-object (base-object) ((current :accessor current :initarg :current :type integer :initform 0))) ;; *** get-ids ;;; get the ids of all elements in the list (defmethod get-ids ((lo list-object)) (loop for element in (data lo) collect (id element))) ;; *** see-current ;;; get current element of list (defmethod see-current ((lo list-object)) (when (data lo) (nth (current lo) (data lo)))) ;; *** get-next ;;; proceed to next element of the list (defmethod get-next ((lo list-object)) (when (data lo) (let* ((data (data lo))) (progn (incf (current lo)) (when (= (current lo) (length data)) (setf (current lo) 0)) (nth (current lo) data))))) ;; *** see-next ;;; get next element in a list but don't change the current-slot (defmethod see-next ((lo list-object)) (when (data lo) (let* ((data (data lo)) (n (current lo))) (progn (incf n) (when (= n (length (data lo))) (setf n 0)) (nth n data))))) ;; *** add-to-list (defmethod add-to-list ((lo list-object) &rest elements) (setf (data lo) (append (data lo) elements))) ;; *** see-with-relative-index ;;; get an element from the list with index (+ current relative) ;;; but don't change the current-slot (defmethod see-with-relative-index ((lo list-object) relative-index) (when (data lo) (let* ((data (data lo)) (n (current lo))) (progn (incf n relative-index) (setf n (mod n (length (data lo)))) (nth n data))))) ;;;; EOF list-object.lsp
1,637
Common Lisp
.l
51
29.058824
76
0.642359
Leon-Focker/layers
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
57704dd838f5c2f6c0969dd3993e6d86cd36ad6917dad3440fea073d74fcdb23
26,250
[ -1 ]
26,252
random.lsp
Leon-Focker_layers/src/random.lsp
;; ** random ;;;; some methods for fixed seed random numbers (in-package :layers) ;; *** random-number ;;; stores current pseudo random number and can get the next one (defclass random-number (base-object) ((data :accessor data :initarg :data :type float :initform *seed*) (pcg :accessor pcg :initarg :pcg :initform nil))) ;; *** random-number ;;; make an instance of random-number (defun random-number (&optional seed) (make-instance 'random-number :data (if seed seed *seed*) :pcg (pcg::make-pcg :seed (or seed *seed*)))) ;;; set the global variable *random-number* to an instance of random-number (setf *random-number* (random-number)) ;;; get current value of a random-numer object (defmethod get-number ((rn random-number)) (data rn)) ;; *** get-next ;;; get a random-number object to the next pseudo random number (defmethod get-next ((rn random-number)) (setf (data rn) (pcg::pcg-random (pcg rn) 1.0))) ;; *** set-state ;;; set the random-state of the prng (defmethod set-state ((rn random-number) state) (prog1 (setf (pcg::pcg-state (pcg rn)) state) (get-next rn))) ;;;; EOF random.lsp
1,134
Common Lisp
.l
31
34.290323
75
0.69863
Leon-Focker/layers
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
75d819c4b2b40a0aabd226d1207af893bef2f5c99b2e9770a3ba4edb8a5617ba
26,252
[ -1 ]
26,253
all.lsp
Leon-Focker_layers/src/all.lsp
;; * Layers ;; ** TODO: ;;;; check reset (?) - layer-objects are updated - layers-ojects are not ;;;; variable rest probability multiplier? ;;;; create template ;;;; multichannel? ;;;; build "sets" for songs, smoothly switch between sets, live transistions ;;;; one-time-use of samples? (eg. sample can only be played once every 3 mins) ;;;; dynamic panning ;;;; PD needs to be restarted after every reload. else some timings seem to be ;;;; getting stuck. pls fix :c ;;;; (changing position in coordinate space in Pd, needs function that slowly adjusts ;;;; position (moving average?) as to not jump to a new position) ;;;; -> smoothing factor adjustable in pd ;;;; while analysing soundfile, find better way to determine transients? ;;;; when a layer is triggered (even though the remaining-time is > 0.01) by next-trigger ;;;; and trigger-all is t, it should not start at the begining of the sample but rather skipp ;;;; the already played part. -> tried to implement but is bugged, see #'next-trigger ;;;; better distinction between restart and reload ;;;; set-n is implemented in a kinda dirty way (shouldn't have to call next-trigger) and ;;;; setting n introduces a small general delay, it seems like. ;;;; what if changing the length in pure data, makes some n impossible? because ;;;; reloading with a short length might generate fewer lists in structure... ;;;; reset-layers should actually reset structure etc without having to reload ;;;; what does it currently reset-to? ;;;; make-load-file for sfl: :sfl-when-longer and :sfl-when-shorter and :last-played ;;;; are not saved yet. They should link to an existing sfl/sf, not create a new one. ;;;; #'get-list-of-clm-calls needs a rework ;;;; more interesting xyz mapping ;;;; -> envelope follower, attack count, rms value ;;;; use layers with pd as live version of fplay: ;;;; - (start values) then functions to determine next file and new parameters ;;;; - lists to determine -"- ;;;; stereo-output for each layer? ;;;; usage without clm? ;;;; indispensibility for live - compare to higher n ;;;; tests for midi.lsp, check if some already are in utils? ;;;; Look at sc::import-audio ;;;; CLM file->array etc. could replace some instruments?? (in-package :cl-user) ;; ** Dependencies (unless (and (find-package 'slippery-chicken) (find-package 'clm)) (error "slippery chicken and clm need to be installed and loaded for layers ~ to work...")) (unless (find-package :cl-pcg) (handler-case (ql:quickload :cl-pcg) (error (condition) (error "please make sure that the cl-pcg library is installed correctly" )))) ;; ** Package (defpackage :layers (:use :common-lisp :slippery-chicken) (:nicknames :ly)) (defun ly () (in-package :layers)) (in-package :layers) ;; ** Paths (defparameter *layers-home-dir* (format nil "~A" (asdf:system-source-directory 'layers))) (defparameter *layers-src-dir* (format nil "~asrc/" *layers-home-dir*)) (defparameter *src-dir* *layers-src-dir*) (defun load-layers-src-file (file) (load (format nil "~a~a" *layers-src-dir* file))) ;; ** Load (defun quiet-warning-handler (c) (let ((r (find-restart 'muffle-warning c))) (when r (invoke-restart r)))) ;; clm makes a lot of annoying warnings :c (when (ignore-errors clm::*clm*) (handler-bind ((warning #'quiet-warning-handler)) (load (compile-file (format nil "~a~a" *layers-src-dir* "analysis.lsp"))) ;; Michael Edwards samp1 instrument, but you can select the input channel: ;; It would also be possible to use samp5 (slippery chicken). (load (compile-file (format nil "~a~a" *layers-src-dir* "Samp0.ins"))))) (import '(clm::samp0)) ;;; load all .lsp files (defun load-all () (dolist (file '("globals.lsp" "utilities.lsp" "base-object.lsp" "random.lsp" "list-object.lsp" "markov.lsp" "length-dependant-list.lsp" "generate-structure.lsp" "structure.lsp" "list-of-durations.lsp" "stored-file.lsp" "stored-file-list.lsp" "layer.lsp" "layers.lsp" "morph.lsp" "midi.lsp" "transitions.lsp" "fplay.lsp" )) (load-layers-src-file file))) (load-all) (when (ignore-errors clm::*clm*) (handler-bind ((warning #'quiet-warning-handler)) (load (compile-file (format nil "~a~a" *layers-src-dir* "export-with-clm.lsp"))))) ;; **** Tests ;; to load the test suite, load ".../tests/layers-test-suite.lsp" ;; then (ly-test-test-all) ;; *** export symbols (let ((pack (find-package :layers))) (do-all-symbols (sym pack) ;; these are most of the symbol names that are also found in sc, but since ;; we now use sc in the layers package there should be no clashing... #|(unless (member sym '(id duration data name total get-next rhythms path value this minimum pitch scale env centroid visualize ; double tempo))|# (when (eql (symbol-package sym) pack) (export sym)))) ;) ;; export some symbols that are not exported because they are already in sc etc. (loop for sym in '(data duration) do (export sym)) (format t "~&finished loading layers!") ;;;; EOF all.lsp
5,112
Common Lisp
.l
121
39.338843
94
0.696065
Leon-Focker/layers
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
9778679e131609522909b3f34beb1df2ff62ce2a8ac880fd7743cd6e343dbee7
26,253
[ -1 ]
26,254
midi.lsp
Leon-Focker_layers/src/midi.lsp
;; ** Midi ;;;; Collection of some useful midi input, output and transformation functions (in-package :layers) ;; *** lists-to-midi ;;; generate a midi file from lists of starting points, length, pitch... ;;; if one list is shorter than others it will be wrapped (mod). ;;; Has a lot less features than slippery chickens event-list-to-midi-file, but ;;; in return it's a lot easier and skipps the generation of an event, which ;;; might be favorable in some cases. ;;; pitch-list - A list of either sc-pitches or midi-key-numbers. Can also be a ;;; list of chords, ie. lists of pitches. (defmacro lists-to-midi-aux (pitch) ``(,(if (numberp ,pitch) ,pitch (note-to-midi ,pitch)) ,(nth (mod i start-len) start-time-list) ,(nth (mod i velo-len) velo) ,(nth (mod i duration-len) duration-list) ,(nth (mod i chan-len) channel))) (defun lists-to-midi (pitch-list duration-list start-time-list &key velocity-list (tempo 60) (channel '(0)) (file (format nil "~a~a" *src-dir* "midi-output.mid"))) (when (or (null pitch-list) (null duration-list)) (error "please provide at least one value in the pitch and the duration ~ lists in lists-to-midi")) (unless start-time-list (setf start-time-list (get-start-times duration-list))) (setf channel (force-list channel)) (let* ((pitch-len (length pitch-list)) (duration-len (length duration-list)) (start-len (length start-time-list)) (velo (or velocity-list '(0.7))) (velo-len (length velo)) (chan-len (length channel)) (total (apply #'max `(,pitch-len ,duration-len ,start-len ,velo-len))) (events '())) (setf events (sort (loop for i below total for pitch = (nth (mod i pitch-len) pitch-list) collect (lists-to-midi-aux (if (listp pitch) (car pitch) pitch)) when (listp pitch) append (loop for p in (cdr pitch) collect (lists-to-midi-aux p))) #'(lambda (x y) (< (second x) (second y)))) events (loop for event in events appending (cm::output-midi-note (pop event) 0 (pop event) (pop event) (pop event) (pop event)))) (cm::events (cm::new cm::seq :name (gensym) :time 0.0 :subobjects events) file :tempo tempo))) ;;; old version using event-list-to-midi-file ;;; if the start-time-list is empty, (events-update-time) will be called #| (defun lists-to-midi (pitch-list duration-list start-time-list &key velocity-list (tempo 60) ;;(channel 0) (name "test.mid") dir) (when (or (null pitch-list) (null duration-list)) (error "please provide at least one value in the pitch and the duration ~ lists in lists-to-midi")) (let* ((pitch-len (length pitch-list)) (duration-len (length duration-list)) (start-len (length start-time-list)) (velo (or velocity-list '(0.7))) (velo-len (length velo)) (how-many (apply #'max (list pitch-len duration-len start-len))) (events (loop for i below how-many for start-time = (when start-time-list (nth (mod i start-len) start-time-list)) for pitch = (nth (mod i pitch-len) pitch-list) for duration = (nth (mod i duration-len) duration-list) for velocity = (nth (mod i velo-len) velo) collect (sc::make-event (if (numberp pitch) (sc::midi-to-note pitch) pitch) duration :start-time start-time :duration t :amplitude velocity)))) (unless start-time-list (sc::events-update-time events)) (sc::event-list-to-midi-file events :start-tempo tempo :midi-file (print (format nil "~a~a" (or dir *src-dir*) name))))) |# ;; *** structure-to-midi (defun structure-to-midi (structure &key n dir) (let* ((rhythm-blocks (data structure)) (len (- (length rhythm-blocks) 1)) (pitches (if n (loop repeat (length (nth n rhythm-blocks)) collect (midi-to-note 60)) (loop for i below len append (loop repeat (length (nth i rhythm-blocks)) collect (midi-to-note (- 60 i)))))) (start-times (if n (get-start-times (loop for i in (nth n rhythm-blocks) collect (float i))) (loop for i below len append (get-start-times (loop for i in (nth i rhythm-blocks) collect (float i)))))) (durations (if n (nth n rhythm-blocks) (loop for i below len append (nth i rhythm-blocks))))) (lists-to-midi pitches durations start-times :file (if n (format nil "~a~a~a~a~a~a" (or dir *src-dir*) "structure-" (id structure) "-n-" n ".mid") (format nil "~a~a~a~a" "structure-" (or dir *src-dir*) (id structure) ".mid"))))) ;; *** midi-file-to-list ;;; slippery chickens midi-file-to-events seems to make things more complicated ;;; than need be, so this function just reads the file without making events ;;; !!! notice, that currently there is no tempo argument - so be careful, ;;; that the imported file is already in the right tempo (defun midi-file-to-list (file &optional track) (let* ((cm-midi (cm::parse-midi-file file track))) (remove nil (loop for m in cm-midi collect (typecase m (cm::midi (list (cm::object-time m) (cm::midi-keynum m) (cm::midi-duration m) (cm::midi-amplitude m) (cm::midi-channel m) (+ (cm::object-time m) (cm::midi-duration m))))))))) (setf (symbol-function 'midi-to-list) #'midi-file-to-list) ;; *** find-notes-with-cursor ;;; return all notes (lists with (start key duration...), ;;; that play during the time of cursor. (defun find-notes-with-cursor (cursor list-of-notes) (loop for note in list-of-notes when (<= (first note) cursor (+ (first note) (nth 2 note))) collect note)) ;; *** harmony-filter ;;; takes a midi file, which will then be filtered by a second midi file. ;;; you can define the probability of a note being changed and the detection ;;; range for notes, ie. how close a note in the filter file has to be, ;;; to consider changing the original note to it. ;;; probability can be an envelope of style '(0 1 [...] 1 1) ;;; as can be the detection range. ;;; TODO fixed seed please!;;; (defun harmony-filter (midi-file midi-filter probability detection-range &key track1 track2 (file (format nil "~afiltered_file.mid" *src-dir*)) (seed 1)) (let* ((file1 (midi-file-to-list midi-file track1)) (file2 (midi-file-to-list midi-filter track2)) (probability-env (if (atom probability) (list 0 probability 1 probability) probability)) (detection-range-env (if (atom detection-range) (list 0 detection-range 1 detection-range) detection-range)) (ran-nb (random-number seed)) duration (harmony '()) (result '()) (events '())) ;; make sure both files are sorted by start-time ;; then loop through each note1 in file1 (setf duration (first (car (last file1)))) (loop for note in file1 for start = (nth 0 note) for keyname = (nth 1 note) with last-start2 = 0 for prob = (interpolate (/ start duration) probability-env) for detection = (interpolate (/ start duration) detection-range-env) ;; collect all notes in file2 that areplayed at notes start time do (loop for i from 0 and note2 in (subseq file2 last-start2) for start2 = (first note2) for end2 = (nth 5 note2) while (< start2 start) do (when (> end2 start) (push note2 harmony)) finally (incf last-start2 i)) (setf harmony (remove start harmony :test (lambda (x y) (>= x (nth 5 y))))) ;; decide wheter note is changed, then collect (push (if (and harmony (< (get-next ran-nb) prob)) ;; select closest pitch from harmony (let* ((harm (loop for i in harmony collect (nth 1 i))) (intervals (mapcar (lambda (x) (abs (- x keyname))) harm)) (min (apply #'min intervals)) (closest (nth 1 (nth (position min intervals) harmony)))) ;; if closest is in range, change (if (<= min detection) (replace note (list closest) :start1 1) note)) ;; use original pitch note) result)) ;; sort for time (for cm), then write into midi (setf result (sort result #'(lambda (x y) (< (first x) (first y)))) events (loop for note in result appending (cm::output-midi-note (nth 1 note) 0 (nth 0 note) (nth 3 note) (nth 2 note) (nth 4 note)))) (cm::events (cm::new cm::seq :name (gensym) :time 0.0 :subobjects events) file :tempo 60))) ;; *** deconstruct-chords ;;; Takes a midi file as input, which should consist of chords or some kind of ;;; polyphonie. This function then deconstructs that file, using the ;;; rhythmic-pattern. ;;; file - midi file with chords to deconstruct ;;; rhythmic-pattern - list of durations als rhythms, ie. '(2 1 (2)). Durations ;;; in parens are rests. ;;; longest-duration - if any duration in the final file would be longer that ;;; this, it will be replaced with a nested version of the pattern. ;;; (see #'nested-pattern) ;;; density-env - an envelope with x and y values from 0 to 1. 0 Meaning only ;;; one note will be chose, 1 meaning, all notes will be chosen. ;;; stay-on-note - when true, try to use notes that appeared in the last chord. ;;; TODO: chosing the pitches is a bit trivial and might need a way to vary it. (defun deconstruct-chords (midi-file rhythmic-pattern longest-duration density-env stay-on-note &key midi-track) (let* ((chords (midi-file-to-list midi-file midi-track)) first-note last-note (duration 1) (new-notes '())) ;; sort and set first and last note (setf chords (sort chords #'(lambda (x y) (< (car x) (car y)))) first-note (first chords) last-note (car (last chords)) duration (- (+ (car last-note) (nth 2 last-note)) (car first-note)) rhythmic-pattern (scale-pattern rhythmic-pattern duration) rhythmic-pattern (nested-pattern rhythmic-pattern longest-duration)) ;; divide chords into the rhythmic pattern and look which notes are available (flet ((pred (last) "This sorts items to the front, if they are found in 'last' " (lambda (x y) (or (find x last) (and (not (find x last)) (not (find y last)))))) (density-aux (d len) (1+ (round (* (max (min d 1) 0) (1- len)))))) (loop for rhythm in rhythmic-pattern with time = (car first-note) for duration = (if (listp rhythm) (car rhythm) rhythm) for i from 0 for notes = (find-notes-with-cursor time chords) for how-many-pitches = (density-aux (interpolate (/ i (length rhythmic-pattern)) density-env) (length notes)) do (when (and notes (atom rhythm)) ;; sort notes for priorities: (setf notes (sort notes (pred (third (first new-notes))))) (when stay-on-note (setf notes (reverse notes))) ;; collect notes (push `(,time ,duration ,(loop repeat how-many-pitches collect (second (pop notes)))) new-notes)) (setf time (+ time duration)) finally (setf new-notes (reverse new-notes)))) ;; write to midi fil (lists-to-midi (loop for i in new-notes collect (nth 2 i)) (loop for i in new-notes collect (second i)) (loop for i in new-notes collect (first i)) :file (format nil "~a~a~a" (directory-namestring midi-file) (pathname-name midi-file) "-deconstructed.mid")))) ;; EOF midi.lsp
12,128
Common Lisp
.l
296
33.75
82
0.611271
Leon-Focker/layers
1
0
0
GPL-3.0
9/19/2024, 11:28:28 AM (Europe/Amsterdam)
93bab2902f333ff41445d35709c721b88dd463c44f76fbfe449bbb7b2fc5950c
26,254
[ -1 ]