1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

* strports.c (scm_object_to_string): New procedure.

(scm_strprint_obj): Deprecated.
This commit is contained in:
Keisuke Nishida 2001-03-13 02:09:57 +00:00
parent 468bd77ef5
commit 1f3908c46a
5 changed files with 47 additions and 24 deletions

8
NEWS
View file

@ -334,6 +334,10 @@ Instead, use scm_c_memq or scm_memq, scm_memv, scm_member.
* return 0 if the request is for 0 bytes, with no end-of-file
check
** New function: object->string OBJ
Return a Scheme string obtained by printing a given object.
** New function: port? X
Returns a boolean indicating whether X is a port. Equivalent to
@ -622,6 +626,10 @@ Use scm_make_smob_type and scm_set_smob_XXX instead.
This can be used to set an apply function to a smob type.
** Deprecated function: scm_strprint_obj
Use scm_object_to_string instead.
Changes since Guile 1.3.4:

View file

@ -78,6 +78,7 @@ In release 1.6:
strictly scsh-compatible version which uses multiple values. For
interactive use it would be easy to load the module in ~/.guile.
- remove scm_close_all_ports_except
- remove scm_strprint_obj
Modules sort.c and random.c should be factored out into separate
modules (but still be distributed with guile-core) when we get a new

View file

@ -1,3 +1,9 @@
2001-03-12 Keisuke Nishida <kxn30@po.cwru.edu>
* strports.c (scm_object_to_string): New procedure.
(scm_strprint_obj): Deprecated.
* strports.h: Reflect the changes.
2001-03-12 Dirk Herrmann <D.Herrmann@tu-bs.de>
* goops.h (SCM_VALIDATE_PUREGENERIC): New macro.

View file

@ -311,6 +311,31 @@ SCM scm_strport_to_string (SCM port)
return scm_makfromstr ((char *) pt->read_buf, pt->read_buf_size, 0);
}
SCM_DEFINE (scm_object_to_string, "object->string", 1, 0, 0,
(SCM obj),
"Return a Scheme string obtained by printing a given object.")
#define FUNC_NAME s_scm_object_to_string
{
SCM str;
SCM port;
str = scm_makstr (0, 0);
port = scm_mkstrport (SCM_INUM0, str, SCM_OPN | SCM_WRTNG, "scm_strprint_obj");
scm_prin1 (obj, port, 1);
return scm_strport_to_string (port);
}
#undef FUNC_NAME
#if (SCM_DEBUG_DEPRECATED == 0)
SCM
scm_strprint_obj (SCM obj)
{
return scm_object_to_string (obj);
}
#endif /* (SCM_DEBUG_DEPRECATED == 0) */
SCM_DEFINE (scm_call_with_output_string, "call-with-output-string", 1, 0, 0,
(SCM proc),
"Calls the one-argument procedure @var{proc} with a newly created output\n"
@ -330,29 +355,6 @@ SCM_DEFINE (scm_call_with_output_string, "call-with-output-string", 1, 0, 0,
}
#undef FUNC_NAME
/* Return a Scheme string obtained by printing a given object.
*/
SCM
scm_strprint_obj (SCM obj)
{
SCM str;
SCM port;
str = scm_makstr (0, 0);
port = scm_mkstrport (SCM_INUM0, str, SCM_OPN | SCM_WRTNG, "scm_strprint_obj");
scm_prin1 (obj, port, 1);
{
return scm_strport_to_string (port);
}
}
SCM_DEFINE (scm_call_with_input_string, "call-with-input-string", 2, 0, 0,
(SCM str, SCM proc),
"Calls the one-argument procedure @var{proc} with a newly created input\n"

View file

@ -50,14 +50,20 @@
extern SCM scm_mkstrport (SCM pos, SCM str, long modes, const char * caller);
extern SCM scm_strport_to_string (SCM port);
extern SCM scm_object_to_string (SCM obj);
extern SCM scm_call_with_output_string (SCM proc);
extern SCM scm_strprint_obj (SCM obj);
extern SCM scm_call_with_input_string (SCM str, SCM proc);
extern SCM scm_read_0str (char *expr);
extern SCM scm_eval_0str (const char *expr);
extern SCM scm_eval_string (SCM string);
extern void scm_init_strports (void);
#if (SCM_DEBUG_DEPRECATED == 0)
extern SCM scm_strprint_obj (SCM obj);
#endif /* SCM_DEBUG_DEPRECATED == 0 */
#endif /* STRPORTSH */
/*