1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-17 09:10:22 +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

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 */
/*