mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-07-02 15:40:38 +02:00
Move internal string interface definitions to internal header
* libguile/strings-internal.h: New file. * libguile/strings.h: Gut. * libguile/Makefile.am: Add new file. * libguile/array-handle.c: * libguile/bytevectors.c: * libguile/foreign.c: * libguile/fports.c: * libguile/hash.c: * libguile/i18n.c: * libguile/init.c: * libguile/intrinsics.c: * libguile/load.c: * libguile/memoize.c: * libguile/numbers.c: * libguile/ports.c: * libguile/posix.c: * libguile/print.c: * libguile/random.c: * libguile/rdelim.c: * libguile/read.c: * libguile/rw.c: * libguile/srfi-13.c: * libguile/srfi-14.c: * libguile/strings.c: * libguile/strports.c: * libguile/struct.c: * libguile/symbols.c: * libguile/throw.c: Include new file.
This commit is contained in:
parent
342a58ad36
commit
4702becf89
28 changed files with 113 additions and 84 deletions
|
@ -528,6 +528,7 @@ noinst_HEADERS = atomic.h \
|
|||
programs.h \
|
||||
ports-internal.h \
|
||||
regex-posix.h \
|
||||
strings-internal.h \
|
||||
syntax.h \
|
||||
trace.h \
|
||||
whippet-embedder.h
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include "list.h"
|
||||
#include "numbers.h"
|
||||
#include "pairs.h"
|
||||
#include "strings.h"
|
||||
#include "strings-internal.h"
|
||||
#include "symbols.h"
|
||||
#include "vectors.h"
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#include "pairs.h"
|
||||
#include "ports.h"
|
||||
#include "srfi-4.h"
|
||||
#include "strings.h"
|
||||
#include "strings-internal.h"
|
||||
#include "symbols.h"
|
||||
#include "threads.h"
|
||||
#include "uniform.h"
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "ports.h"
|
||||
#include "programs.h"
|
||||
#include "stacks.h"
|
||||
#include "strings-internal.h"
|
||||
#include "symbols.h"
|
||||
#include "threads.h"
|
||||
#include "version.h"
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
# include "posix-w32.h"
|
||||
#endif
|
||||
#include "read.h"
|
||||
#include "strings.h"
|
||||
#include "strings-internal.h"
|
||||
#include "symbols.h"
|
||||
#include "syscalls.h"
|
||||
#include "variable.h"
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include "numbers.h"
|
||||
#include "pairs.h"
|
||||
#include "ports.h"
|
||||
#include "strings.h"
|
||||
#include "strings-internal.h"
|
||||
#include "struct.h"
|
||||
#include "symbols.h"
|
||||
#include "syntax.h"
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "numbers.h"
|
||||
#include "pairs.h"
|
||||
#include "posix.h" /* for `scm_i_locale_mutex' */
|
||||
#include "strings.h"
|
||||
#include "strings-internal.h"
|
||||
#include "symbols.h"
|
||||
#include "syscalls.h"
|
||||
#include "threads.h"
|
||||
|
|
|
@ -127,7 +127,7 @@
|
|||
#include "stackchk.h"
|
||||
#include "stacks.h"
|
||||
#include "stime.h"
|
||||
#include "strings.h"
|
||||
#include "strings-internal.h"
|
||||
#include "strorder.h"
|
||||
#include "strports.h"
|
||||
#include "struct.h"
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include "keywords.h"
|
||||
#include "modules.h"
|
||||
#include "numbers.h"
|
||||
#include "strings.h"
|
||||
#include "strings-internal.h"
|
||||
#include "struct.h"
|
||||
#include "symbols.h"
|
||||
#include "threads.h"
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
#include "procs.h"
|
||||
#include "read.h"
|
||||
#include "srfi-13.h"
|
||||
#include "strings.h"
|
||||
#include "strings-internal.h"
|
||||
#include "strports.h"
|
||||
#include "symbols.h"
|
||||
#include "threads.h"
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "pairs.h"
|
||||
#include "ports.h"
|
||||
#include "print.h"
|
||||
#include "strings.h"
|
||||
#include "strings-internal.h"
|
||||
#include "symbols.h"
|
||||
#include "threads.h"
|
||||
#include "throw.h"
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
#include "pairs.h"
|
||||
#include "ports.h"
|
||||
#include "simpos.h"
|
||||
#include "strings.h"
|
||||
#include "strings-internal.h"
|
||||
#include "threads.h"
|
||||
#include "values.h"
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
#include "ports-internal.h"
|
||||
#include "private-options.h"
|
||||
#include "procs.h"
|
||||
#include "strings.h"
|
||||
#include "strings-internal.h"
|
||||
#include "symbols.h"
|
||||
#include "syscalls.h"
|
||||
#include "variable.h"
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
#include "scmsigs.h"
|
||||
#include "srfi-13.h"
|
||||
#include "srfi-14.h"
|
||||
#include "strings.h"
|
||||
#include "strings-internal.h"
|
||||
#include "symbols.h"
|
||||
#include "syscalls.h"
|
||||
#include "threads.h"
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
#include "read.h"
|
||||
#include "smob.h"
|
||||
#include "srfi-14.h"
|
||||
#include "strings.h"
|
||||
#include "strings-internal.h"
|
||||
#include "strports.h"
|
||||
#include "struct.h"
|
||||
#include "symbols.h"
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#include "pairs.h"
|
||||
#include "srfi-4.h"
|
||||
#include "stime.h"
|
||||
#include "strings.h"
|
||||
#include "strings-internal.h"
|
||||
#include "symbols.h"
|
||||
#include "threads.h"
|
||||
#include "variable.h"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright 1995-2001,2006,2011,2018
|
||||
/* Copyright 1995-2001,2006,2011,2018,2025
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Guile.
|
||||
|
@ -33,7 +33,7 @@
|
|||
#include "pairs.h"
|
||||
#include "ports.h"
|
||||
#include "srfi-13.h"
|
||||
#include "strings.h"
|
||||
#include "strings-internal.h"
|
||||
#include "strports.h"
|
||||
|
||||
#include "rdelim.h"
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
#include "procs.h"
|
||||
#include "srfi-13.h"
|
||||
#include "srfi-4.h"
|
||||
#include "strings.h"
|
||||
#include "strings-internal.h"
|
||||
#include "strports.h"
|
||||
#include "symbols.h"
|
||||
#include "threads.h"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright 2001,2006,2009,2011,2014,2018
|
||||
/* Copyright 2001,2006,2009,2011,2014,2018,2025
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Guile.
|
||||
|
@ -40,7 +40,7 @@
|
|||
#include "numbers.h"
|
||||
#include "ports-internal.h"
|
||||
#include "ports.h"
|
||||
#include "strings.h"
|
||||
#include "strings-internal.h"
|
||||
#include "strports.h"
|
||||
#include "syscalls.h"
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright 2001,2004-2006,2008-2013,2017-2019
|
||||
/* Copyright 2001,2004-2006,2008-2013,2017-2019,2025
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Guile.
|
||||
|
@ -36,6 +36,7 @@
|
|||
#include "pairs.h"
|
||||
#include "procs.h"
|
||||
#include "srfi-14.h"
|
||||
#include "strings-internal.h"
|
||||
#include "symbols.h"
|
||||
|
||||
#include "srfi-13.h"
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include "pairs.h"
|
||||
#include "ports.h"
|
||||
#include "procs.h"
|
||||
#include "strings.h"
|
||||
#include "strings-internal.h"
|
||||
#include "symbols.h"
|
||||
#include "threads.h"
|
||||
#include "values.h"
|
||||
|
|
84
libguile/strings-internal.h
Normal file
84
libguile/strings-internal.h
Normal file
|
@ -0,0 +1,84 @@
|
|||
#ifndef SCM_STRINGS_INTERNAL_H
|
||||
#define SCM_STRINGS_INTERNAL_H
|
||||
|
||||
/* Copyright 1995-1998,2000-2001,2004-2006,2008-2011,2013,2015-2019,2022,2025
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of Guile.
|
||||
|
||||
Guile 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.
|
||||
|
||||
Guile 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 Guile. If not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
|
||||
#include <libguile/strings.h>
|
||||
|
||||
|
||||
|
||||
SCM_INTERNAL SCM scm_nullstr;
|
||||
|
||||
SCM_INTERNAL scm_t_string_failed_conversion_handler
|
||||
scm_i_default_string_failed_conversion_handler (void);
|
||||
|
||||
/* Flags for shared and wide strings. */
|
||||
#define SCM_I_STRINGBUF_F_WIDE 0x400
|
||||
#define SCM_I_STRINGBUF_F_MUTABLE 0x800
|
||||
|
||||
SCM_INTERNAL void scm_i_print_stringbuf (SCM exp, SCM port,
|
||||
scm_print_state *pstate);
|
||||
|
||||
/* internal accessor functions. Arguments must be valid. */
|
||||
|
||||
SCM_INTERNAL SCM scm_i_make_string (size_t len, char **datap,
|
||||
int read_only_p);
|
||||
SCM_INTERNAL SCM scm_i_make_wide_string (size_t len, scm_t_wchar **datap,
|
||||
int read_only_p);
|
||||
SCM_INTERNAL SCM scm_i_substring (SCM str, size_t start, size_t end);
|
||||
SCM_INTERNAL SCM scm_i_substring_read_only (SCM str, size_t start, size_t end);
|
||||
SCM_INTERNAL SCM scm_i_substring_shared (SCM str, size_t start, size_t end);
|
||||
SCM_INTERNAL SCM scm_i_substring_copy (SCM str, size_t start, size_t end);
|
||||
SCM_INTERNAL size_t scm_i_string_length (SCM str);
|
||||
SCM_INTERNAL int scm_i_string_is_mutable (SCM str);
|
||||
SCM_INTERNAL const scm_t_wchar *scm_i_string_wide_chars (SCM str);
|
||||
SCM_INTERNAL const void *scm_i_string_data (SCM str);
|
||||
|
||||
SCM_INTERNAL SCM scm_i_string_start_writing (SCM str);
|
||||
SCM_INTERNAL void scm_i_string_stop_writing (void);
|
||||
SCM_INTERNAL int scm_i_is_narrow_string (SCM str);
|
||||
SCM_INTERNAL scm_t_wchar scm_i_string_ref (SCM str, size_t x);
|
||||
SCM_INTERNAL int scm_i_string_contains_char (SCM str, char c);
|
||||
SCM_INTERNAL int scm_i_string_strcmp (SCM sstr, size_t start_x, const char *cstr);
|
||||
SCM_INTERNAL void scm_i_string_set_x (SCM str, size_t p, scm_t_wchar chr);
|
||||
|
||||
SCM_INTERNAL SCM scm_i_make_symbol (SCM name, scm_t_bits flags,
|
||||
unsigned long hash);
|
||||
SCM_INTERNAL const char *scm_i_symbol_chars (SCM sym);
|
||||
SCM_INTERNAL const scm_t_wchar *scm_i_symbol_wide_chars (SCM sym);
|
||||
SCM_INTERNAL size_t scm_i_symbol_length (SCM sym);
|
||||
SCM_INTERNAL int scm_i_is_narrow_symbol (SCM str);
|
||||
SCM_INTERNAL int scm_i_try_narrow_string (SCM str);
|
||||
SCM_INTERNAL SCM scm_i_symbol_substring (SCM sym, size_t start, size_t end);
|
||||
SCM_INTERNAL scm_t_wchar scm_i_symbol_ref (SCM sym, size_t x);
|
||||
SCM_INTERNAL void scm_encoding_error (const char *subr, int err,
|
||||
const char *message, SCM port, SCM chr);
|
||||
SCM_INTERNAL void scm_decoding_error (const char *subr, int err,
|
||||
const char *message, SCM port);
|
||||
|
||||
SCM_INTERNAL void scm_i_get_substring_spec (size_t len,
|
||||
SCM start, size_t *cstart,
|
||||
SCM end, size_t *cend);
|
||||
|
||||
SCM_INTERNAL void scm_init_strings (void);
|
||||
|
||||
#endif /* SCM_STRINGS_INTERNAL_H */
|
|
@ -49,7 +49,7 @@
|
|||
#include "symbols.h"
|
||||
#include "threads.h"
|
||||
|
||||
#include "strings.h"
|
||||
#include "strings-internal.h"
|
||||
|
||||
|
||||
#ifndef SCM_MAX_ALLOCA
|
||||
|
|
|
@ -99,11 +99,6 @@ typedef enum
|
|||
SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE = SCM_ICONVEH_ESCAPE_SEQUENCE
|
||||
} scm_t_string_failed_conversion_handler;
|
||||
|
||||
SCM_INTERNAL SCM scm_nullstr;
|
||||
|
||||
SCM_INTERNAL scm_t_string_failed_conversion_handler
|
||||
scm_i_default_string_failed_conversion_handler (void);
|
||||
|
||||
SCM_API SCM scm_string_p (SCM x);
|
||||
SCM_API SCM scm_string (SCM chrs);
|
||||
SCM_API SCM scm_make_string (SCM k, SCM chr);
|
||||
|
@ -206,63 +201,14 @@ SCM_API SCM scm_makfromstrs (int argc, char **argv);
|
|||
|
||||
|
||||
|
||||
/* internal constants */
|
||||
|
||||
/* Type tag for read-only strings. */
|
||||
#define scm_tc7_ro_string (scm_tc7_string + 0x200)
|
||||
|
||||
/* Flags for shared and wide strings. */
|
||||
#define SCM_I_STRINGBUF_F_WIDE 0x400
|
||||
#define SCM_I_STRINGBUF_F_MUTABLE 0x800
|
||||
|
||||
SCM_INTERNAL void scm_i_print_stringbuf (SCM exp, SCM port,
|
||||
scm_print_state *pstate);
|
||||
|
||||
/* internal accessor functions. Arguments must be valid. */
|
||||
|
||||
SCM_INTERNAL SCM scm_i_make_string (size_t len, char **datap,
|
||||
int read_only_p);
|
||||
SCM_INTERNAL SCM scm_i_make_wide_string (size_t len, scm_t_wchar **datap,
|
||||
int read_only_p);
|
||||
SCM_INTERNAL SCM scm_i_substring (SCM str, size_t start, size_t end);
|
||||
SCM_INTERNAL SCM scm_i_substring_read_only (SCM str, size_t start, size_t end);
|
||||
SCM_INTERNAL SCM scm_i_substring_shared (SCM str, size_t start, size_t end);
|
||||
SCM_INTERNAL SCM scm_i_substring_copy (SCM str, size_t start, size_t end);
|
||||
SCM_INTERNAL size_t scm_i_string_length (SCM str);
|
||||
SCM_INTERNAL int scm_i_string_is_mutable (SCM str);
|
||||
SCM_API /* FIXME: not internal */ const char *scm_i_string_chars (SCM str);
|
||||
SCM_API /* FIXME: not internal */ char *scm_i_string_writable_chars (SCM str);
|
||||
SCM_INTERNAL const scm_t_wchar *scm_i_string_wide_chars (SCM str);
|
||||
SCM_INTERNAL const void *scm_i_string_data (SCM str);
|
||||
|
||||
SCM_INTERNAL SCM scm_i_string_start_writing (SCM str);
|
||||
SCM_INTERNAL void scm_i_string_stop_writing (void);
|
||||
SCM_INTERNAL int scm_i_is_narrow_string (SCM str);
|
||||
SCM_INTERNAL scm_t_wchar scm_i_string_ref (SCM str, size_t x);
|
||||
SCM_INTERNAL int scm_i_string_contains_char (SCM str, char c);
|
||||
SCM_INTERNAL int scm_i_string_strcmp (SCM sstr, size_t start_x, const char *cstr);
|
||||
SCM_INTERNAL void scm_i_string_set_x (SCM str, size_t p, scm_t_wchar chr);
|
||||
/* internal functions related to symbols. */
|
||||
|
||||
SCM_INTERNAL SCM scm_i_make_symbol (SCM name, scm_t_bits flags,
|
||||
unsigned long hash);
|
||||
SCM_INTERNAL const char *scm_i_symbol_chars (SCM sym);
|
||||
SCM_INTERNAL const scm_t_wchar *scm_i_symbol_wide_chars (SCM sym);
|
||||
SCM_INTERNAL size_t scm_i_symbol_length (SCM sym);
|
||||
SCM_INTERNAL int scm_i_is_narrow_symbol (SCM str);
|
||||
SCM_INTERNAL int scm_i_try_narrow_string (SCM str);
|
||||
SCM_INTERNAL SCM scm_i_symbol_substring (SCM sym, size_t start, size_t end);
|
||||
SCM_INTERNAL scm_t_wchar scm_i_symbol_ref (SCM sym, size_t x);
|
||||
SCM_INTERNAL void scm_encoding_error (const char *subr, int err,
|
||||
const char *message, SCM port, SCM chr);
|
||||
SCM_INTERNAL void scm_decoding_error (const char *subr, int err,
|
||||
const char *message, SCM port);
|
||||
|
||||
/* internal utility functions. */
|
||||
|
||||
SCM_INTERNAL void scm_i_get_substring_spec (size_t len,
|
||||
SCM start, size_t *cstart,
|
||||
SCM end, size_t *cend);
|
||||
|
||||
/* Debugging functions */
|
||||
|
||||
|
@ -290,8 +236,4 @@ scm_is_string (SCM x)
|
|||
} while (0)
|
||||
|
||||
|
||||
|
||||
|
||||
SCM_INTERNAL void scm_init_strings (void);
|
||||
|
||||
#endif /* SCM_STRINGS_H */
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "procs.h"
|
||||
#include "read.h"
|
||||
#include "srfi-4.h"
|
||||
#include "strings.h"
|
||||
#include "strings-internal.h"
|
||||
#include "symbols.h"
|
||||
#include "syscalls.h"
|
||||
#include "threads.h"
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include "pairs.h"
|
||||
#include "ports.h"
|
||||
#include "srfi-13.h"
|
||||
#include "strings.h"
|
||||
#include "strings-internal.h"
|
||||
#include "symbols.h"
|
||||
|
||||
#include "struct.h"
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "private-options.h"
|
||||
#include "read.h"
|
||||
#include "srfi-13.h"
|
||||
#include "strings.h"
|
||||
#include "strings-internal.h"
|
||||
#include "strorder.h"
|
||||
#include "threads.h"
|
||||
#include "variable.h"
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include "programs.h"
|
||||
#include "stackchk.h"
|
||||
#include "stacks.h"
|
||||
#include "strings.h"
|
||||
#include "strings-internal.h"
|
||||
#include "symbols.h"
|
||||
#include "variable.h"
|
||||
#include "vm.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue