1 |
/* Copyright (C) 1995,1996,1998,1999,2000,2001,2002 Free Software Foundation, Inc. |
/* Copyright (C) 1995,1996,1998,1999,2000,2001,2002, 2003 Free Software Foundation, Inc. |
2 |
* |
* |
3 |
* This library is free software; you can redistribute it and/or |
* This library is free software; you can redistribute it and/or |
4 |
* modify it under the terms of the GNU Lesser General Public |
* modify it under the terms of the GNU Lesser General Public |
260 |
if (!((modes & SCM_WRTNG) || (modes & SCM_RDNG))) |
if (!((modes & SCM_WRTNG) || (modes & SCM_RDNG))) |
261 |
scm_misc_error ("scm_mkstrport", "port must read or write", SCM_EOL); |
scm_misc_error ("scm_mkstrport", "port must read or write", SCM_EOL); |
262 |
|
|
263 |
SCM_DEFER_INTS; |
scm_mutex_lock (&scm_i_port_table_mutex); |
264 |
z = scm_new_port_table_entry (scm_tc16_strport); |
z = scm_new_port_table_entry (scm_tc16_strport); |
265 |
pt = SCM_PTAB_ENTRY(z); |
pt = SCM_PTAB_ENTRY(z); |
266 |
SCM_SETSTREAM (z, SCM_UNPACK (str)); |
SCM_SETSTREAM (z, SCM_UNPACK (str)); |
272 |
|
|
273 |
pt->rw_random = 1; |
pt->rw_random = 1; |
274 |
|
|
275 |
SCM_ALLOW_INTS; |
scm_mutex_unlock (&scm_i_port_table_mutex); |
276 |
|
|
277 |
/* ensure write_pos is writable. */ |
/* ensure write_pos is writable. */ |
278 |
if ((modes & SCM_WRTNG) && pt->write_pos == pt->write_end) |
if ((modes & SCM_WRTNG) && pt->write_pos == pt->write_end) |