1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-08 05:00:17 +02:00
guile/module/ice-9/deprecated.scm
Andy Wingo e3b743dc72 Move source properties out to a module
* module/ice-9/source-properties.scm: New file, providing the
source-properties API, as well as a replacement for `read' that always
attaches source properties, regardless of the 'positions option on the
port.

* am/bootstrap.am (SOURCES): Add the new file.

* libguile/srcprop.c:
* libguile/srcprop.h: Remove.

* libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES):
(DOT_X_FILES):
(DOT_DOC_FILES):
(modinclude_HEADERS):
* libguile.h: Remove srcprop.h.

* libguile/deprecated.c:
* libguile/deprecated.h: Add deprecation shims for srcprop.h interface.

* libguile/backtrace.c:
* libguile/debug.c:
* libguile/eval.c:
* libguile/init.c:
* libguile/memoize.c:
* libguile/promises.c:
* libguile/read.c:
* libguile/syntax.c: Remove needless srcprop.h includes.

* module/ice-9/boot-9.scm: Reorder some definitions so that deprecated
modules can use the (system syntax internal) module.

* module/ice-9/deprecated.scm: Add shims for Scheme source-properties
interface.

* module/ice-9/read.scm (read): Never attach source properties.  Users
that want source can use read-syntax.

* module/language/cps.scm:
* module/language/cps/spec.scm:
* module/language/ecmascript/compile-tree-il.scm:
* module/language/elisp/compile-tree-il.scm:
* module/language/elisp/lexer.scm:
* module/language/elisp/parser.scm:
* module/language/tree-il.scm:
* module/language/tree-il/spec.scm:
* module/language/wisp.scm:
* module/system/base/lalr.scm:
* test-suite/tests/elisp-reader.test:
* test-suite/tests/reader.test:
* test-suite/tests/srcprop.test:
* test-suite/tests/srfi-105.test:
* test-suite/tests/srfi-119.test: Use the (ice-9 source-properties)
module to get access to source properties.
2025-05-12 16:29:04 +02:00

160 lines
6.1 KiB
Scheme

;;;; Copyright (C) 2025 Free Software Foundation, Inc.
;;;;
;;;; 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 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, write to the Free Software
;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;;;;
(define-module (ice-9 deprecated)
#:use-module (ice-9 guardians)
#:use-module (ice-9 object-properties)
#:use-module (ice-9 source-properties)
#:use-module (ice-9 weak-tables)
#:export ((make-guardian* . make-guardian)
module-observe-weak
(make-object-property* . make-object-property)
(make-weak-key-hash-table* . make-weak-key-hash-table)
(make-weak-value-hash-table* . make-weak-value-hash-table)
(make-doubly-weak-hash-table* . make-doubly-weak-hash-table)
(weak-key-hash-table?* . weak-key-hash-table?)
(weak-value-hash-table?* . weak-value-hash-table?)
(doubly-weak-hash-table?* . doubly-weak-hash-table?)
(supports-source-properties?* . supports-source-properties?)
(source-properties* . source-properties)
(set-source-properties!* . set-source-properties!)
(source-property* . source-property)
(set-source-properties* . set-source-property!)
(cons-source* . cons-source)))
#;
(define-syntax-rule (define-deprecated name message exp)
(begin
(define-syntax rule
(identifier-syntax
(begin
(issue-deprecation-warning message)
exp)))
(export rule)))
(define (make-guardian*)
(issue-deprecation-warning
"make-guardian in the default environment is deprecated. Import it
from (ice-9 guardians) instead.")
(make-guardian))
(define* (module-observe-weak module observer-id #:optional (proc observer-id))
(issue-deprecation-warning
"module-observe-weak is deprecated. Use module-observe instead.")
(module-observe module proc))
(define (make-object-property*)
(issue-deprecation-warning
"make-object-property in the default environment is deprecated. Import
it from (ice-9 object-properties) instead.")
(make-object-property))
(define (object-properties* obj)
(issue-deprecation-warning
"object-properties in the default environment is deprecated. Import
it from (ice-9 object-properties) instead.")
(object-properties obj))
(define (set-object-properties!* obj props)
(issue-deprecation-warning
"set-object-properties! in the default environment is deprecated. Import
it from (ice-9 object-properties) instead.")
(set-object-properties! obj props))
(define (object-property* obj key)
(issue-deprecation-warning
"object-property in the default environment is deprecated. Import
it from (ice-9 object-properties) instead.")
(object-property obj key))
(define (set-object-property!* obj key value)
(issue-deprecation-warning
"set-object-properties! in the default environment is deprecated. Import
it from (ice-9 object-properties) instead.")
(set-object-property! obj key value))
(define* (make-weak-key-hash-table* #:optional (n 0))
(issue-deprecation-warning
"make-weak-key-hash-table in the default environment is deprecated.
Import it from (ice-9 weak-tables) instead.")
(make-weak-key-hash-table))
(define* (make-weak-value-hash-table* #:optional (n 0))
(issue-deprecation-warning
"make-weak-value-hash-table in the default environment is deprecated.
Import it from (ice-9 weak-tables) instead.")
(make-weak-value-hash-table))
(define* (make-doubly-weak-hash-table* #:optional (n 0))
(issue-deprecation-warning
"make-weak-key-hash-table in the default environment is deprecated.
Import it from (ice-9 weak-tables) instead.")
(make-doubly-weak-hash-table))
(define (weak-key-hash-table?* x)
(issue-deprecation-warning
"weak-key-hash-table? in the default environment is deprecated.
Import it from (ice-9 weak-tables) instead.")
(weak-key-hash-table? x))
(define (weak-value-hash-table?* x)
(issue-deprecation-warning
"weak-value-hash-table? in the default environment is deprecated.
Import it from (ice-9 weak-tables) instead.")
(weak-value-hash-table? x))
(define (doubly-weak-hash-table?* x)
(issue-deprecation-warning
"doubly-weak-hash-table? in the default environment is deprecated.
Import it from (ice-9 weak-tables) instead.")
(doubly-weak-hash-table? x))
(define (supports-source-properties?* x)
(issue-deprecation-warning
"supports-source-properties? in the default environment is deprecated.
Import it from (ice-9 source-properties) instead.")
(supports-source-properties? x))
(define (source-properties* x)
(issue-deprecation-warning
"source-properties in the default environment is deprecated.
Import it from (ice-9 source-properties) instead.")
(source-properties x))
(define (set-source-properties!* x alist)
(issue-deprecation-warning
"set-source-properties! in the default environment is deprecated.
Import it from (ice-9 source-properties) instead.")
(set-source-properties! x alist))
(define (source-property* x k)
(issue-deprecation-warning
"source-property in the default environment is deprecated.
Import it from (ice-9 source-properties) instead.")
(source-property x k))
(define (set-source-property!* x k v)
(issue-deprecation-warning
"set-source-property! in the default environment is deprecated.
Import it from (ice-9 source-properties) instead.")
(set-source-property! x k v))
(define (cons-source* orig x y)
(issue-deprecation-warning
"cons-source in the default environment is deprecated.
Import it from (ice-9 source-properties) instead.")
(cons-source orig x y))