Revision: 17965 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17965 Author: elubie Date: 2008-12-20 11:02:00 +0100 (Sat, 20 Dec 2008)
Log Message: ----------- 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) Modified Paths: -------------- branches/blender2.5/blender/projectfiles_vc9/blender/blenlib/BLI_blenlib.vcproj branches/blender2.5/blender/source/blender/blenlib/BLI_blenlib.h branches/blender2.5/blender/source/blender/blenlib/BLI_dynamiclist.h branches/blender2.5/blender/source/blender/blenlib/BLI_winstuff.h branches/blender2.5/blender/source/blender/blenlib/intern/threads.c branches/blender2.5/blender/source/blender/blenlib/intern/util.c branches/blender2.5/blender/source/blender/blenloader/intern/writefile.c branches/blender2.5/blender/source/blender/makesdna/DNA_meshdata_types.h Added Paths: ----------- branches/blender2.5/blender/source/blender/blenlib/BLI_fileops.h branches/blender2.5/blender/source/blender/blenlib/BLI_listbase.h branches/blender2.5/blender/source/blender/blenlib/BLI_noise.h branches/blender2.5/blender/source/blender/blenlib/BLI_rect.h branches/blender2.5/blender/source/blender/blenlib/BLI_scanfill.h branches/blender2.5/blender/source/blender/blenlib/BLI_storage.h branches/blender2.5/blender/source/blender/blenlib/BLI_string.h branches/blender2.5/blender/source/blender/blenlib/BLI_util.h branches/blender2.5/blender/source/blender/blenlib/intern/dynamiclist.c branches/blender2.5/blender/source/blender/blenlib/intern/dynamiclist.h branches/blender2.5/blender/source/blender/blenlib/intern/listbase.c branches/blender2.5/blender/source/blender/blenlib/intern/string.c Removed Paths: ------------- branches/blender2.5/blender/source/blender/blenlib/intern/BLI_fileops.h branches/blender2.5/blender/source/blender/blenlib/intern/BLI_scanfill.h branches/blender2.5/blender/source/blender/blenlib/intern/BLI_storage.h branches/blender2.5/blender/source/blender/blenlib/intern/BLI_util.h Modified: branches/blender2.5/blender/projectfiles_vc9/blender/blenlib/BLI_blenlib.vcproj =================================================================== --- branches/blender2.5/blender/projectfiles_vc9/blender/blenlib/BLI_blenlib.vcproj 2008-12-20 08:41:46 UTC (rev 17964) +++ branches/blender2.5/blender/projectfiles_vc9/blender/blenlib/BLI_blenlib.vcproj 2008-12-20 10:02:00 UTC (rev 17965) @@ -4,6 +4,7 @@ Version="9,00" Name="BLI_blenlib" ProjectGUID="{31628053-825D-4C06-8A21-D13883489718}" + RootNamespace="BLI_blenlib" TargetFrameworkVersion="131072" > <Platforms> @@ -119,7 +120,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\..\..\lib\windows\zlib\include;..\..\..\..\lib\windows\pthreads\include;..\..\..\..\lib\windows\freetype\include;..\..\..\..\build\msvc_9\intern\guardedalloc\include;..\..\..\source\blender\include;..\..\..\source\blender\blenlib;..\..\..\source\blender\python;..\..\..\source\blender\makesdna;..\..\..\source\blender\blenkernel" - PreprocessorDefinitions="_DEBUG;WIN32;_LIB;WITH_FREETYPE2;WITH_VERSE" + PreprocessorDefinitions="_DEBUG;WIN32;_LIB;WITH_FREETYPE2;WITH_VERSE;_CRT_SECURE_NO_WARNINGS" BasicRuntimeChecks="3" RuntimeLibrary="1" DefaultCharIsUnsigned="true" @@ -522,6 +523,10 @@ > </File> <File + RelativePath="..\..\..\source\blender\blenlib\intern\dynamiclist.c" + > + </File> + <File RelativePath="..\..\..\source\blender\blenlib\intern\dynlib.c" > </File> @@ -554,6 +559,10 @@ > </File> <File + RelativePath="..\..\..\source\blender\blenlib\intern\listbase.c" + > + </File> + <File RelativePath="..\..\..\source\blender\blenlib\intern\matrixops.c" > </File> @@ -582,6 +591,10 @@ > </File> <File + RelativePath="..\..\..\source\blender\blenlib\intern\string.c" + > + </File> + <File RelativePath="..\..\..\source\blender\blenlib\intern\threads.c" > </File> @@ -627,6 +640,10 @@ > </File> <File + RelativePath="..\..\..\source\blender\blenlib\BLI_dynamiclist.h" + > + </File> + <File RelativePath="..\..\..\source\blender\blenlib\BLI_edgehash.h" > </File> @@ -679,11 +696,11 @@ > </File> <File - RelativePath="..\..\..\source\blender\blenlib\intern\BLI_scanfill.h" + RelativePath="..\..\..\source\blender\blenlib\BLI_scanfill.h" > </File> <File - RelativePath="..\..\..\source\blender\blenlib\intern\BLI_storage.h" + RelativePath="..\..\..\source\blender\blenlib\BLI_storage.h" > </File> <File @@ -691,11 +708,15 @@ > </File> <File + RelativePath="..\..\..\source\blender\blenlib\BLI_string.h" + > + </File> + <File RelativePath="..\..\..\source\blender\blenlib\BLI_threads.h" > </File> <File - RelativePath="..\..\..\source\blender\blenlib\intern\BLI_util.h" + RelativePath="..\..\..\source\blender\blenlib\BLI_util.h" > </File> <File Modified: branches/blender2.5/blender/source/blender/blenlib/BLI_blenlib.h =================================================================== --- branches/blender2.5/blender/source/blender/blenlib/BLI_blenlib.h 2008-12-20 08:41:46 UTC (rev 17964) +++ branches/blender2.5/blender/source/blender/blenlib/BLI_blenlib.h 2008-12-20 10:02:00 UTC (rev 17965) @@ -62,359 +62,35 @@ #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 */ +#include "BLI_listbase.h" +#include "BLI_dynamiclist.h" -void BLI_splitdirstring(char *di,char *fi); +#include "BLI_string.h" -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); +#include "BLI_util.h" - /** - * 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_storage.h" -/* go back one directory */ -int BLI_parent_dir(char *path); +#include "BLI_fileops.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_rect.h" -void BLI_makestringcode(const char *relfile, char *file); +#include "BLI_scanfill.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_noise.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); - - /** - * 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 @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs