~ubuntu-branches/ubuntu/wily/parrot/wily-proposed

« back to all changes in this revision

Viewing changes to src/io/io_private.h

  • Committer: Package Import Robot
  • Author(s): Dominique Dumont
  • Date: 2014-04-26 08:41:44 UTC
  • mfrom: (1.1.20)
  • Revision ID: package-import@ubuntu.com-20140426084144-ycocevtjth7nij5s
Tags: 6.3.0-1
ImportedĀ UpstreamĀ versionĀ 6.3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
Copyright (C) 2001-2008, Parrot Foundation.
 
2
Copyright (C) 2001-2014, Parrot Foundation.
3
3
 
4
4
=head1 NAME
5
5
 
148
148
#define BUFFER_USED_SIZE(b) ((size_t)((b)->buffer_end - (b)->buffer_start))
149
149
#define BUFFER_FREE_HEAD_SPACE(b) ((b)->buffer_start - (b)->buffer_ptr)
150
150
#define BUFFER_FREE_END_SPACE(b) ((b)->buffer_size - ((b)->buffer_end - (b)->buffer_ptr))
151
 
#define BUFFER_CAN_BE_NORMALIZED(b) (((size_t)BUFFER_FREE_HEAD_SPACE(b)) > ((size_t)BUFFER_USED_SIZE(b)))
 
151
#define BUFFER_CAN_BE_NORMALIZED(b) \
 
152
    (((size_t)BUFFER_FREE_HEAD_SPACE(b)) > ((size_t)BUFFER_USED_SIZE(b)))
152
153
 
153
154
#define BUFFER_ASSERT_SANITY(b) do { \
154
155
        PARROT_ASSERT((b)->buffer_ptr <= (b)->buffer_start); \
155
156
        PARROT_ASSERT((b)->buffer_start <= (b)->buffer_end); \
156
157
        PARROT_ASSERT((b)->buffer_end <= (b)->buffer_ptr + (b)->buffer_size); \
157
 
        PARROT_ASSERT(BUFFER_FREE_HEAD_SPACE(b) + BUFFER_USED_SIZE(b) + BUFFER_FREE_END_SPACE(b) == (b)->buffer_size); \
 
158
        PARROT_ASSERT(BUFFER_FREE_HEAD_SPACE(b) + BUFFER_USED_SIZE(b) + BUFFER_FREE_END_SPACE(b) \
 
159
                == (b)->buffer_size); \
158
160
    } while (0);
159
161
 
160
162
#define BUFFER_DBG_PRINT(b) do { \
161
163
        fprintf(stderr, "\t%x [%x - %x]\n", (b)->buffer_ptr, (b)->buffer_start, (b)->buffer_end); \
162
 
        fprintf(stderr, "\t\t(%d + %d + %d)\n", BUFFER_FREE_HEAD_SPACE(b), BUFFER_USED_SIZE(b), BUFFER_FREE_END_SPACE(b)); \
163
 
        fprintf(stderr, "\t\t\t = %d\n", BUFFER_FREE_HEAD_SPACE(b) + BUFFER_USED_SIZE(b) + BUFFER_FREE_END_SPACE(b)); \
 
164
        fprintf(stderr, "\t\t(%d + %d + %d)\n", \
 
165
                BUFFER_FREE_HEAD_SPACE(b), BUFFER_USED_SIZE(b), BUFFER_FREE_END_SPACE(b)); \
 
166
        fprintf(stderr, "\t\t\t = %d\n", \
 
167
                BUFFER_FREE_HEAD_SPACE(b) + BUFFER_USED_SIZE(b) + BUFFER_FREE_END_SPACE(b)); \
164
168
    } while (0);
165
169
 
166
170
/* Get an editable version of the IO_VTABLE structure, typically used during
167
171
   vtable initialization. */
168
 
#define IO_EDITABLE_IO_VTABLE(i, idx) ((IO_VTABLE *)(void *)(&((i)->piodata->vtables[(idx)])))
 
172
#define IO_EDITABLE_IO_VTABLE(i, idx) (IO_VTABLE *)(&((i)->piodata->vtables[(idx)]))
169
173
 
170
174
 
171
175
/* HEADERIZER BEGIN: src/io/utilities.c */
268
272
    ARGMOD(PMC *handle),
269
273
    ARGIN(const IO_VTABLE *vtable),
270
274
    ARGMOD_NULLOK(IO_BUFFER *read_buffer),
271
 
    ARGMOD_NULLOK(IO_BUFFER * write_buffer))
 
275
    IO_BUFFER * write_buffer)
272
276
        __attribute__nonnull__(1)
273
277
        __attribute__nonnull__(2)
274
278
        __attribute__nonnull__(3)
275
279
        FUNC_MODIFIES(*handle)
276
 
        FUNC_MODIFIES(*read_buffer)
277
 
        FUNC_MODIFIES(* write_buffer);
 
280
        FUNC_MODIFIES(*read_buffer);
278
281
 
279
282
PARROT_WARN_UNUSED_RESULT
280
283
PARROT_CANNOT_RETURN_NULL