This commit is contained in:
2008-06-07 04:19:57 +00:00
parent efdf40e95b
commit d1ba624139
10 changed files with 38 additions and 76 deletions

View File

@ -105,10 +105,7 @@
#ifdef __cplusplus
extern "C" {
#endif
void ase_assert_abort (void);
void ase_assert_puts (const ase_char_t* str);
/*void ase_assert_printf (const ase_char_t* fmt, ...);*/
int ase_assert_failed (
void ase_assert_failed (
const ase_char_t* expr, const ase_char_t* desc,
const ase_char_t* file, ase_size_t line);
#ifdef __cplusplus

34
ase/inc/ase/utl/ctype.h Normal file
View File

@ -0,0 +1,34 @@
/*
* $Id: ctype.h 183 2008-06-03 08:18:55Z baconevi $
*/
#ifndef _ASE_UTL_CTYPE_H_
#define _ASE_UTL_CTYPE_H_
#include <ase/cmn/types.h>
#include <ase/cmn/macros.h>
#ifdef __cplusplus
extern "C" {
#endif
ase_bool_t ase_isupper (ase_cint_t c);
ase_bool_t ase_islower (ase_cint_t c);
ase_bool_t ase_isalpha (ase_cint_t c);
ase_bool_t ase_isdigit (ase_cint_t c);
ase_bool_t ase_isxdigit (ase_cint_t c);
ase_bool_t ase_isalnum (ase_cint_t c);
ase_bool_t ase_isspace (ase_cint_t c);
ase_bool_t ase_isprint (ase_cint_t c);
ase_bool_t ase_isgraph (ase_cint_t c);
ase_bool_t ase_iscntrl (ase_cint_t c);
ase_bool_t ase_ispunct (ase_cint_t c);
ase_cint_t ase_toupper (ase_cint_t c);
ase_cint_t ase_tolower (ase_cint_t c);
#ifdef __cplusplus
}
#endif
#endif

42
ase/inc/ase/utl/getopt.h Normal file
View File

@ -0,0 +1,42 @@
/*
* $Id: getopt.h 183 2008-06-03 08:18:55Z baconevi $
*
* {License}
*/
#ifndef _ASE_UTL_GETOPT_H_
#define _ASE_UTL_GETOPT_H_
#include <ase/cmn/types.h>
#include <ase/cmn/macros.h>
typedef struct ase_opt_t ase_opt_t;
struct ase_opt_t
{
/* input */
const ase_char_t* str;
/* output */
ase_cint_t opt; /* character checked for validity */
ase_char_t* arg; /* argument associated with an option */
int err;
/* input + output */
int ind; /* index into parent argv vector */
/* internal */
ase_char_t* cur;
};
#ifdef __cplusplus
extern "C" {
#endif
ase_cint_t ase_getopt (int argc, ase_char_t* const* argv, ase_opt_t* opt);
#ifdef __cplusplus
}
#endif
#endif

66
ase/inc/ase/utl/http.h Normal file
View File

@ -0,0 +1,66 @@
/*
* $Id: http.h 183 2008-06-03 08:18:55Z baconevi $
*
* {License}
*/
#ifndef _ASE_UTL_HTTP_H_
#define _ASE_UTL_HTTP_H_
#include <ase/cmn/types.h>
#include <ase/cmn/macros.h>
/* returns the type of http method */
typedef struct ase_http_req_t ase_http_req_t;
typedef struct ase_http_hdr_t ase_http_hdr_t;
struct ase_http_req_t
{
ase_char_t* method;
struct
{
ase_char_t* ptr;
ase_size_t len;
} path;
struct
{
ase_char_t* ptr;
ase_size_t len;
} args;
struct
{
char major;
char minor;
} vers;
};
struct ase_http_hdr_t
{
struct
{
ase_char_t* ptr;
ase_size_t len;
} name;
struct
{
ase_char_t* ptr;
ase_size_t len;
} value;
};
#ifdef __cplusplus
extern "C" {
#endif
ase_char_t* ase_parsehttpreq (ase_char_t* buf, ase_http_req_t* req);
ase_char_t* ase_parsehttphdr (ase_char_t* buf, ase_http_hdr_t* hdr);
#ifdef __cplusplus
}
#endif
#endif

33
ase/inc/ase/utl/main.h Normal file
View File

@ -0,0 +1,33 @@
/*
* $Id: main.h 183 2008-06-03 08:18:55Z baconevi $
*
* {License}
*/
#ifndef _ASE_UTL_MAIN_H_
#define _ASE_UTL_MAIN_H_
#include <ase/cmn/types.h>
#include <ase/cmn/macros.h>
#if defined(_WIN32)
#include <tchar.h>
#define ase_main _tmain
typedef ase_char_t ase_achar_t;
#else
#define ase_main main
typedef ase_mchar_t ase_achar_t;
#endif
#ifdef __cplusplus
extern "C" {
#endif
int ase_runmain (int argc, ase_achar_t* argv[], int(*mf) (int,ase_char_t*[]));
#ifdef __cplusplus
}
#endif
#endif

88
ase/inc/ase/utl/stdio.h Normal file
View File

@ -0,0 +1,88 @@
/*
* $Id: stdio.h 183 2008-06-03 08:18:55Z baconevi $
*
* {License}
*/
#ifndef _ASE_UTL_STDIO_H_
#define _ASE_UTL_STDIO_H_
#include <ase/cmn/types.h>
#include <ase/cmn/macros.h>
#include <stdio.h>
#include <stdarg.h>
#include <wchar.h>
#if defined(_WIN32)
#include <tchar.h>
#define ase_printf _tprintf
#define ase_vprintf _vtprintf
#define ase_fprintf _ftprintf
#define ase_vfprintf _vftprintf
#define ase_fgets(x,y,s) _fgetts(x,y,s)
#define ase_fgetc(x) _fgettc(x)
#define ase_fputs(x,s) _fputts(x,s)
#define ase_fputc(x,s) _fputtc(x,s)
#elif defined(ASE_CHAR_IS_MCHAR)
#define ase_fgets(x,y,s) fgets(x,y,s)
#define ase_fgetc(x) fgetc(x)
#define ase_fputs(x,s) fputs(x,s)
#define ase_fputc(x,s) fputc(x,s)
#else
#define ase_fgets(x,y,s) fgetws(x,y,s)
#define ase_fgetc(x) fgetwc(x)
#define ase_fputs(x,s) fputws(x,s)
#define ase_fputc(x,s) fputwc(x,s)
#endif
#define ase_feof(s) feof(s)
#define ase_ferror(s) ferror(s)
#define ase_clearerr(s) clearerr(s)
#define ase_fflush(s) fflush(s)
#define ase_fclose(s) fclose(s)
#define ASE_FILE FILE
#define ASE_STDIN stdin
#define ASE_STDOUT stdout
#define ASE_STDERR stderr
typedef int (*ase_getdelim_t) (const ase_char_t* ptr,ase_size_t len, void* arg);
#ifdef __cplusplus
extern "C" {
#endif
int ase_vsprintf (ase_char_t* buf, size_t size, const ase_char_t* fmt, va_list ap);
int ase_sprintf (ase_char_t* buf, size_t size, const ase_char_t* fmt, ...);
#if !defined(_WIN32)
int ase_vfprintf (ASE_FILE *stream, const ase_char_t* fmt, va_list ap);
int ase_vprintf (const ase_char_t* fmt, va_list ap);
int ase_fprintf (ASE_FILE* file, const ase_char_t* fmt, ...);
int ase_printf (const ase_char_t* fmt, ...);
#endif
int ase_dprintf (const ase_char_t* fmt, ...);
ASE_FILE* ase_fopen (const ase_char_t* path, const ase_char_t* mode);
ASE_FILE* ase_popen (const ase_char_t* cmd, const ase_char_t* mode);
/**
* returns -2 on error, -1 on eof, length of data read on success
*/
ase_ssize_t ase_getline (ase_char_t **buf, ase_size_t *n, ASE_FILE *fp);
/**
* returns -3 on line breaker error, -2 on error, -1 on eof,
* length of data read on success
*/
ase_ssize_t ase_getdelim (
ase_char_t **buf, ase_size_t *n,
ase_getdelim_t fn, void* fnarg, ASE_FILE *fp);
#ifdef __cplusplus
}
#endif
#endif