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

@ -1,48 +1,38 @@
/*
* $Id$
*
* {License}
*/
#include <ase/cmn/types.h>
#include <ase/cmn/macros.h>
#ifndef NDEBUG
#include <ase/cmn/stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#ifdef _WIN32
#include <windows.h>
#include <tchar.h>
#endif
void ase_assert_abort (void)
int ase_assert_failed (
const ase_char_t* expr, const ase_char_t* desc,
const ase_char_t* file, ase_size_t line)
{
if (desc == ASE_NULL)
{
ase_fprintf (
ASE_STDERR,
ASE_T("ASSERTION FAILURE AT FILE %s LINE %lu\n%s\n"),
file, (unsigned long)line, expr);
}
else
{
ase_fprintf (
ASE_STDERR,
ASE_T("ASSERTION FAILURE AT FILE %s LINE %lu\n%s\n\nDESCRIPTION:\n%s\n"),
file, (unsigned long)line, expr, desc);
}
abort ();
return 0;
}
void ase_assert_printf (const ase_char_t* fmt, ...)
{
va_list ap;
#ifdef _WIN32
int n;
ase_char_t buf[1024];
#endif
va_start (ap, fmt);
#if defined(_WIN32)
n = _vsntprintf (buf, ASE_COUNTOF(buf), fmt, ap);
if (n < 0) buf[ASE_COUNTOF(buf)-1] = ASE_T('\0');
#if defined(_MSC_VER) && (_MSC_VER<1400)
MessageBox (NULL, buf,
ASE_T("Assertion Failure"), MB_OK|MB_ICONERROR);
#else
MessageBox (NULL, buf,
ASE_T("\uB2DD\uAE30\uB9AC \uC870\uB610"), MB_OK|MB_ICONERROR);
#endif
#else
ase_vprintf (fmt, ap);
#endif
va_end (ap);
}
#endif

View File

@ -1,34 +0,0 @@
/*
* $Id: ctype.h 131 2008-03-17 08:57:23Z 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

View File

@ -1,42 +0,0 @@
/*
* $Id: getopt.h 137 2008-03-17 12:35:02Z 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

View File

@ -1,66 +0,0 @@
/*
* $Id: http.h 132 2008-03-17 10:27:02Z 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

View File

@ -1,33 +0,0 @@
/*
* $Id: main.h 132 2008-03-17 10:27:02Z 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

View File

@ -4,16 +4,19 @@
NAME = aseutl
TOP_DIR = @abs_top_builddir@
CC = @CC@
AR = @AR@
MAKE = @MAKE@
RANLIB = @RANLIB@
CFLAGS = @CFLAGS@ -I@abs_top_builddir@/..
CFLAGS = @CFLAGS@ -I$(TOP_DIR)/inc
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
MODE = @BUILDMODE@
OUT_DIR = ../$(MODE)/lib
OUT_DIR = $(TOP_DIR)/out/$(MODE)/lib
OUT_FILE = $(OUT_DIR)/lib$(NAME).a
TMP_DIR = $(MODE)

View File

@ -1,88 +0,0 @@
/*
* $Id: stdio.h 148 2008-03-18 08:26:52Z 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