Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
594a8d1e
Commit
594a8d1e
authored
Oct 20, 2011
by
Matthias Braun
Browse files
remove unnecessary libcore bits
parent
2e179fbd
Changes
8
Hide whitespace changes
Inline
Side-by-side
ir/libcore/lc_appendable.c
View file @
594a8d1e
...
...
@@ -22,7 +22,7 @@
#include <stdio.h>
#include <string.h>
#include "
lc_defines
.h"
#include "
util
.h"
#include "lc_printf.h"
/* Default appendable implementations */
...
...
@@ -109,7 +109,7 @@ static void str_init(lc_appendable_t *obj)
static
int
str_snadd
(
lc_appendable_t
*
obj
,
const
char
*
str
,
size_t
n
)
{
size_t
to_write
=
LC_
MIN
(
obj
->
limit
-
obj
->
written
-
1
,
n
);
size_t
to_write
=
MIN
(
obj
->
limit
-
obj
->
written
-
1
,
n
);
char
*
tgt
=
(
char
*
)
obj
->
obj
;
strncpy
(
tgt
+
obj
->
written
,
str
,
to_write
);
obj
->
written
+=
to_write
;
...
...
ir/libcore/lc_config.h
deleted
100644 → 0
View file @
2e179fbd
/*
libcore: library for basic data structures and algorithms.
Copyright (C) 2005 IPD Goos, Universit"at Karlsruhe, Germany
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Central definitions for the libcore.
* @author Sebastian Hack
* @date 22.12.2004
*/
#ifndef _LC_CONFIG_H
#define _LC_CONFIG_H
#if defined(__GNUC__)
#define inline __inline__
#define LC_FUNCNAME __FUNCTION__
#define LC_PRINTF(m) __attribute__((format(printf,m,(m)+1)))
#ifdef __STRICT_ANSI__
#define LC_LONGLONG long
#define LC_LONGDOUBLE double
#else
#define LC_LONGLONG long long
#define LC_LONGDOUBLE long double
#endif
#elif defined(_MSC_VER)
#define LC_FUNCNAME "<unknown>"
#define LC_PRINTF(m)
#define LC_LONGLONG __int64
#define LC_LONGDOUBLE long double
/* disable warning: 'foo' was declared deprecated, use 'bla' instead */
/* of course MS had to make 'bla' incompatible to 'foo', so a simple */
/* define will not work :-((( */
#pragma warning( disable : 4996 )
#ifdef _WIN32
#define snprintf _snprintf
#endif
/* _WIN32 */
#if _MSC_VER <= 1200
typedef
__int16
int16
;
typedef
__int32
int32
;
typedef
__int64
int64
;
typedef
unsigned
__int16
uint16
;
typedef
unsigned
__int32
uint32
;
typedef
unsigned
__int64
uint64
;
#endif
/* _MSC_VER <= 1200 */
/* default definitions */
#else
/* !defined(__GNUC__) && !defined(_MSC_VER) */
#define inline
#define LC_FUNCNAME "<unknown>"
#define LC_LONGLONG long
#define LC_LONGDOUBLE double
#define LC_PRINTF(m)
#endif
#endif
/* _LC_CONFIG_H */
ir/libcore/lc_defines.h
deleted
100644 → 0
View file @
2e179fbd
/*
libcore: library for basic data structures and algorithms.
Copyright (C) 2005 IPD Goos, Universit"at Karlsruhe, Germany
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Some common defines.
* @author Sebastian Hack
* @date 22.12.2004
*/
#ifndef _LIBCORE_DEFINES_H
#define _LIBCORE_DEFINES_H
#define LC_ARRSIZE(x) (sizeof(x) / sizeof(x[0]))
#define LC_MIN(x,y) ((x) < (y) ? (x) : (y))
#define LC_MAX(x,y) ((x) > (y) ? (x) : (y))
/** define a readable fourcc code */
#define LC_FOURCC(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24))
#define LC_FOURCC_STR(str) LC_FOURCC(str[0], str[1], str[2], str[3])
#endif
ir/libcore/lc_opts.c
View file @
594a8d1e
...
...
@@ -28,6 +28,7 @@
#include "lc_opts_enum.h"
#include "hashptr.h"
#include "lc_printf.h"
#include "util.h"
#include "xmalloc.h"
#include "obst.h"
...
...
@@ -504,7 +505,7 @@ int lc_opt_occurs(lc_opt_entry_t *opt, const char *value, lc_opt_err_info_t *err
case
lc_opt_type_bit
:
case
lc_opt_type_negbit
:
strtolower
(
buf
,
sizeof
(
buf
),
value
);
for
(
i
=
0
;
i
<
LC_
ARRSIZE
(
bool_strings
);
++
i
)
{
for
(
i
=
0
;
i
<
ARR
AY_
SIZE
(
bool_strings
);
++
i
)
{
if
(
strcmp
(
buf
,
bool_strings
[
i
].
str
)
==
0
)
{
val
->
integer
=
bool_strings
[
i
].
val
;
error
=
lc_opt_err_none
;
...
...
ir/libcore/lc_opts_t.h
View file @
594a8d1e
...
...
@@ -27,8 +27,6 @@
#include "lc_opts.h"
#include "list.h"
#include "lc_defines.h"
typedef
struct
{
struct
list_head
opts
;
struct
list_head
grps
;
...
...
ir/libcore/lc_printf.c
View file @
594a8d1e
...
...
@@ -35,8 +35,8 @@
#include "xmalloc.h"
#include "lc_printf.h"
#include "lc_defines.h"
#include "hashptr.h"
#include "util.h"
#include "set.h"
/* printf implementation */
...
...
@@ -136,7 +136,7 @@ int lc_arg_append(lc_appendable_t *app, const lc_arg_occ_t *occ, const char *str
if
(
!
occ
->
flag_minus
&&
occ
->
flag_zero
)
pad
=
'0'
;
return
lc_appendable_snwadd
(
app
,
str
,
len
,
LC_
MAX
(
0
,
occ
->
width
),
occ
->
flag_minus
,
pad
);
return
lc_appendable_snwadd
(
app
,
str
,
len
,
MAX
(
0
,
occ
->
width
),
occ
->
flag_minus
,
pad
);
}
...
...
@@ -172,7 +172,7 @@ static char *make_fmt(char *buf, size_t len, const lc_arg_occ_t *occ)
assert
(
occ
->
modifier
&&
"modifier must not be NULL"
);
strncpy
(
mod
,
occ
->
modifier
,
sizeof
(
mod
)
-
1
);
mod
[
LC_
MIN
(
sizeof
(
mod
)
-
1
,
occ
->
modifier_length
)]
=
'\0'
;
mod
[
MIN
(
sizeof
(
mod
)
-
1
,
occ
->
modifier_length
)]
=
'\0'
;
#ifdef _MSC_VER
/* work-around for buggy mscrt not supporting z, j, and t modifier */
...
...
@@ -297,7 +297,7 @@ static int std_emit(lc_appendable_t *app, const lc_arg_occ_t *occ, const lc_arg_
default:
{
int
len
=
LC_
MAX
(
128
,
occ
->
width
+
1
);
int
len
=
MAX
(
128
,
occ
->
width
+
1
);
char
*
buf
=
XMALLOCN
(
char
,
len
);
res
=
dispatch_snprintf
(
buf
,
len
,
fmt
,
occ
->
lc_arg_type
,
val
);
res
=
lc_appendable_snadd
(
app
,
buf
,
res
);
...
...
@@ -405,7 +405,7 @@ int lc_evpprintf(const lc_arg_env_t *env, lc_appendable_t *app, const char *fmt,
/* Negative or lacking precision after a '.' is treated as
* precision 0. */
occ
.
precision
=
LC_
MAX
(
0
,
precision
);
occ
.
precision
=
MAX
(
0
,
precision
);
}
/*
...
...
ir/libcore/lc_printf.h
View file @
594a8d1e
...
...
@@ -17,14 +17,11 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Flexible printf().
* @author Sebastian Hack
* @date 3.1.2005
*/
#ifndef _LIBCORE_LC_PRINTF_H
#define _LIBCORE_LC_PRINTF_H
...
...
@@ -35,7 +32,6 @@
#include <obstack.h>
#include "lc_config.h"
#include "lc_appendable.h"
typedef
struct
lc_arg_occ_t
{
...
...
@@ -111,10 +107,10 @@ int lc_evsnprintf(const lc_arg_env_t *env, char *buf, size_t len, const char *fm
int
lc_evfprintf
(
const
lc_arg_env_t
*
env
,
FILE
*
f
,
const
char
*
fmt
,
va_list
args
);
int
lc_evoprintf
(
const
lc_arg_env_t
*
env
,
struct
obstack
*
obst
,
const
char
*
fmt
,
va_list
args
);
int
lc_printf
(
const
char
*
fmt
,
...)
LC_PRINTF
(
1
)
;
int
lc_snprintf
(
char
*
buf
,
size_t
len
,
const
char
*
fmt
,
...)
LC_PRINTF
(
3
)
;
int
lc_fprintf
(
FILE
*
f
,
const
char
*
fmt
,
...)
LC_PRINTF
(
2
)
;
int
lc_oprintf
(
struct
obstack
*
obst
,
const
char
*
fmt
,
...)
LC_PRINTF
(
2
)
;
int
lc_printf
(
const
char
*
fmt
,
...);
int
lc_snprintf
(
char
*
buf
,
size_t
len
,
const
char
*
fmt
,
...);
int
lc_fprintf
(
FILE
*
f
,
const
char
*
fmt
,
...);
int
lc_oprintf
(
struct
obstack
*
obst
,
const
char
*
fmt
,
...);
int
lc_vprintf
(
const
char
*
fmt
,
va_list
args
);
int
lc_vsnprintf
(
char
*
buf
,
size_t
len
,
const
char
*
fmt
,
va_list
args
);
...
...
ir/libcore/lc_printf_arg_types.def
View file @
594a8d1e
...
...
@@ -3,9 +3,9 @@ LC_ARG_TYPE(char, char, int)
LC_ARG_TYPE(short, short, int)
LC_ARG_TYPE(int, int, int)
LC_ARG_TYPE(long, long, long)
LC_ARG_TYPE(
LC_LONGLONG,
long_long,
LC_LONGLONG
)
LC_ARG_TYPE(
long long,
long_long,
long long
)
LC_ARG_TYPE(double, double, double)
LC_ARG_TYPE(
LC_LONGDOUBLE, long_double, LC_LONGDOUBLE
)
LC_ARG_TYPE(
long double, long_double, long double
)
LC_ARG_TYPE(void *, ptr, void *)
LC_ARG_TYPE(intmax_t, intmax_t, intmax_t)
LC_ARG_TYPE(ptrdiff_t, ptrdiff_t, ptrdiff_t)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment