Changeset 32eceb4f in mainline for uspace/lib/c/include


Ignore:
Timestamp:
2010-11-20T22:30:36Z (15 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cb59f787
Parents:
1b22bd4 (diff), 7e1f9b7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

Location:
uspace/lib/c/include
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/adt/char_map.h

    r1b22bd4 r32eceb4f  
    4848typedef struct char_map char_map_t;
    4949
    50 /** Type definition of the character string to integer map pointer.
    51  *  @see char_map
    52  */
    53 typedef char_map_t *char_map_ref;
    54 
    5550/** Character string to integer map item.
    5651 *
     
    6964        int next;
    7065        /** Next character array. */
    71         char_map_ref *items;
     66        char_map_t **items;
    7267        /** Consistency check magic value. */
    7368        int magic;
    7469};
    7570
    76 extern int char_map_initialize(char_map_ref);
    77 extern void char_map_destroy(char_map_ref);
    78 extern int char_map_exclude(char_map_ref, const char *, size_t);
    79 extern int char_map_add(char_map_ref, const char *, size_t, const int);
    80 extern int char_map_find(const char_map_ref, const char *, size_t);
    81 extern int char_map_update(char_map_ref, const char *, size_t, const int);
     71extern int char_map_initialize(char_map_t *);
     72extern void char_map_destroy(char_map_t *);
     73extern int char_map_exclude(char_map_t *, const char *, size_t);
     74extern int char_map_add(char_map_t *, const char *, size_t, const int);
     75extern int char_map_find(const char_map_t *, const char *, size_t);
     76extern int char_map_update(char_map_t *, const char *, size_t, const int);
    8277
    8378#endif
  • uspace/lib/c/include/adt/dynamic_fifo.h

    r1b22bd4 r32eceb4f  
    4444typedef struct dyn_fifo dyn_fifo_t;
    4545
    46 /** Type definition of the dynamic fifo queue pointer.
    47  *  @see dyn_fifo
    48  */
    49 typedef dyn_fifo_t *dyn_fifo_ref;
    50 
    5146/** Dynamic first in first out positive integer queue.
    5247 * Possitive integer values only.
     
    6661};
    6762
    68 extern int dyn_fifo_initialize(dyn_fifo_ref, int);
    69 extern int dyn_fifo_destroy(dyn_fifo_ref);
    70 extern int dyn_fifo_push(dyn_fifo_ref, int, int);
    71 extern int dyn_fifo_pop(dyn_fifo_ref);
    72 extern int dyn_fifo_value(dyn_fifo_ref);
     63extern int dyn_fifo_initialize(dyn_fifo_t *, int);
     64extern int dyn_fifo_destroy(dyn_fifo_t *);
     65extern int dyn_fifo_push(dyn_fifo_t *, int, int);
     66extern int dyn_fifo_pop(dyn_fifo_t *);
     67extern int dyn_fifo_value(dyn_fifo_t *);
    7368
    7469#endif
  • uspace/lib/c/include/adt/generic_char_map.h

    r1b22bd4 r32eceb4f  
    5555        \
    5656        typedef struct name name##_t; \
    57         typedef name##_t *name##_ref; \
    5857        \
    5958        struct  name { \
     
    6362        }; \
    6463        \
    65         int name##_add(name##_ref, const char *, const size_t, type *); \
    66         int name##_count(name##_ref); \
    67         void name##_destroy(name##_ref); \
    68         void name##_exclude(name##_ref, const char *, const size_t); \
    69         type *name##_find(name##_ref, const char *, const size_t); \
    70         int name##_initialize(name##_ref); \
    71         int name##_is_valid(name##_ref);
     64        int name##_add(name##_t *, const char *, const size_t, type *); \
     65        int name##_count(name##_t *); \
     66        void name##_destroy(name##_t *); \
     67        void name##_exclude(name##_t *, const char *, const size_t); \
     68        type *name##_find(name##_t *, const char *, const size_t); \
     69        int name##_initialize(name##_t *); \
     70        int name##_is_valid(name##_t *);
    7271
    7372/** Character string to generic type map implementation.
     
    8180        GENERIC_FIELD_IMPLEMENT(name##_items, type) \
    8281        \
    83         int name##_add(name##_ref map, const char *name, const size_t length, \
     82        int name##_add(name##_t *map, const char *name, const size_t length, \
    8483             type *value) \
    8584        { \
     
    9998        } \
    10099        \
    101         int name##_count(name##_ref map) \
     100        int name##_count(name##_t *map) \
    102101        { \
    103102                return name##_is_valid(map) ? \
     
    105104        } \
    106105        \
    107         void name##_destroy(name##_ref map) \
     106        void name##_destroy(name##_t *map) \
    108107        { \
    109108                if (name##_is_valid(map)) { \
     
    113112        } \
    114113        \
    115         void name##_exclude(name##_ref map, const char *name, \
     114        void name##_exclude(name##_t *map, const char *name, \
    116115            const size_t length) \
    117116        { \
     
    125124        } \
    126125        \
    127         type *name##_find(name##_ref map, const char *name, \
     126        type *name##_find(name##_t *map, const char *name, \
    128127            const size_t length) \
    129128        { \
     
    138137        } \
    139138        \
    140         int name##_initialize(name##_ref map) \
     139        int name##_initialize(name##_t *map) \
    141140        { \
    142141                int rc; \
     
    155154        } \
    156155        \
    157         int name##_is_valid(name##_ref map) \
     156        int name##_is_valid(name##_t *map) \
    158157        { \
    159158                return map && (map->magic == GENERIC_CHAR_MAP_MAGIC_VALUE); \
  • uspace/lib/c/include/adt/generic_field.h

    r1b22bd4 r32eceb4f  
    5353#define GENERIC_FIELD_DECLARE(name, type) \
    5454        typedef struct name name##_t; \
    55         typedef name##_t *name##_ref; \
    5655        \
    5756        struct  name { \
     
    6261        }; \
    6362        \
    64         int name##_add(name##_ref, type *); \
    65         int name##_count(name##_ref); \
    66         void name##_destroy(name##_ref); \
    67         void name##_exclude_index(name##_ref, int); \
    68         type **name##_get_field(name##_ref); \
    69         type *name##_get_index(name##_ref, int); \
    70         int name##_initialize(name##_ref); \
    71         int name##_is_valid(name##_ref);
     63        int name##_add(name##_t *, type *); \
     64        int name##_count(name##_t *); \
     65        void name##_destroy(name##_t *); \
     66        void name##_exclude_index(name##_t *, int); \
     67        type **name##_get_field(name##_t *); \
     68        type *name##_get_index(name##_t *, int); \
     69        int name##_initialize(name##_t *); \
     70        int name##_is_valid(name##_t *);
    7271
    7372/** Generic type field implementation.
     
    7978 */
    8079#define GENERIC_FIELD_IMPLEMENT(name, type) \
    81         int name##_add(name##_ref field, type *value) \
     80        int name##_add(name##_t *field, type *value) \
    8281        { \
    8382                if (name##_is_valid(field)) { \
     
    9998        } \
    10099        \
    101         int name##_count(name##_ref field) \
     100        int name##_count(name##_t *field) \
    102101        { \
    103102                return name##_is_valid(field) ? field->next : -1; \
    104103        } \
    105104        \
    106         void name##_destroy(name##_ref field) \
     105        void name##_destroy(name##_t *field) \
    107106        { \
    108107                if (name##_is_valid(field)) { \
     
    117116        } \
    118117         \
    119         void name##_exclude_index(name##_ref field, int index) \
     118        void name##_exclude_index(name##_t *field, int index) \
    120119        { \
    121120                if (name##_is_valid(field) && (index >= 0) && \
     
    126125        } \
    127126         \
    128         type *name##_get_index(name##_ref field, int index) \
     127        type *name##_get_index(name##_t *field, int index) \
    129128        { \
    130129                if (name##_is_valid(field) && (index >= 0) && \
     
    134133        } \
    135134        \
    136         type **name##_get_field(name##_ref field) \
     135        type **name##_get_field(name##_t *field) \
    137136        { \
    138137                return name##_is_valid(field) ? field->items : NULL; \
    139138        } \
    140139        \
    141         int name##_initialize(name##_ref field) \
     140        int name##_initialize(name##_t *field) \
    142141        { \
    143142                if (!field) \
     
    153152        } \
    154153        \
    155         int name##_is_valid(name##_ref field) \
     154        int name##_is_valid(name##_t *field) \
    156155        { \
    157156                return field && (field->magic == GENERIC_FIELD_MAGIC_VALUE); \
  • uspace/lib/c/include/adt/int_map.h

    r1b22bd4 r32eceb4f  
    5656#define INT_MAP_DECLARE(name, type) \
    5757        typedef struct name name##_t; \
    58         typedef name##_t *name##_ref; \
    5958        typedef struct name##_item name##_item_t; \
    60         typedef name##_item_t *name##_item_ref; \
    6159        \
    6260        struct  name##_item { \
     
    6967                int size; \
    7068                int next; \
    71                 name##_item_ref items; \
     69                name##_item_t *items; \
    7270                int magic; \
    7371        }; \
    7472        \
    75         int name##_add(name##_ref, int, type *); \
    76         void name##_clear(name##_ref); \
    77         int name##_count(name##_ref); \
    78         void name##_destroy(name##_ref); \
    79         void name##_exclude(name##_ref, int); \
    80         void name##_exclude_index(name##_ref, int); \
    81         type *name##_find(name##_ref, int); \
    82         int name##_update(name##_ref, int, int); \
    83         type *name##_get_index(name##_ref, int); \
    84         int name##_initialize(name##_ref); \
    85         int name##_is_valid(name##_ref); \
    86         void name##_item_destroy(name##_item_ref); \
    87         int name##_item_is_valid(name##_item_ref);
     73        int name##_add(name##_t *, int, type *); \
     74        void name##_clear(name##_t *); \
     75        int name##_count(name##_t *); \
     76        void name##_destroy(name##_t *); \
     77        void name##_exclude(name##_t *, int); \
     78        void name##_exclude_index(name##_t *, int); \
     79        type *name##_find(name##_t *, int); \
     80        int name##_update(name##_t *, int, int); \
     81        type *name##_get_index(name##_t *, int); \
     82        int name##_initialize(name##_t *); \
     83        int name##_is_valid(name##_t *); \
     84        void name##_item_destroy(name##_item_t *); \
     85        int name##_item_is_valid(name##_item_t *);
    8886
    8987/** Integer to generic type map implementation.
     
    9593 */
    9694#define INT_MAP_IMPLEMENT(name, type) \
    97         int name##_add(name##_ref map, int key, type *value) \
     95        int name##_add(name##_t *map, int key, type *value) \
    9896        { \
    9997                if (name##_is_valid(map)) { \
    10098                        if (map->next == (map->size - 1)) { \
    101                                 name##_item_ref tmp; \
    102                                 tmp = (name##_item_ref) realloc(map->items, \
     99                                name##_item_t *tmp; \
     100                                tmp = (name##_item_t *) realloc(map->items, \
    103101                                    sizeof(name##_item_t) * 2 * map->size); \
    104102                                if (!tmp) \
     
    117115        } \
    118116        \
    119         void name##_clear(name##_ref map) \
     117        void name##_clear(name##_t *map) \
    120118        { \
    121119                if (name##_is_valid(map)) { \
     
    132130        } \
    133131        \
    134         int name##_count(name##_ref map) \
     132        int name##_count(name##_t *map) \
    135133        { \
    136134                return name##_is_valid(map) ? map->next : -1; \
    137135        } \
    138136        \
    139         void name##_destroy(name##_ref map) \
     137        void name##_destroy(name##_t *map) \
    140138        { \
    141139                if (name##_is_valid(map)) { \
     
    152150        } \
    153151        \
    154         void name##_exclude(name##_ref map, int key) \
     152        void name##_exclude(name##_t *map, int key) \
    155153        { \
    156154                if (name##_is_valid(map)) { \
     
    166164        } \
    167165        \
    168         void name##_exclude_index(name##_ref map, int index) \
     166        void name##_exclude_index(name##_t *map, int index) \
    169167        { \
    170168                if (name##_is_valid(map) && (index >= 0) && \
     
    175173        } \
    176174        \
    177         type *name##_find(name##_ref map, int key) \
     175        type *name##_find(name##_t *map, int key) \
    178176        { \
    179177                if (name##_is_valid(map)) { \
     
    189187        } \
    190188        \
    191         int name##_update(name##_ref map, int key, int new_key) \
     189        int name##_update(name##_t *map, int key, int new_key) \
    192190        { \
    193191                if (name##_is_valid(map)) { \
     
    208206        } \
    209207        \
    210         type *name##_get_index(name##_ref map, int index) \
     208        type *name##_get_index(name##_t *map, int index) \
    211209        { \
    212210                if (name##_is_valid(map) && (index >= 0) && \
     
    218216        } \
    219217        \
    220         int name##_initialize(name##_ref map) \
     218        int name##_initialize(name##_t *map) \
    221219        { \
    222220                if (!map) \
     
    224222                map->size = 2; \
    225223                map->next = 0; \
    226                 map->items = (name##_item_ref) malloc(sizeof(name##_item_t) * \
     224                map->items = (name##_item_t *) malloc(sizeof(name##_item_t) * \
    227225                    map->size); \
    228226                if (!map->items) \
     
    233231        } \
    234232        \
    235         int name##_is_valid(name##_ref map) \
     233        int name##_is_valid(name##_t *map) \
    236234        { \
    237235                return map && (map->magic == INT_MAP_MAGIC_VALUE); \
    238236        } \
    239237        \
    240         void name##_item_destroy(name##_item_ref item) \
     238        void name##_item_destroy(name##_item_t *item) \
    241239        { \
    242240                if (name##_item_is_valid(item)) { \
     
    249247        } \
    250248        \
    251         int name##_item_is_valid(name##_item_ref item) \
     249        int name##_item_is_valid(name##_item_t *item) \
    252250        { \
    253251                return item && (item->magic == INT_MAP_ITEM_MAGIC_VALUE); \
  • uspace/lib/c/include/adt/measured_strings.h

    r1b22bd4 r32eceb4f  
    4747typedef struct measured_string measured_string_t;
    4848
    49 /** Type definition of the character string with measured length pointer.
    50  * @see measured_string
    51  */
    52 typedef measured_string_t *measured_string_ref;
    53 
    5449/** Character string with measured length.
    5550 *
     
    6459};
    6560
    66 extern measured_string_ref measured_string_create_bulk(const char *, size_t);
    67 extern measured_string_ref measured_string_copy(measured_string_ref);
    68 extern int measured_strings_receive(measured_string_ref *, char **, size_t);
    69 extern int measured_strings_reply(const measured_string_ref, size_t);
    70 extern int measured_strings_return(int, measured_string_ref *, char **, size_t);
    71 extern int measured_strings_send(int, const measured_string_ref, size_t);
     61extern measured_string_t *measured_string_create_bulk(const char *, size_t);
     62extern measured_string_t *measured_string_copy(measured_string_t *);
     63extern int measured_strings_receive(measured_string_t **, char **, size_t);
     64extern int measured_strings_reply(const measured_string_t *, size_t);
     65extern int measured_strings_return(int, measured_string_t **, char **, size_t);
     66extern int measured_strings_send(int, const measured_string_t *, size_t);
    7267
    7368#endif
  • uspace/lib/c/include/net/device.h

    r1b22bd4 r32eceb4f  
    5959 */
    6060typedef struct device_stats device_stats_t;
    61 
    62 /** Type definition of the device usage statistics pointer.
    63  * @see device_stats
    64  */
    65 typedef device_stats_t *device_stats_ref;
    6661
    6762/** Device state. */
  • uspace/lib/c/include/net/modules.h

    r1b22bd4 r32eceb4f  
    6969 *
    7070 * @param[in] need      The needed module service.
    71  * @returns             The phone of the needed service.
     71 * @return              The phone of the needed service.
    7272 */
    7373typedef int connect_module_t(services_t need);
  • uspace/lib/c/include/net/packet.h

    r1b22bd4 r32eceb4f  
    4646 * @see packet
    4747 */
    48 typedef struct packet * packet_t;
    49 
    50 /** Type definition of the packet pointer.
    51  * @see packet
    52  */
    53 typedef packet_t * packet_ref;
     48typedef struct packet packet_t;
    5449
    5550/** Type definition of the packet dimension.
     
    5752 */
    5853typedef struct packet_dimension packet_dimension_t;
    59 
    60 /** Type definition of the packet dimension pointer.
    61  * @see packet_dimension
    62  */
    63 typedef packet_dimension_t * packet_dimension_ref;
    6454
    6555/** Packet dimension. */
     
    7969/*@{*/
    8070
    81 extern packet_t pm_find(packet_id_t);
    82 extern int pm_add(packet_t);
     71extern packet_t *pm_find(packet_id_t);
     72extern int pm_add(packet_t *);
    8373extern int pm_init(void);
    8474extern void pm_destroy(void);
    8575
    86 extern int pq_add(packet_t *, packet_t, size_t, size_t);
    87 extern packet_t pq_find(packet_t, size_t);
    88 extern int pq_insert_after(packet_t, packet_t);
    89 extern packet_t pq_detach(packet_t);
    90 extern int pq_set_order(packet_t, size_t, size_t);
    91 extern int pq_get_order(packet_t, size_t *, size_t *);
    92 extern void pq_destroy(packet_t, void (*)(packet_t));
    93 extern packet_t pq_next(packet_t);
    94 extern packet_t pq_previous(packet_t);
     76extern int pq_add(packet_t **, packet_t *, size_t, size_t);
     77extern packet_t *pq_find(packet_t *, size_t);
     78extern int pq_insert_after(packet_t *, packet_t *);
     79extern packet_t *pq_detach(packet_t *);
     80extern int pq_set_order(packet_t *, size_t, size_t);
     81extern int pq_get_order(packet_t *, size_t *, size_t *);
     82extern void pq_destroy(packet_t *, void (*)(packet_t *));
     83extern packet_t *pq_next(packet_t *);
     84extern packet_t *pq_previous(packet_t *);
    9585
    9686/*@}*/
  • uspace/lib/c/include/net/packet_header.h

    r1b22bd4 r32eceb4f  
    124124/** Returns whether the packet is valid.
    125125 * @param[in] packet    The packet to be checked.
    126  * @returns             True if the packet is not NULL and the magic value is
     126 * @return              True if the packet is not NULL and the magic value is
    127127 *                      correct.
    128  * @returns             False otherwise.
     128 * @return              False otherwise.
    129129 */
    130 static inline int packet_is_valid(const packet_t packet)
     130static inline int packet_is_valid(const packet_t *packet)
    131131{
    132132        return packet && (packet->magic_value == PACKET_MAGIC_VALUE);
  • uspace/lib/c/include/unistd.h

    r1b22bd4 r32eceb4f  
    4141
    4242#ifndef NULL
    43         #define NULL  0UL
     43        #define NULL    ((void *) 0)
    4444#endif
    4545
Note: See TracChangeset for help on using the changeset viewer.