Changeset beb9336 in mainline for uspace/lib/c/include


Ignore:
Timestamp:
2012-08-24T14:07:52Z (13 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
041ab64
Parents:
bd29f9c9 (diff), db81577 (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 with mainline

Location:
uspace/lib/c/include
Files:
16 added
10 edited
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/io/charfield.h

    rbd29f9c9 rbeb9336  
    11/*
    22 * Copyright (c) 2006 Josef Cejka
     3 * Copyright (c) 2011 Petr Koupy
    34 * All rights reserved.
    45 *
     
    3334 */
    3435
    35 #ifndef IMGMAP_SCREENBUFFER_H__
    36 #define IMGMAP_SCREENBUFFER_H__
     36#ifndef LIBC_IO_CHARFIELD_H_
     37#define LIBC_IO_CHARFIELD_H_
    3738
    3839#include <sys/types.h>
     
    4041#include <io/color.h>
    4142#include <io/style.h>
    42 #include "fb.h"
     43#include <io/pixel.h>
    4344
    4445typedef enum {
    45         SCREENBUFFER_FLAG_NONE = 0,
    46         SCREENBUFFER_FLAG_SHARED = 1
    47 } screenbuffer_flag_t;
     46        CHAR_FLAG_NONE = 0,
     47        CHAR_FLAG_DIRTY = 1
     48} char_flags_t;
    4849
    4950typedef enum {
     
    5253        CHAR_ATTR_RGB
    5354} char_attr_type_t;
    54 
    55 typedef enum {
    56         CHAR_FLAG_NONE = 0,
    57         CHAR_FLAG_DIRTY = 1
    58 } char_flags_t;
    5955
    6056typedef struct {
     
    6561
    6662typedef struct {
    67         pixel_t bgcolor;  /**< Background color */
    68         pixel_t fgcolor;  /**< Foreground color */
     63        pixel_t bgcolor;
     64        pixel_t fgcolor;
    6965} char_attr_rgb_t;
    7066
     
    8076} char_attrs_t;
    8177
    82 /** One field on screen. It contain one character and its attributes. */
    8378typedef struct {
    84         wchar_t ch;          /**< Character itself */
    85         char_attrs_t attrs;  /**< Character attributes */
    86         char_flags_t flags;  /**< Character flags */
     79        wchar_t ch;
     80        char_attrs_t attrs;
     81        char_flags_t flags;
    8782} charfield_t;
    8883
    89 /** Compare two sets of attributes.
    90  *
    91  * @param a1 First attribute.
    92  * @param a2 Second attribute.
    93  *
    94  * @return True on equality
    95  *
    96  */
    9784static inline bool attrs_same(char_attrs_t a1, char_attrs_t a2)
    9885{
     
    115102}
    116103
    117 extern screenbuffer_t *screenbuffer_create(sysarg_t, sysarg_t,
    118     screenbuffer_flag_t);
    119 
    120 extern charfield_t *screenbuffer_field_at(screenbuffer_t *, sysarg_t, sysarg_t);
    121 extern bool screenbuffer_cursor_at(screenbuffer_t *, sysarg_t, sysarg_t);
    122 
    123 extern sysarg_t screenbuffer_get_top_row(screenbuffer_t *);
    124 
    125 extern sysarg_t screenbuffer_putchar(screenbuffer_t *, wchar_t, bool);
    126 extern sysarg_t screenbuffer_newline(screenbuffer_t *);
    127 extern sysarg_t screenbuffer_tabstop(screenbuffer_t *, sysarg_t);
    128 extern sysarg_t screenbuffer_backspace(screenbuffer_t *);
    129 
    130 extern void screenbuffer_clear(screenbuffer_t *);
    131 extern void screenbuffer_clear_row(screenbuffer_t *, sysarg_t);
    132 
    133 extern void screenbuffer_set_cursor(screenbuffer_t *, sysarg_t, sysarg_t);
    134 extern void screenbuffer_set_cursor_visibility(screenbuffer_t *, bool);
    135 extern bool screenbuffer_get_cursor_visibility(screenbuffer_t *);
    136 
    137 extern void screenbuffer_get_cursor(screenbuffer_t *, sysarg_t *, sysarg_t *);
    138 
    139 extern void screenbuffer_set_style(screenbuffer_t *, console_style_t);
    140 extern void screenbuffer_set_color(screenbuffer_t *, console_color_t,
    141     console_color_t, console_color_attr_t);
    142 extern void screenbuffer_set_rgb_color(screenbuffer_t *, pixel_t, pixel_t);
    143 
    144104#endif
    145105
  • uspace/lib/c/include/io/console.h

    rbd29f9c9 rbeb9336  
    3737
    3838#include <sys/time.h>
     39#include <io/kbd_event.h>
    3940#include <io/keycode.h>
    4041#include <async.h>
     
    7071} console_ctrl_t;
    7172
    72 typedef enum {
    73         KEY_PRESS,
    74         KEY_RELEASE
    75 } kbd_event_type_t;
    76 
    77 /** Console event structure. */
    78 typedef struct {
    79         /** List handle */
    80         link_t link;
    81        
    82         /** Press or release event. */
    83         kbd_event_type_t type;
    84        
    85         /** Keycode of the key that was pressed or released. */
    86         keycode_t key;
    87        
    88         /** Bitmask of modifiers held. */
    89         keymod_t mods;
    90        
    91         /** The character that was generated or '\0' for none. */
    92         wchar_t c;
    93 } kbd_event_t;
    94 
    9573extern console_ctrl_t *console_init(FILE *, FILE *);
    9674extern void console_done(console_ctrl_t *);
  • uspace/lib/c/include/io/klog.h

    rbd29f9c9 rbeb9336  
    3838#include <sys/types.h>
    3939#include <stdarg.h>
     40#include <io/verify.h>
    4041
    4142extern size_t klog_write(const void *, size_t);
    4243extern void klog_update(void);
    43 extern int klog_printf(const char *, ...);
     44extern int klog_printf(const char *, ...)
     45    PRINTF_ATTRIBUTE(1, 2);
    4446extern int klog_vprintf(const char *, va_list);
    4547
  • uspace/lib/c/include/io/log.h

    rbd29f9c9 rbeb9336  
    3636
    3737#include <stdarg.h>
     38#include <io/verify.h>
    3839
    3940typedef enum {
     
    4445        LVL_DEBUG,
    4546        LVL_DEBUG2,
    46 
     47       
    4748        /** For checking range of values */
    4849        LVL_LIMIT
     
    5051
    5152extern int log_init(const char *, log_level_t);
    52 extern void log_msg(log_level_t, const char *, ...);
     53extern void log_msg(log_level_t, const char *, ...)
     54    PRINTF_ATTRIBUTE(2, 3);
    5355extern void log_msgv(log_level_t, const char *, va_list);
    5456
  • uspace/lib/c/include/ipc/dev_iface.h

    rbd29f9c9 rbeb9336  
    3838        /** Character device interface */
    3939        CHAR_DEV_IFACE,
     40
     41        /** Graphic device interface */
     42        GRAPH_DEV_IFACE,
    4043       
    4144        /** Network interface controller interface */
  • uspace/lib/c/include/ipc/input.h

    rbd29f9c9 rbeb9336  
    4646        INPUT_EVENT_KEY = IPC_FIRST_USER_METHOD,
    4747        INPUT_EVENT_MOVE,
     48        INPUT_EVENT_ABS_MOVE,
    4849        INPUT_EVENT_BUTTON
    4950} input_notif_t;
  • uspace/lib/c/include/ipc/ipc.h

    rbd29f9c9 rbeb9336  
    4747
    4848typedef void (*ipc_async_callback_t)(void *, int, ipc_call_t *);
    49 
    50 /*
    51  * User-friendly wrappers for ipc_call_sync_fast() and ipc_call_sync_slow().
    52  * They are in the form ipc_call_sync_m_n(), where m denotes the number of
    53  * arguments of payload and n denotes number of return values. Whenever
    54  * possible, the fast version is used.
    55  */
    56 
    57 #define ipc_call_sync_0_0(phoneid, method) \
    58         ipc_call_sync_fast((phoneid), (method), 0, 0, 0, 0, 0, 0, 0, 0)
    59 #define ipc_call_sync_0_1(phoneid, method, res1) \
    60         ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), 0, 0, 0, 0)
    61 #define ipc_call_sync_0_2(phoneid, method, res1, res2) \
    62         ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), 0, 0, 0)
    63 #define ipc_call_sync_0_3(phoneid, method, res1, res2, res3) \
    64         ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \
    65             0, 0)
    66 #define ipc_call_sync_0_4(phoneid, method, res1, res2, res3, res4) \
    67         ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \
    68             (res4), 0)
    69 #define ipc_call_sync_0_5(phoneid, method, res1, res2, res3, res4, res5) \
    70         ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \
    71             (res4), (res5))
    72 
    73 #define ipc_call_sync_1_0(phoneid, method, arg1) \
    74         ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, 0, 0, 0, 0, 0)
    75 #define ipc_call_sync_1_1(phoneid, method, arg1, res1) \
    76         ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), 0, 0, 0, 0)
    77 #define ipc_call_sync_1_2(phoneid, method, arg1, res1, res2) \
    78         ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), 0, \
    79             0, 0)
    80 #define ipc_call_sync_1_3(phoneid, method, arg1, res1, res2, res3) \
    81         ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \
    82             (res3), 0, 0)
    83 #define ipc_call_sync_1_4(phoneid, method, arg1, res1, res2, res3, res4) \
    84         ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \
    85             (res3), (res4), 0)
    86 #define ipc_call_sync_1_5(phoneid, method, arg1, res1, res2, res3, res4, \
    87     res5) \
    88         ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \
    89             (res3), (res4), (res5))
    90 
    91 #define ipc_call_sync_2_0(phoneid, method, arg1, arg2) \
    92         ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, 0, 0, 0, \
    93             0, 0)
    94 #define ipc_call_sync_2_1(phoneid, method, arg1, arg2, res1) \
    95         ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), 0, 0, \
    96             0, 0)
    97 #define ipc_call_sync_2_2(phoneid, method, arg1, arg2, res1, res2) \
    98         ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
    99             (res2), 0, 0, 0)
    100 #define ipc_call_sync_2_3(phoneid, method, arg1, arg2, res1, res2, res3) \
    101         ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
    102             (res2), (res3), 0, 0)
    103 #define ipc_call_sync_2_4(phoneid, method, arg1, arg2, res1, res2, res3, \
    104     res4) \
    105         ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
    106             (res2), (res3), (res4), 0)
    107 #define ipc_call_sync_2_5(phoneid, method, arg1, arg2, res1, res2, res3, \
    108     res4, res5)\
    109         ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \
    110             (res2), (res3), (res4), (res5))
    111 
    112 #define ipc_call_sync_3_0(phoneid, method, arg1, arg2, arg3) \
    113         ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, 0, 0, \
    114             0, 0)
    115 #define ipc_call_sync_3_1(phoneid, method, arg1, arg2, arg3, res1) \
    116         ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), (res1), \
    117             0, 0, 0, 0)
    118 #define ipc_call_sync_3_2(phoneid, method, arg1, arg2, arg3, res1, res2) \
    119         ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), (res1), \
    120             (res2), 0, 0, 0)
    121 #define ipc_call_sync_3_3(phoneid, method, arg1, arg2, arg3, res1, res2, \
    122     res3) \
    123         ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
    124             (res1), (res2), (res3), 0, 0)
    125 #define ipc_call_sync_3_4(phoneid, method, arg1, arg2, arg3, res1, res2, \
    126     res3, res4) \
    127         ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
    128             (res1), (res2), (res3), (res4), 0)
    129 #define ipc_call_sync_3_5(phoneid, method, arg1, arg2, arg3, res1, res2, \
    130     res3, res4, res5) \
    131         ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \
    132             (res1), (res2), (res3), (res4), (res5))
    133 
    134 #define ipc_call_sync_4_0(phoneid, method, arg1, arg2, arg3, arg4) \
    135         ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), 0, \
    136             0, 0, 0, 0, 0)
    137 #define ipc_call_sync_4_1(phoneid, method, arg1, arg2, arg3, arg4, res1) \
    138         ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), 0, \
    139             (res1), 0, 0, 0, 0)
    140 #define ipc_call_sync_4_2(phoneid, method, arg1, arg2, arg3, arg4, res1, res2) \
    141         ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), 0, \
    142             (res1), (res2), 0, 0, 0)
    143 #define ipc_call_sync_4_3(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \
    144     res3) \
    145         ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
    146             (arg4), 0, (res1), (res2), (res3), 0, 0)
    147 #define ipc_call_sync_4_4(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \
    148     res3, res4) \
    149         ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
    150             (arg4), 0, (res1), (res2), (res3), (res4), 0)
    151 #define ipc_call_sync_4_5(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \
    152     res3, res4, res5) \
    153         ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
    154             (arg4), 0, (res1), (res2), (res3), (res4), (res5))
    155 
    156 #define ipc_call_sync_5_0(phoneid, method, arg1, arg2, arg3, arg4, arg5) \
    157         ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
    158             (arg5), 0, 0, 0, 0, 0)
    159 #define ipc_call_sync_5_1(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1) \
    160         ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \
    161             (arg5), (res1), 0, 0, 0, 0)
    162 #define ipc_call_sync_5_2(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
    163     res2) \
    164         ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
    165             (arg4), (arg5), (res1), (res2), 0, 0, 0)
    166 #define ipc_call_sync_5_3(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
    167     res2, res3) \
    168         ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
    169             (arg4), (arg5), (res1), (res2), (res3), 0, 0)
    170 #define ipc_call_sync_5_4(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
    171     res2, res3, res4) \
    172         ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
    173             (arg4), (arg5), (res1), (res2), (res3), (res4), 0)
    174 #define ipc_call_sync_5_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \
    175     res2, res3, res4, res5) \
    176         ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \
    177             (arg4), (arg5), (res1), (res2), (res3), (res4), (res5))
    178 
    179 extern int ipc_call_sync_fast(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
    180     sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *);
    181 
    182 extern int ipc_call_sync_slow(int, sysarg_t, sysarg_t, sysarg_t, sysarg_t,
    183     sysarg_t, sysarg_t, sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *,
    184     sysarg_t *);
    18549
    18650extern ipc_callid_t ipc_wait_cycle(ipc_call_t *, sysarg_t, unsigned int);
     
    254118    sysarg_t, sysarg_t, void *, ipc_async_callback_t, bool);
    255119
    256 extern int ipc_clone_establish(int);
    257 extern int ipc_connect_to_me(int, sysarg_t, sysarg_t, sysarg_t, task_id_t *,
    258     sysarg_t *);
    259 extern int ipc_connect_me_to(int, sysarg_t, sysarg_t, sysarg_t);
    260 extern int ipc_connect_me_to_blocking(int, sysarg_t, sysarg_t, sysarg_t);
    261 
    262120extern int ipc_hangup(int);
    263121
     
    267125    sysarg_t, sysarg_t, sysarg_t, unsigned int);
    268126
    269 /*
    270  * User-friendly wrappers for ipc_share_in_start().
    271  */
    272 
    273 #define ipc_share_in_start_0_0(phoneid, size, dst) \
    274         ipc_share_in_start((phoneid), (size), 0, NULL, (dst))
    275 #define ipc_share_in_start_0_1(phoneid, size, flags, dst) \
    276         ipc_share_in_start((phoneid), (size), 0, (flags), (dst))
    277 #define ipc_share_in_start_1_0(phoneid, size, arg, dst) \
    278         ipc_share_in_start((phoneid), (size), (arg), NULL, (dst))
    279 #define ipc_share_in_start_1_1(phoneid, size, arg, flags, dst) \
    280         ipc_share_in_start((phoneid), (size), (arg), (flags), (dst))
    281 
    282 extern int ipc_share_in_start(int, size_t, sysarg_t, unsigned int *, void **);
    283 extern int ipc_share_in_finalize(ipc_callid_t, void *, unsigned int);
    284 extern int ipc_share_out_start(int, void *, unsigned int);
    285 extern int ipc_share_out_finalize(ipc_callid_t, void **);
    286 extern int ipc_data_read_start(int, void *, size_t);
    287 extern int ipc_data_read_finalize(ipc_callid_t, const void *, size_t);
    288 extern int ipc_data_write_start(int, const void *, size_t);
    289 extern int ipc_data_write_finalize(ipc_callid_t, void *, size_t);
    290 
    291127extern int ipc_connect_kbox(task_id_t);
    292128
  • uspace/lib/c/include/ipc/mouseev.h

    rbd29f9c9 rbeb9336  
    4747typedef enum {
    4848        MOUSEEV_MOVE_EVENT = IPC_FIRST_USER_METHOD,
     49        MOUSEEV_ABS_MOVE_EVENT,
    4950        MOUSEEV_BUTTON_EVENT
    5051} mouseev_notif_t;
  • uspace/lib/c/include/stdio.h

    rbd29f9c9 rbeb9336  
    3939#include <stdarg.h>
    4040#include <str.h>
    41 
    42 #ifndef NVERIFY_PRINTF
    43 
    44 #define PRINTF_ATTRIBUTE(start, end) \
    45         __attribute__((format(gnu_printf, start, end)))
    46 
    47 #else /* NVERIFY_PRINTF */
    48 
    49 #define PRINTF_ATTRIBUTE(start, end)
    50 
    51 #endif /* NVERIFY_PRINTF */
     41#include <io/verify.h>
    5242
    5343#define EOF  (-1)
  • uspace/lib/c/include/str.h

    rbd29f9c9 rbeb9336  
    5656
    5757extern wchar_t str_decode(const char *str, size_t *offset, size_t sz);
     58extern wchar_t str_decode_reverse(const char *str, size_t *offset, size_t sz);
    5859extern int chr_encode(const wchar_t ch, char *str, size_t *offset, size_t sz);
    5960
     
    7273extern size_t str_nlength(const char *str, size_t size);
    7374extern size_t wstr_nlength(const wchar_t *str, size_t size);
     75
     76extern size_t chr_width(wchar_t ch);
     77extern size_t str_width(const char *str);
    7478
    7579extern bool ascii_check(wchar_t ch);
  • uspace/lib/c/include/task.h

    rbd29f9c9 rbeb9336  
    3838#include <sys/types.h>
    3939#include <abi/proc/task.h>
     40#include <stdarg.h>
    4041
    4142typedef enum {
     
    4849extern int task_kill(task_id_t);
    4950
    50 extern task_id_t task_spawn(const char *, const char *const[], int *);
    5151extern int task_spawnv(task_id_t *, const char *path, const char *const []);
    5252extern int task_spawnvf(task_id_t *, const char *path, const char *const [],
    5353    int *const []);
     54extern int task_spawn(task_id_t *, const char *path, int, va_list ap);
    5455extern int task_spawnl(task_id_t *, const char *path, ...);
    5556
Note: See TracChangeset for help on using the changeset viewer.