Commit 74d5a902 authored by Michael Beck's avatar Michael Beck
Browse files

Fixed Win32 DLL support.

libFirm can now be build as static and as dynamic library.
Two defines control it:
FIRM_BUILD must be set when libFirm is build.
FIRM_DLL must be set if libFirm is build as a dynamic library.

The old FIRM_DLL macro is now renamed to FIRM_API.

Additionally

- FIRM_API is added to the ADT headers, this is at least needed for edgfe.
- some more missing FIRM_API's added ...
- add a resource file to show libFirm's version under windows

[r27575]
parent 5994fced
......@@ -38,7 +38,7 @@ AC_SUBST(libfirm_conf_env)
dnl enable visibility hidden
CFLAGS="-fvisibility=hidden"
AC_DEFINE([FIRM_BUILD_DLL], [], [Define when firm library is built])
AC_DEFINE([FIRM_BUILD], [], [Defined when firm library is built])
dnl Package options
dnl ===============
......
......@@ -253,12 +253,12 @@ typedef ARR_STRUCT(aligned_type, 1) ir_arr_descr;
extern ir_arr_descr arr_mt_descr;
void *ir_new_arr_f(int nelts, size_t elts_size);
void ir_del_arr_f(void *elts);
void *ir_new_arr_d(struct obstack *obstack, int nelts, size_t elts_size);
void *ir_arr_resize(void *elts, int nelts, size_t elts_size);
void *ir_arr_setlen(void *elts, int nelts, size_t elts_size);
void ir_verify_arr(const void *elts);
FIRM_API void *ir_new_arr_f(int nelts, size_t elts_size);
FIRM_API void ir_del_arr_f(void *elts);
FIRM_API void *ir_new_arr_d(struct obstack *obstack, int nelts, size_t elts_size);
FIRM_API void *ir_arr_resize(void *elts, int nelts, size_t elts_size);
FIRM_API void *ir_arr_setlen(void *elts, int nelts, size_t elts_size);
FIRM_API void ir_verify_arr(const void *elts);
#define ARR_ELTS_OFFS offsetof(ir_arr_descr, v.elts)
#define ARR_DESCR(elts) ((ir_arr_descr *)(void *)((char *)(elts) - ARR_ELTS_OFFS))
......
......@@ -30,22 +30,22 @@
typedef struct _bipartite_t bipartite_t;
bipartite_t *bipartite_new(int n_left, int n_right);
void bipartite_free(bipartite_t *gr);
void bipartite_add(bipartite_t *gr, int i, int j);
void bipartite_remv(bipartite_t *gr, int i, int j);
int bipartite_adj(const bipartite_t *gr, int i, int j);
void bipartite_matching(const bipartite_t *gr, int *matching);
FIRM_API bipartite_t *bipartite_new(int n_left, int n_right);
FIRM_API void bipartite_free(bipartite_t *gr);
FIRM_API void bipartite_add(bipartite_t *gr, int i, int j);
FIRM_API void bipartite_remv(bipartite_t *gr, int i, int j);
FIRM_API int bipartite_adj(const bipartite_t *gr, int i, int j);
FIRM_API void bipartite_matching(const bipartite_t *gr, int *matching);
/**
* Dumps a bipartite graph to a file stream.
*/
void bipartite_dump_f(FILE *f, const bipartite_t *gr);
FIRM_API void bipartite_dump_f(FILE *f, const bipartite_t *gr);
/**
* Dumps a bipartite graph to file name.
*/
void bipartite_dump(const char *name, const bipartite_t *gr);
FIRM_API void bipartite_dump(const char *name, const bipartite_t *gr);
#include "../end.h"
......
......@@ -66,7 +66,7 @@ typedef struct cpset_iterator_t cpset_iterator_t;
* @param hash_function The hash function to use
* @param cmp_function The compare function to use
*/
void cpset_init(cpset_t *cpset, cpset_hash_function hash_function,
FIRM_API void cpset_init(cpset_t *cpset, cpset_hash_function hash_function,
cpset_cmp_function cmp_function);
/**
......@@ -77,7 +77,7 @@ void cpset_init(cpset_t *cpset, cpset_hash_function hash_function,
* @param cmp_function The compare function to use
* @param expected_elements Number of elements expected in the cpset (roughly)
*/
void cpset_init_size(cpset_t *cpset, cpset_hash_function hash_function,
FIRM_API void cpset_init_size(cpset_t *cpset, cpset_hash_function hash_function,
cpset_cmp_function cmp_function,
size_t expected_elements);
......@@ -87,7 +87,7 @@ void cpset_init_size(cpset_t *cpset, cpset_hash_function hash_function,
*
* @param cpset Pointer to the cpset
*/
void cpset_destroy(cpset_t *cpset);
FIRM_API void cpset_destroy(cpset_t *cpset);
/**
* Inserts an element into a cpset.
......@@ -96,7 +96,7 @@ void cpset_destroy(cpset_t *cpset);
* @param obj Element to insert into the cpset
* @returns The element itself or a pointer to an existing element
*/
void* cpset_insert(cpset_t *cpset, void *obj);
FIRM_API void* cpset_insert(cpset_t *cpset, void *obj);
/**
* Removes an element from a cpset. Does nothing if the cpset doesn't contain the
......@@ -105,7 +105,7 @@ void* cpset_insert(cpset_t *cpset, void *obj);
* @param cpset Pointer to the cpset
* @param obj Pointer to remove from the cpset
*/
void cpset_remove(cpset_t *cpset, const void *obj);
FIRM_API void cpset_remove(cpset_t *cpset, const void *obj);
/**
* Tests whether a cpset contains a pointer
......@@ -114,7 +114,7 @@ void cpset_remove(cpset_t *cpset, const void *obj);
* @param obj The pointer to find
* @returns An equivalent object to @p obj or NULL
*/
void *cpset_find(const cpset_t *cpset, const void *obj);
FIRM_API void *cpset_find(const cpset_t *cpset, const void *obj);
/**
* Returns the number of pointers contained in the cpset
......@@ -122,7 +122,7 @@ void *cpset_find(const cpset_t *cpset, const void *obj);
* @param cpset Pointer to the cpset
* @returns Number of pointers contained in the cpset
*/
size_t cpset_size(const cpset_t *cpset);
FIRM_API size_t cpset_size(const cpset_t *cpset);
/**
* Initializes a cpset iterator. Sets the iterator before the first element in
......@@ -131,7 +131,7 @@ size_t cpset_size(const cpset_t *cpset);
* @param iterator Pointer to already allocated iterator memory
* @param cpset Pointer to the cpset
*/
void cpset_iterator_init(cpset_iterator_t *iterator, const cpset_t *cpset);
FIRM_API void cpset_iterator_init(cpset_iterator_t *iterator, const cpset_t *cpset);
/**
* Advances the iterator and returns the current element or NULL if all elements
......@@ -142,7 +142,7 @@ void cpset_iterator_init(cpset_iterator_t *iterator, const cpset_t *cpset);
* @param iterator Pointer to the cpset iterator.
* @returns Next element in the cpset or NULL
*/
void *cpset_iterator_next(cpset_iterator_t *iterator);
FIRM_API void *cpset_iterator_next(cpset_iterator_t *iterator);
/**
* Removed the element the iterator currently points to
......@@ -150,7 +150,7 @@ void *cpset_iterator_next(cpset_iterator_t *iterator);
* @param cpset Pointer to the cpset
* @param iterator Pointer to the cpset iterator.
*/
void cpset_remove_iterator(cpset_t *cpset, const cpset_iterator_t *iterator);
FIRM_API void cpset_remove_iterator(cpset_t *cpset, const cpset_iterator_t *iterator);
#include "../end.h"
......
......@@ -24,6 +24,7 @@
* @author Hubert Schmid
* @date 09.06.2002
* @version $Id$
* @deprecated
*/
#ifndef FIRM_ADT_ESET_H
#define FIRM_ADT_ESET_H
......@@ -38,23 +39,23 @@
typedef struct eset eset;
/** Creates a new empty set. */
eset *eset_create(void);
FIRM_API eset *eset_create(void);
/**
* Creates a copy of the given set. Does NOT work if NULL is contained in source. */
eset *eset_copy(eset *source);
FIRM_API eset *eset_copy(eset *source);
/** Deletes a set. */
void eset_destroy(eset *s);
FIRM_API void eset_destroy(eset *s);
/** Returns the number of elements in the set. */
int eset_count(eset *s);
FIRM_API int eset_count(eset *s);
/** Inserts an address into the set. */
void eset_insert(eset *s, void *p);
FIRM_API void eset_insert(eset *s, void *p);
/** Checks, whether an address is element of a set. */
int eset_contains(eset *s, void *p);
FIRM_API int eset_contains(eset *s, void *p);
/**
* Starts the iteration over a set and returns the first element or NULL
......@@ -62,7 +63,7 @@ int eset_contains(eset *s, void *p);
*
* @note: It is NOT possible to add new elements while iterating through a set.
*/
void *eset_first(eset *s);
FIRM_API void *eset_first(eset *s);
/**
* Continues iteration through a set and returns the next element or NULL if the
......@@ -70,10 +71,10 @@ void *eset_first(eset *s);
*
* @note: It is NOT possible to add new elements while iterating through a set.
*/
void *eset_next(eset *s);
FIRM_API void *eset_next(eset *s);
/** Inserts all elements of source into target (union). Does NOT work if NULL is contained in source. */
void eset_insert_all(eset *target, eset *source);
FIRM_API void eset_insert_all(eset *target, eset *source);
#include "../end.h"
......
......@@ -14,7 +14,7 @@
* @param b the result vector, will contain the result if successful
* @param nsize the size of the equation system
*/
int firm_gaussjordansolve(double *A, double *b, int nsize);
FIRM_API int firm_gaussjordansolve(double *A, double *b, int nsize);
#include "../end.h"
......
......@@ -54,17 +54,17 @@ typedef struct _hungarian_problem_t hungarian_problem_t;
* HUNGARIAN_MATCH_NORMAL - matchings of nodes having no edge getting removed
* @return The problem object.
*/
hungarian_problem_t *hungarian_new(int rows, int cols, int match_type);
FIRM_API hungarian_problem_t *hungarian_new(int rows, int cols, int match_type);
/**
* Adds an edge from left to right with some costs.
*/
void hungarian_add(hungarian_problem_t *p, int left, int right, int cost);
FIRM_API void hungarian_add(hungarian_problem_t *p, int left, int right, int cost);
/**
* Removes the edge from left to right.
*/
void hungarian_remv(hungarian_problem_t *p, int left, int right);
* Removes the edge from left to right.
*/
FIRM_API void hungarian_remv(hungarian_problem_t *p, int left, int right);
/**
* Prepares the cost matrix dependent on the given mode.
......@@ -72,12 +72,12 @@ void hungarian_remv(hungarian_problem_t *p, int left, int right);
* @param p The hungarian object
* @param mode HUNGARIAN_MODE_MAXIMIZE_UTIL or HUNGARIAN_MODE_MINIMIZE_COST (default)
*/
void hungarian_prepare_cost_matrix(hungarian_problem_t *p, int mode);
FIRM_API void hungarian_prepare_cost_matrix(hungarian_problem_t *p, int mode);
/**
* Destroys the hungarian object.
*/
void hungarian_free(hungarian_problem_t *p);
FIRM_API void hungarian_free(hungarian_problem_t *p);
/**
* This method computes the optimal assignment.
......@@ -87,14 +87,14 @@ void hungarian_free(hungarian_problem_t *p);
* @param cost_threshold Matchings with costs >= this limit will be removed (if limit > 0)
* @return 0 on success, negative number otherwise
*/
int hungarian_solve(hungarian_problem_t *p, int *assignment, int *final_cost, int cost_threshold);
FIRM_API int hungarian_solve(hungarian_problem_t *p, int *assignment, int *final_cost, int cost_threshold);
/**
* Print the cost matrix.
* @param p The hungarian object
* @param cost_width The minimum field width of the costs
*/
void hungarian_print_cost_matrix(hungarian_problem_t *p, int cost_width);
FIRM_API void hungarian_print_cost_matrix(hungarian_problem_t *p, int cost_width);
#include "../end.h"
......
......@@ -48,7 +48,7 @@ typedef struct pdeq pdeq;
*
* @return A new list.
*/
pdeq *new_pdeq(void);
FIRM_API pdeq *new_pdeq(void);
/**
* Creates a new double ended pointer list and puts an initial pointer element in.
......@@ -57,21 +57,21 @@ pdeq *new_pdeq(void);
*
* @return The new list.
*/
pdeq *new_pdeq1(const void *x);
FIRM_API pdeq *new_pdeq1(const void *x);
/**
* Delete a double ended pointer list.
*
* @param dq The list to be deleted.
*/
void del_pdeq(pdeq *dq);
FIRM_API void del_pdeq(pdeq *dq);
/**
* Returns the lenght of a double ended pointer list.
* Returns the length of a double ended pointer list.
*
* @param dq The list.
*/
int pdeq_len(pdeq *dq);
FIRM_API int pdeq_len(pdeq *dq);
/**
* Checks if a list is empty.
......@@ -80,7 +80,7 @@ int pdeq_len(pdeq *dq);
*
* @return non-zero if the list is empty.
*/
int pdeq_empty(pdeq *dq);
FIRM_API int pdeq_empty(pdeq *dq);
/**
* Returns non-zero if a double ended pointer list
......@@ -89,7 +89,7 @@ int pdeq_empty(pdeq *dq);
* @param dq The list.
* @param x The pointer to be searched for.
*/
int pdeq_contains(pdeq *dq, const void *x);
FIRM_API int pdeq_contains(pdeq *dq, const void *x);
/**
* Search a key in a double ended pointer list, the search
......@@ -104,7 +104,7 @@ int pdeq_contains(pdeq *dq, const void *x);
* @return The address of the element entry if the key was found,
* NULL else.
*/
void *pdeq_search(pdeq *qp, cmp_fun cmp, const void *key);
FIRM_API void *pdeq_search(pdeq *qp, cmp_fun cmp, const void *key);
/**
* Convert the double ended pointer list into a linear array beginning from
......@@ -116,7 +116,7 @@ void *pdeq_search(pdeq *qp, cmp_fun cmp, const void *key);
*
* @return dst
*/
void **pdeq_copyl(pdeq *qp, const void **dst);
FIRM_API void **pdeq_copyl(pdeq *qp, const void **dst);
/**
* Convert the double ended pointer list into a linear array beginning from
......@@ -128,7 +128,7 @@ void **pdeq_copyl(pdeq *qp, const void **dst);
*
* @return dst
*/
void **pdeq_copyr(pdeq *qp, const void **dst);
FIRM_API void **pdeq_copyr(pdeq *qp, const void **dst);
/**
* Add a pointer to the left side of a double ended pointer list.
......@@ -138,7 +138,7 @@ void **pdeq_copyr(pdeq *qp, const void **dst);
*
* @return The list.
*/
pdeq *pdeq_putl(pdeq *dq, const void *x);
FIRM_API pdeq *pdeq_putl(pdeq *dq, const void *x);
/**
* Add a pointer to the right side of a double ended pointer list.
......@@ -148,7 +148,7 @@ pdeq *pdeq_putl(pdeq *dq, const void *x);
*
* @return The list.
*/
pdeq *pdeq_putr(pdeq *dq, const void *x);
FIRM_API pdeq *pdeq_putr(pdeq *dq, const void *x);
/**
* Retrieve (and remove) a pointer from the left site of a double ended pointer
......@@ -158,7 +158,7 @@ pdeq *pdeq_putr(pdeq *dq, const void *x);
* @return The pointer element.
* @remark This function will fail if the list is empty.
*/
void *pdeq_getl(pdeq *dq);
FIRM_API void *pdeq_getl(pdeq *dq);
/**
* Retrieve (and remove) a pointer from the right site of a double ended pointer
......@@ -168,13 +168,13 @@ void *pdeq_getl(pdeq *dq);
* @return The pointer element.
* @remark This function will fail if the list is empty.
*/
void *pdeq_getr(pdeq *dq);
FIRM_API void *pdeq_getr(pdeq *dq);
#ifdef NDEBUG
#define PDEQ_VRFY(deq) ((void)0)
#else
#define PDEQ_VRFY(deq) _pdeq_vrfy ((deq))
void _pdeq_vrfy(pdeq *dq);
FIRM_API void _pdeq_vrfy(pdeq *dq);
#endif
/**
......
......@@ -30,6 +30,7 @@
* @note Until now the code is entirely untested so it probably contains
* plenty of errors. (Matze: Is this still true, the code seems to be
* used at some places....)
* @deprecated
*/
#ifndef FIRM_ADT_PLIST_H
#define FIRM_ADT_PLIST_H
......@@ -90,7 +91,7 @@ struct _plist_element {
* Creates a new pointer list and initializes it.
* @return The newly created pointer list.
*/
plist_t *plist_new(void);
FIRM_API plist_t *plist_new(void);
/**
* Creates a new pointer list and initializes it.
......@@ -98,14 +99,14 @@ plist_t *plist_new(void);
* @param obst The obstack to use
* @return The newly created pointer list.
*/
plist_t *plist_obstack_new(struct obstack *obst);
FIRM_API plist_t *plist_obstack_new(struct obstack *obst);
/**
* Frees the passed pointer list.
* After a call to this function all references to the list and any of
* its elements are invalid.
*/
void plist_free(plist_t *list);
FIRM_API void plist_free(plist_t *list);
/**
* Returns the number of elements in a pointer list.
......@@ -120,14 +121,14 @@ void plist_free(plist_t *list);
* @param list the pointer list to append the new element to.
* @param value the element value to append.
*/
void plist_insert_back(plist_t *list, void *value);
FIRM_API void plist_insert_back(plist_t *list, void *value);
/**
* Inserts an element at the front of a pointer list.
* @param list the pointer list to prepend the new element to.
* @param value the element value to prepend.
*/
void plist_insert_front(plist_t *list, void *value);
FIRM_API void plist_insert_front(plist_t *list, void *value);
/**
* Inserts an element into a pointer list before the specified element,
......@@ -137,7 +138,7 @@ void plist_insert_front(plist_t *list, void *value);
* be inserted. This element must be a part of @p list.
* @param value the element value to insert.
*/
void plist_insert_before(plist_t *list, plist_element_t *element, void *value);
FIRM_API void plist_insert_before(plist_t *list, plist_element_t *element, void *value);
/**
* Inserts an element into a pointer list after the specified element,
......@@ -147,7 +148,7 @@ void plist_insert_before(plist_t *list, plist_element_t *element, void *value);
* be inserted. This element must be a part of @p list.
* @param value the element value to insert.
*/
void plist_insert_after(plist_t *list, plist_element_t *element, void *value);
FIRM_API void plist_insert_after(plist_t *list, plist_element_t *element, void *value);
/**
* Checks if list has an element with the given data pointer.
......@@ -155,7 +156,7 @@ void plist_insert_after(plist_t *list, plist_element_t *element, void *value);
* @param value the data pointer to look for
* @return 1 if element with data pointer found, 0 otherwise
*/
int plist_has_value(plist_t *list, void *value);
FIRM_API int plist_has_value(plist_t *list, void *value);
/**
* Tries to find list element associated to the given data pointer.
......@@ -163,7 +164,7 @@ int plist_has_value(plist_t *list, void *value);
* @param value the data pointer to look for
* @return The first list element associated to data pointer if found, NULL otherwise
*/
plist_element_t *plist_find_value(plist_t *list, void *value);
FIRM_API plist_element_t *plist_find_value(plist_t *list, void *value);
/**
* Erases the specified element from the pointer list.
......@@ -171,20 +172,20 @@ plist_element_t *plist_find_value(plist_t *list, void *value);
* @param element the list element to erase. This element must be a part
* of @p list.
*/
void plist_erase(plist_t *list, plist_element_t *element);
FIRM_API void plist_erase(plist_t *list, plist_element_t *element);
/**
* Erases all elements from the specified pointer list.
* @param list the pointer list that should be cleared.
*/
void plist_clear(plist_t *list);
FIRM_API void plist_clear(plist_t *list);
/**
* Returns the first element of a pointer list.
* @param list the pointer list to iterate
* @return a pointer to the element or NULL if the list is empty
*/
#define plist_first(list) \
#define plist_first(list) \
((list)->first_element)
/**
......@@ -192,7 +193,7 @@ void plist_clear(plist_t *list);
* @param list the pointer list to iterate
* @return a pointer to the element or NULL if the list is empty
*/
#define plist_last(list) \
#define plist_last(list) \
((list)->last_element)
/**
......
......@@ -42,40 +42,40 @@ typedef struct pmap_entry {
/** Creates a new empty map. */
pmap *pmap_create(void);
FIRM_API pmap *pmap_create(void);
/** Creates a new empty map with an initial number of slots. */
pmap *pmap_create_ex(int slots);
FIRM_API pmap *pmap_create_ex(int slots);
/** Deletes a map. */
void pmap_destroy(pmap *);
FIRM_API void pmap_destroy(pmap *);
/**
* Inserts a pair (key,value) into the map. If an entry with key
* "key" already exists, its "value" is overwritten.
*/
void pmap_insert(pmap *map, const void * key, void * value);
FIRM_API void pmap_insert(pmap *map, const void * key, void * value);
/** Checks if an entry with key "key" exists. */
int pmap_contains(pmap *map, const void * key);
FIRM_API int pmap_contains(pmap *map, const void * key);
/** Returns the key, value pair of "key". */
pmap_entry * pmap_find(pmap *map, const void * key);
FIRM_API pmap_entry * pmap_find(pmap *map, const void * key);
/** Returns the value of "key". */
void * pmap_get(pmap *map, const void * key);
FIRM_API void * pmap_get(pmap *map, const void * key);
int pmap_count(pmap *map);
FIRM_API int pmap_count(pmap *map);
/**
* Returns the first entry of a map if the map is not empty.
*/
pmap_entry *pmap_first(pmap *map);
FIRM_API pmap_entry *pmap_first(pmap *map);
/**
* Returns the next entry of a map or NULL if all entries were visited.
*/
pmap_entry *pmap_next(pmap *);
FIRM_API pmap_entry *pmap_next(pmap *);
#define foreach_pmap(pmap, curr) \
for (curr = pmap_first(pmap); curr; curr = pmap_next(pmap))
......@@ -83,7 +83,7 @@ pmap_entry *pmap_next(pmap *);
/** Breaks an iteration.
* Must be called, if a iteration ends before p_map_next() returns NULL.
*/
void pmap_break(pmap *map);
FIRM_API void pmap_break(pmap *map);
#include "../end.h"
......
......@@ -36,13 +36,13 @@ typedef struct _pqueue_t pqueue_t;
* Creates a new priority queue.
* @return A priority queue of initial length 0.
*/
pqueue_t *new_pqueue(void);
FIRM_API pqueue_t *new_pqueue(void);
/**
* Frees all memory allocated by the priority queue.
* @param q The priority queue to destroy.
*/
void del_pqueue(pqueue_t *q);
FIRM_API void del_pqueue(pqueue_t *q);
/**
* Inserts a new element into a priority queue.
......@@ -50,28 +50,28 @@ void del_pqueue(pqueue_t *q);
* @param data The actual data which should be stored in the queue.
* @param priority The priority for the data.
*/
void pqueue_put(pqueue_t *q, void *data, int priority);
FIRM_API void pqueue_put(pqueue_t *q, void *data, int priority);
/**
* Returns and removes the first element, ie. that one with the highest priority, from the queue.
* @param q The priority queue.
* @return The first element of the queue. Asserts if queue is empty.
*/
void *pqueue_pop_front(pqueue_t *q);
FIRM_API void *pqueue_pop_front(pqueue_t *q);
/**
* Get the length of the priority queue.
* @param q The priority queue.
* @return The length of the queue.
*/
int pqueue_length(const pqueue_t *q);
FIRM_API int pqueue_length(const pqueue_t *q);
/**
* Returns true if queue is empty.
* @param q The priority queue.
* @return 1 if the queue is empty, 0 otherwise.
*/
int pqueue_empty(const pqueue_t *q);
FIRM_API int pqueue_empty(const pqueue_t *q);
#include "../end.h"
......
......@@ -42,7 +42,7 @@
* @param y A pointer.
* @return 0 if @p x and @p y are equal. Some value != 0 otherwise.
*/
int pset_default_ptr_cmp(const void *x, const void *y);
FIRM_API int pset_default_ptr_cmp(const void *x, const void *y);
/**
* The abstract type of a pset (Set of pointers).
......@@ -91,7 +91,7 @@ typedef int (*pset_cmp_fun) (const void *elt, const void *key);
* @returns
* created pset