Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Weikert <elubie@gmx.net>2008-12-20 13:02:00 +0300
committerAndrea Weikert <elubie@gmx.net>2008-12-20 13:02:00 +0300
commitebb6628a0143a91189cc209487e6588ab3e9fa99 (patch)
tree4515516418232b771684161f241d343f9c30281b /source/blender/blenlib/BLI_blenlib.h
parent6343d4e233e96acee76d68adc060498313bb8d6c (diff)
2.5 BLI_blenlib cleanup
DONE: * moved almost all declarations from BLI_blenlib.h into their own proper header files. * BLI_blenlib.h still includes all the declarations for convenience and to avoid changes in existing code * split util.c into several files, where it wasn't done already * DynamicList -> dynamiclist, * ListBase -> listbase, * String utility functions -> string.c * removed a few unused macros and functions, if they're needed back, they're still in svn ;) TODO: * btempdir global * further cleanup in the code of the different modules (especially util.c)
Diffstat (limited to 'source/blender/blenlib/BLI_blenlib.h')
-rw-r--r--source/blender/blenlib/BLI_blenlib.h344
1 files changed, 10 insertions, 334 deletions
diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h
index f65aaa72a75..cb5f68ed1e0 100644
--- a/source/blender/blenlib/BLI_blenlib.h
+++ b/source/blender/blenlib/BLI_blenlib.h
@@ -62,357 +62,33 @@
#ifndef BLI_BLENLIB_H
#define BLI_BLENLIB_H
-/* braindamage for the masses... needed
- because fillfacebase and fillvertbase are used outside */
-#include "DNA_listBase.h"
+struct ListBase;
#include <stdlib.h>
-extern ListBase fillfacebase;
-extern ListBase fillvertbase;
-/**
- * @attention Defined in scanfill.c
- */
-extern ListBase filledgebase;
extern char btempdir[]; /* creator.c temp dir used instead of U.tempdir, set with BLI_where_is_temp( btempdir, 1 ); */
-struct chardesc;
-struct direntry;
-struct rctf;
-struct rcti;
-struct EditVert;
-struct PackedFile;
-struct LinkNode;
-struct DynamicList;
-
#ifdef __cplusplus
extern "C" {
#endif
-/* BLI_util.h */
-char *BLI_gethome(void);
-void BLI_make_file_string(const char *relabase, char *string, const char *dir, const char *file);
-void BLI_make_exist(char *dir);
-void BLI_make_existing_file(char *name);
-void BLI_split_dirfile(char *string, char *dir, char *file);
-void BLI_split_dirfile_basic(const char *string, char *dir, char *file);
-void BLI_join_dirfile(char *string, const char *dir, const char *file);
-int BLI_testextensie(const char *str, const char *ext);
-void addlisttolist(ListBase *list1, ListBase *list2);
-void BLI_insertlink(struct ListBase *listbase, void *vprevlink, void *vnewlink);
-void *BLI_findlink(struct ListBase *listbase, int number);
-int BLI_findindex(struct ListBase *listbase, void *vlink);
-void BLI_freelistN(struct ListBase *listbase);
-void BLI_addtail(struct ListBase *listbase, void *vlink);
-void BLI_remlink(struct ListBase *listbase, void *vlink);
-void BLI_uniquename(struct ListBase *list, void *vlink, char defname[], short name_offs, short len);
-void BLI_newname(char * name, int add);
-int BLI_stringdec(char *string, char *kop, char *start, unsigned short *numlen);
-void BLI_stringenc(char *string, char *kop, char *start, unsigned short numlen, int pic);
-void BLI_addhead(struct ListBase *listbase, void *vlink);
-void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink);
-void BLI_insertlinkafter(struct ListBase *listbase, void *vprevlink, void *vnewlink);
-void BLI_sortlist(struct ListBase *listbase, int (*cmp)(void *, void *));
-void BLI_freelist(struct ListBase *listbase);
-int BLI_countlist(struct ListBase *listbase);
-void BLI_freelinkN(ListBase *listbase, void *vlink);
-void BLI_duplicatelist(ListBase *list1, ListBase *list2); /* copy from 2 to 1 */
-
-
-void BLI_splitdirstring(char *di,char *fi);
-
-struct DynamicList *BLI_dlist_from_listbase(struct ListBase *lb);
-struct ListBase *BLI_listbase_from_dlist(struct DynamicList *dlist, struct ListBase *lb);
-void * BLI_dlist_find_link(struct DynamicList *dlist, unsigned int index);
-unsigned int BLI_count_items(struct DynamicList *dlist);
-void BLI_dlist_free_item(struct DynamicList *dlist, unsigned int index);
-void BLI_dlist_rem_item(struct DynamicList *dlist, unsigned int index);
-void * BLI_dlist_add_item_index(struct DynamicList *dlist, void *item, unsigned int index);
-void BLI_dlist_destroy(struct DynamicList *dlist);
-void BLI_dlist_init(struct DynamicList *dlist);
-void BLI_dlist_reinit(struct DynamicList *dlist);
-
- /**
- * dir can be any input, like from buttons, and this function
- * converts it to a regular full path.
- * Also removes garbage from directory paths, like /../ or double slashes etc
- */
-void BLI_cleanup_file(const char *relabase, char *dir);
-void BLI_cleanup_dir(const char *relabase, char *dir); /* same as above but adds a trailing slash */
+#include "BLI_listbase.h"
-/* go back one directory */
-int BLI_parent_dir(char *path);
+#include "BLI_dynamiclist.h"
- /**
- * Blender's path code replacement function.
- * Bases @a path strings leading with "//" by the
- * directory @a basepath, and replaces instances of
- * '#' with the @a framenum. Results are written
- * back into @a path.
- *
- * @a path The path to convert
- * @a basepath The directory to base relative paths with.
- * @a framenum The framenumber to replace the frame code with.
- * @retval Returns true if the path was relative (started with "//").
- */
-int BLI_convertstringcode(char *path, const char *basepath);
-int BLI_convertstringframe(char *path, int frame);
-int BLI_convertstringcwd(char *path);
+#include "BLI_string.h"
-void BLI_makestringcode(const char *relfile, char *file);
+#include "BLI_util.h"
- /**
- * Change every @a from in @a string into @a to. The
- * result will be in @a string
- *
- * @a string The string to work on
- * @a from The character to replace
- * @a to The character to replace with
- */
-void BLI_char_switch(char *string, char from, char to);
+#include "BLI_storage.h"
- /**
- * Makes sure @a path has platform-specific slashes.
- *
- * @a path The path to 'clean'
- */
-void BLI_clean(char *path);
- /**
- * Duplicates the cstring @a str into a newly mallocN'd
- * string and returns it.
- *
- * @param str The string to be duplicated
- * @retval Returns the duplicated string
- */
-char *BLI_strdup(const char *str);
+#include "BLI_fileops.h"
- /**
- * Duplicates the first @a len bytes of cstring @a str
- * into a newly mallocN'd string and returns it. @a str
- * is assumed to be at least len bytes long.
- *
- * @param str The string to be duplicated
- * @param len The number of bytes to duplicate
- * @retval Returns the duplicated string
- */
-char *BLI_strdupn(const char *str, int len);
-
- /**
- * Like strncpy but ensures dst is always
- * '\0' terminated.
- *
- * @param dst Destination for copy
- * @param src Source string to copy
- * @param maxncpy Maximum number of characters to copy (generally
- * the size of dst)
- * @retval Returns dst
- */
-char *BLI_strncpy(char *dst, const char *src, int maxncpy);
-
- /*
- * Replacement for snprintf
- */
-int BLI_snprintf(char *buffer, size_t count, const char *format, ...);
-
- /**
- * Compare two strings
- *
- * @retval True if the strings are equal, false otherwise.
- */
-int BLI_streq(char *a, char *b);
-
- /**
- * Compare two strings without regard to case.
- *
- * @retval True if the strings are equal, false otherwise.
- */
-int BLI_strcaseeq(char *a, char *b);
-
-/* in util.c */
-#ifdef WITH_ICONV
-void BLI_string_to_utf8(char *original, char *utf_8, const char *code);
-#endif
-
- /**
- * Read a file as ASCII lines. An empty list is
- * returned if the file cannot be opened or read.
- *
- * @attention The returned list should be free'd with
- * BLI_free_file_lines.
- *
- * @param name The name of the file to read.
- * @retval A list of strings representing the file lines.
- */
-struct LinkNode *BLI_read_file_as_lines(char *name);
-
- /**
- * Free the list returned by BLI_read_file_as_lines.
- */
-void BLI_free_file_lines(struct LinkNode *lines);
-
- /**
- * Checks if name is a fully qualified filename to an executable.
- * If not it searches $PATH for the file. On Windows it also
- * adds the correct extension (.com .exe etc) from
- * $PATHEXT if necessary. Also on Windows it translates
- * the name to its 8.3 version to prevent problems with
- * spaces and stuff. Final result is returned in fullname.
- *
- * @param fullname The full path and full name of the executable
- * @param name The name of the executable (usually argv[0]) to be checked
- */
-void BLI_where_am_i(char *fullname, const char *name);
-
-char *get_install_dir(void);
- /**
- * Gets the temp directory when blender first runs.
- * If the default path is not found, use try $TEMP
- *
- * Also make sure the temp dir has a trailing slash
- *
- * @param fullname The full path to the temp directory
- */
-void BLI_where_is_temp(char *fullname, int usertemp);
-
-
- /**
- * determines the full path to the application bundle on OS X
- *
- * @return path to application bundle
- */
-#ifdef __APPLE__
-char* BLI_getbundle(void);
-#endif
-
-#ifdef WIN32
-int BLI_getInstallationDir(char *str);
-#endif
-
-/* BLI_storage.h */
-int BLI_filesize(int file);
-int BLI_filepathsize(const char *path);
-double BLI_diskfree(char *dir);
-char *BLI_getwdN(char *dir);
-void BLI_hide_dot_files(int set);
-unsigned int BLI_getdir(char *dirname, struct direntry **filelist);
-
-/**
- * @attention Do not confuse with BLI_exists
- */
-int BLI_exist(char *name);
+#include "BLI_rect.h"
-/* BLI_fileops.h */
-void BLI_recurdir_fileops(char *dirname);
-int BLI_link(char *file, char *to);
-int BLI_is_writable(char *filename);
+#include "BLI_scanfill.h"
-/**
- * @attention Do not confuse with BLI_exist
- */
-int BLI_exists(char *file);
-int BLI_copy_fileops(char *file, char *to);
-int BLI_rename(char *from, char *to);
-int BLI_gzip(char *from, char *to);
-int BLI_delete(char *file, int dir, int recursive);
-int BLI_move(char *file, char *to);
-int BLI_touch(const char *file);
-char *BLI_last_slash(const char *string);
-void BLI_add_slash(char *string);
-void BLI_del_slash(char *string);
-
-/* BLI_rct.c */
-/**
- * Determine if a rect is empty. An empty
- * rect is one with a zero (or negative)
- * width or height.
- *
- * @return True if @a rect is empty.
- */
-int BLI_rcti_is_empty(struct rcti *rect);
-void BLI_init_rctf(struct rctf *rect, float xmin, float xmax, float ymin, float ymax);
-void BLI_init_rcti(struct rcti *rect, int xmin, int xmax, int ymin, int ymax);
-void BLI_translate_rctf(struct rctf *rect, float x, float y);
-void BLI_translate_rcti(struct rcti *rect, int x, int y);
-int BLI_in_rcti(struct rcti *rect, int x, int y);
-int BLI_in_rctf(struct rctf *rect, float x, float y);
-int BLI_isect_rctf(struct rctf *src1, struct rctf *src2, struct rctf *dest);
-int BLI_isect_rcti(struct rcti *src1, struct rcti *src2, struct rcti *dest);
-void BLI_union_rctf(struct rctf *rcta, struct rctf *rctb);
-
-/* scanfill.c: used in displist only... */
-struct EditVert *BLI_addfillvert(float *vec);
-struct EditEdge *BLI_addfilledge(struct EditVert *v1, struct EditVert *v2);
-int BLI_edgefill(int mode, int mat_nr);
-void BLI_end_edgefill(void);
-
-/* noise.h: */
-float BLI_hnoise(float noisesize, float x, float y, float z);
-float BLI_hnoisep(float noisesize, float x, float y, float z);
-float BLI_turbulence(float noisesize, float x, float y, float z, int nr);
-float BLI_turbulence1(float noisesize, float x, float y, float z, int nr);
-/* newnoise: generic noise & turbulence functions to replace the above BLI_hnoise/p & BLI_turbulence/1.
- * This is done so different noise basis functions can be used */
-float BLI_gNoise(float noisesize, float x, float y, float z, int hard, int noisebasis);
-float BLI_gTurbulence(float noisesize, float x, float y, float z, int oct, int hard, int noisebasis);
-/* newnoise: musgrave functions */
-float mg_fBm(float x, float y, float z, float H, float lacunarity, float octaves, int noisebasis);
-float mg_MultiFractal(float x, float y, float z, float H, float lacunarity, float octaves, int noisebasis);
-float mg_VLNoise(float x, float y, float z, float distortion, int nbas1, int nbas2);
-float mg_HeteroTerrain(float x, float y, float z, float H, float lacunarity, float octaves, float offset, int noisebasis);
-float mg_HybridMultiFractal(float x, float y, float z, float H, float lacunarity, float octaves, float offset, float gain, int noisebasis);
-float mg_RidgedMultiFractal(float x, float y, float z, float H, float lacunarity, float octaves, float offset, float gain, int noisebasis);
-/* newnoise: voronoi */
-void voronoi(float x, float y, float z, float* da, float* pa, float me, int dtype);
-/* newnoise: cellNoise & cellNoiseV (for vector/point/color) */
-float cellNoise(float x, float y, float z);
-void cellNoiseV(float x, float y, float z, float *ca);
-
-/* These callbacks are needed to make the lib finction properly */
-
-/**
- * Set a function taking a char* as argument to flag errors. If the
- * callback is not set, the error is discarded.
- * @param f The function to use as callback
- * @attention used in creator.c
- */
-void BLI_setErrorCallBack(void (*f)(char*));
-
-/**
- * Set a function to be able to interrupt the execution of processing
- * in this module. If the function returns true, the execution will
- * terminate gracefully. If the callback is not set, interruption is
- * not possible.
- * @param f The function to use as callback
- * @attention used in creator.c
- */
-void BLI_setInterruptCallBack(int (*f)(void));
-
-char *BLI_strcasestr(const char *s, const char *find);
-int BLI_strcasecmp(const char *s1, const char *s2);
-int BLI_strncasecmp(const char *s1, const char *s2, int n);
-void BLI_timestr(double _time, char *str); /* time var is global */
-
-/**
- * Trick to address 32 GB with an int (only for malloced pointers)
- */
-int BLI_int_from_pointer(void *poin);
-void *BLI_pointer_from_int(int val);
-
-
-#define PRNTSUB(type,arg) printf(#arg ": %" #type " ", arg)
-
-#ifndef PRINT
-#define PRINT(t,v) {PRNTSUB(t,v); printf("\n");}
-#define PRINT2(t1,v1,t2,v2) {PRNTSUB(t1,v1); PRNTSUB(t2,v2); printf("\n");}
-#define PRINT3(t1,v1,t2,v2,t3,v3) {PRNTSUB(t1,v1); PRNTSUB(t2,v2); PRNTSUB(t3,v3); printf("\n");}
-#define PRINT4(t1,v1,t2,v2,t3,v3,t4,v4) {PRNTSUB(t1,v1); PRNTSUB(t2,v2); PRNTSUB(t3,v3); PRNTSUB(t4,v4); printf("\n");}
-#endif
-
-/**
- * @param array The array in question
- * @retval The number of elements in the array.
- */
-#define BLI_ARRAY_NELEMS(array) (sizeof((array))/sizeof((array)[0]))
+#include "BLI_noise.h"
/**
* @param strct The structure of interest