more cleanups.

This commit is contained in:
Vítor Santos Costa
2011-03-02 23:19:39 +00:00
parent 6f1537475f
commit da1df3d851
17 changed files with 159 additions and 98 deletions

View File

@@ -66,6 +66,11 @@ handling times must be cleaned, but that not only holds for this module.
#undef LD /* fetch LD once per function */
#define LD LOCAL_LD
/* there are two types of stream property functions. In the usual case,
they have an argument, but in a few cases they don't */
typedef int (*property0_t)(IOSTREAM *s ARG_LD);
typedef int (*property_t)(IOSTREAM *s, term_t prop ARG_LD);
static int bad_encoding(const char *msg, atom_t name);
static int noprotocol(void);
static PL_blob_t stream_blob;
@@ -3687,15 +3692,15 @@ stream_close_on_exec_prop(IOSTREAM *s, term_t prop ARG_LD)
typedef struct
{ functor_t functor; /* functor of property */
int (*function)(); /* function to generate */
property_t function; /* function to generate */
} sprop;
static const sprop sprop_list [] =
{ { FUNCTOR_file_name1, stream_file_name_propery },
{ FUNCTOR_mode1, stream_mode_property },
{ FUNCTOR_input0, stream_input_prop },
{ FUNCTOR_output0, stream_output_prop },
{ FUNCTOR_input0, (property_t)stream_input_prop },
{ FUNCTOR_output0, (property_t)stream_output_prop },
{ FUNCTOR_alias1, stream_alias_prop },
{ FUNCTOR_position1, stream_position_prop },
{ FUNCTOR_end_of_stream1, stream_end_of_stream_prop },
@@ -3798,7 +3803,7 @@ PRED_IMPL("stream_property", 2, stream_property,
switch(arityFunctor(f))
{ case 0:
rval = (*p->function)(s PASS_LD);
rval = (*(property0_t)p->function)(s PASS_LD);
break;
case 1:
{ term_t a1 = PL_new_term_ref();
@@ -3873,7 +3878,7 @@ PRED_IMPL("stream_property", 2, stream_property,
switch(arityFunctor(pe->p->functor))
{ case 0:
rval = (*pe->p->function)(pe->s PASS_LD);
rval = (*(property0_t)pe->p->function)(pe->s PASS_LD);
break;
case 1:
{ _PL_get_arg(1, property, a1);