whelk/_whelk.h
author J. Ali Harlow <ali@juiblex.co.uk>
Wed Aug 26 14:48:19 2009 +0100 (2009-08-26)
changeset 5 0ea90868d987
parent 0 8525965e930d
child 10 9ae1a7880142
permissions -rw-r--r--
Start 0.2.1
ali@0
     1
#include <lua.h>
ali@0
     2
#include <lualib.h>
ali@3
     3
#include <unistd.h>			/* For ssize_t */
ali@0
     4
#ifdef __WIN32__
ali@0
     5
#include <windows.h>
ali@0
     6
#endif
ali@0
     7
#include <whelk/whelk.h>
ali@0
     8
ali@0
     9
#define whelk_reg_const(L,name) \
ali@0
    10
    do { \
ali@0
    11
	lua_pushliteral(L,#name); \
ali@0
    12
	lua_pushnumber(L,name); \
ali@0
    13
	lua_settable(L,-3); \
ali@0
    14
    } while(0)
ali@0
    15
ali@3
    16
struct whelk_string {
ali@3
    17
    size_t len,alloc;
ali@3
    18
    char *buffer;
ali@3
    19
};
ali@3
    20
ali@3
    21
#ifdef __WIN32__
ali@3
    22
struct whelk_wait {
ali@3
    23
    int no_objects;
ali@3
    24
    HANDLE *objects;
ali@3
    25
};
ali@3
    26
#endif
ali@3
    27
ali@0
    28
int whelk_perror(lua_State *L,const char *s);
ali@0
    29
int whelk_get_folder_path(lua_State *L);
ali@0
    30
void whelk_open_get_folder_path(lua_State *L);
ali@0
    31
void whelk_open_reg_keys(lua_State *L);
ali@0
    32
int whelk_create_short_cut(lua_State *L);
ali@3
    33
int whelk_spawn(lua_State *L);
ali@3
    34
ali@3
    35
char *whelk_string_prealloc(struct whelk_string *string,size_t len);
ali@3
    36
void whelk_string_seek(struct whelk_string *string,ssize_t offset);
ali@3
    37
char *whelk_string_finalize(struct whelk_string *string);
ali@3
    38
void whelk_string_free(struct whelk_string *string);
ali@0
    39
ali@0
    40
#ifdef __WIN32__
ali@0
    41
char *whelk_utf16_to_utf8(const WCHAR *ucs2,int len);
ali@0
    42
WCHAR *whelk_utf8_to_utf16(const char *utf8,int len);
ali@0
    43
ali@0
    44
HRESULT whelk_reg_close_key(HKEY key);
ali@0
    45
HRESULT whelk_reg_open_key(HKEY key,const char *subkey,HKEY *out);
ali@0
    46
HRESULT whelk_reg_get_value(HKEY key,const char *subkey,const char *value,
ali@0
    47
  DWORD *type,void **data,DWORD *nb);
ali@0
    48
HRESULT whelk_reg_set_value(HKEY key,const char *subkey,const char *value,
ali@0
    49
  DWORD type,const void *data,int nb);
ali@0
    50
HRESULT whelk_reg_delete_key(HKEY key,const char *subkey);
ali@3
    51
ali@3
    52
int whelk_wait_add_object(struct whelk_wait *wait,HANDLE object);
ali@3
    53
void whelk_wait_remove_object(struct whelk_wait *wait,HANDLE object);
ali@3
    54
HANDLE whelk_wait_poll(struct whelk_wait *wait);
ali@3
    55
void whelk_wait_free(struct whelk_wait *wait);
ali@0
    56
#endif