From 39a8c014c4572f7f5f9ca099482929b67fe4273e Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Fri, 16 Apr 2004 15:55:16 +0000 Subject: This commit removes the glue from Blender, and with it the directories decrypt, deflate, encrypt, inflate, readstreamglue, sign, writeblenfile and writestreamglue. Sirdude was so kind to modify the makefiles, so SCons and Make are ready to build with the new Blender. Visual Studio workspaces, solutions and projectfiles still need to be updated (I'll do the .vcprojs and .sln myself after this commit). Runtimes created with the Blender Publisher are not anymore recognised - if you want these available, you'll have to convert them first to .blends with the Publisher. --- source/blender/writeblenfile/BLO_writeblenfile.h | 61 ---- source/blender/writeblenfile/Makefile | 37 --- source/blender/writeblenfile/SConscript | 18 -- .../writeblenfile/intern/BLO_writeblenfile.c | 351 --------------------- source/blender/writeblenfile/intern/Makefile | 58 ---- source/blender/writeblenfile/test/Makefile | 54 ---- source/blender/writeblenfile/test/test.c | 48 --- 7 files changed, 627 deletions(-) delete mode 100644 source/blender/writeblenfile/BLO_writeblenfile.h delete mode 100644 source/blender/writeblenfile/Makefile delete mode 100644 source/blender/writeblenfile/SConscript delete mode 100644 source/blender/writeblenfile/intern/BLO_writeblenfile.c delete mode 100644 source/blender/writeblenfile/intern/Makefile delete mode 100644 source/blender/writeblenfile/test/Makefile delete mode 100644 source/blender/writeblenfile/test/test.c (limited to 'source/blender/writeblenfile') diff --git a/source/blender/writeblenfile/BLO_writeblenfile.h b/source/blender/writeblenfile/BLO_writeblenfile.h deleted file mode 100644 index a87f294b417..00000000000 --- a/source/blender/writeblenfile/BLO_writeblenfile.h +++ /dev/null @@ -1,61 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. The Blender - * Foundation also sells licenses for use in proprietary software under - * the Blender License. See http://www.blender.org/BL/ for information - * about this. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL/BL DUAL LICENSE BLOCK ***** - * - */ - -#ifndef BLO_WRITEBLENFILE_H -#define BLO_WRITEBLENFILE_H - -#ifdef __cplusplus -extern "C" { -#endif - - /** - * Writes a file from memory to disk. The filedescriptor of the - * targetfile is taken from mywfile. - * - * @param data pointer to the datachunk to write - * @param dataIn size of the datachunk to write (bytes) - * @param streamGlueHeader the eader describing this datachunk - * @returns 0 if the file was written correctly, non-0 if an error - * occured. */ - int -BLO_writeblenfile( - unsigned char *data, - unsigned int dataIn, - struct streamGlueHeaderStruct *streamGlueHeader); - -#ifdef __cplusplus -} -#endif - -#endif /* BLO_WRITEBLENFILE_H */ - diff --git a/source/blender/writeblenfile/Makefile b/source/blender/writeblenfile/Makefile deleted file mode 100644 index 2b8539af7c5..00000000000 --- a/source/blender/writeblenfile/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. The Blender -# Foundation also sells licenses for use in proprietary software under -# the Blender License. See http://www.blender.org/BL/ for information -# about this. -# -# This program 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL/BL DUAL LICENSE BLOCK ***** -# -# Bounces make to subdirectories. - -SOURCEDIR = source/blender/writeblenfile -DIRS = intern - -include nan_subdirs.mk diff --git a/source/blender/writeblenfile/SConscript b/source/blender/writeblenfile/SConscript deleted file mode 100644 index 8e7efdaacf3..00000000000 --- a/source/blender/writeblenfile/SConscript +++ /dev/null @@ -1,18 +0,0 @@ -Import ('extra_includes') -Import ('user_options_dict') -Import ('library_env') - -wrblenfile_env = library_env.Copy () - -source_files = ['intern/BLO_writeblenfile.c'] - -wrblenfile_env.Append (CPPPATH = ['.', - '../../kernel/gen_messaging', - '../blenloader', - '../writestreamglue', - '../readstreamglue', - '../readblenfile']) - -wrblenfile_env.Append (CPPPATH = user_options_dict['Z_INCLUDE']) -wrblenfile_env.Append (CPPPATH = extra_includes) -wrblenfile_env.Library (target='#'+user_options_dict['BUILD_DIR']+'/lib/blender_writeblenfile', source=source_files) diff --git a/source/blender/writeblenfile/intern/BLO_writeblenfile.c b/source/blender/writeblenfile/intern/BLO_writeblenfile.c deleted file mode 100644 index ab459359822..00000000000 --- a/source/blender/writeblenfile/intern/BLO_writeblenfile.c +++ /dev/null @@ -1,351 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. The Blender - * Foundation also sells licenses for use in proprietary software under - * the Blender License. See http://www.blender.org/BL/ for information - * about this. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL/BL DUAL LICENSE BLOCK ***** - * - */ - -#include -#include -#include // strlen - -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifdef _WIN32 -#include // open / write -#else // WIN32 -#include // write -#endif // WIN32 - -#include // open - -#include "zlib.h" - -#include "GEN_messaging.h" - -#include "BLO_readfile.h" - -#include "BLO_writeStreamGlue.h" -#include "BLO_writeblenfile.h" -#include "BLO_readblenfile.h" - -// some systems don't have / support O_BINARY -// on those systems we define it to 0 - -#ifndef O_BINARY -#define O_BINARY 0 -#endif - -struct BLO_writeblenfileStruct { - struct writeStreamGlueStruct **streamGlue; - int fileDes; - unsigned int bufferSize; - unsigned int inBuffer; - char *writeBuffer; - int filestartoffset; - int filesizeoffset; -}; - - int -BLO_writeblenfile_process( - struct BLO_writeblenfileStruct *control, - unsigned char *data, - unsigned int dataIn); - -/** - * Flushes buffered data to file - * @param control structure holding all variables - * @return 0 on success, 1 if write failed - */ - -static int flushbuffer( - struct BLO_writeblenfileStruct *control) -{ - int err = 0; - unsigned int written; - - if (control->inBuffer) { - written = write(control->fileDes, control->writeBuffer, control->inBuffer); - if (written != control->inBuffer) { - err = BWS_SETFUNCTION(BWS_WRITEBLENFILE) | - BWS_SETSPECERR(BWS_WRITE); - } else { - control->inBuffer = 0; - } - } - - return (err); -} - - -int BLO_writeblenfile( - unsigned char *data, - unsigned int dataIn, - struct streamGlueHeaderStruct *streamGlueHeader) -{ - struct BLO_writeblenfileStruct *writeblenfileStruct = 0; - int fileDes; - extern int mywfile; - int err = 0; - char minversion[4]; - char version[4]; - char flags[4]; - unsigned int filesize; - char reserved[BLO_RESERVEDSIZE]; - - fileDes = mywfile; - - if (fileDes == -1) { - /* The filedescriptor was bad: this is an internal error */ - err = BWS_SETFUNCTION(BWS_WRITEBLENFILE) | - BWS_SETSPECERR(BWS_FILEDES); - return err; - } - - writeblenfileStruct = calloc(1, sizeof(struct BLO_writeblenfileStruct)); - if (!writeblenfileStruct) { - err = BWS_SETFUNCTION(BWS_WRITEBLENFILE) | - BWS_SETGENERR(BWS_MALLOC); - return err; - } - - writeblenfileStruct->bufferSize = 100000; - writeblenfileStruct->writeBuffer = malloc(writeblenfileStruct->bufferSize); - if (!writeblenfileStruct->writeBuffer) { - err = BWS_SETFUNCTION(BWS_WRITEBLENFILE) | - BWS_SETGENERR(BWS_MALLOC); - return err; - } - - writeblenfileStruct->fileDes = fileDes; - writeblenfileStruct->filestartoffset = lseek(fileDes, 0, SEEK_CUR); - -#ifndef NDEBUG - fprintf(GEN_errorstream, - "BLO_writeblenfile writes headerMagic ...\n"); -#endif - - // write our own magic fileheader - err = BLO_writeblenfile_process(writeblenfileStruct, - headerMagic, - strlen(headerMagic)); - if (err) { - free(writeblenfileStruct->writeBuffer); - free(writeblenfileStruct); - return err; - } - - // write out the '\n' that we use for the - // cr / nl conversion - err = BLO_writeblenfile_process(writeblenfileStruct, - "\n", - 1); - if (err) { - free(writeblenfileStruct->writeBuffer); - free(writeblenfileStruct); - return err; - } - - BLO_setversionnumber(minversion, 221); - err = BLO_writeblenfile_process(writeblenfileStruct, - minversion, - sizeof(minversion)); - if (err) { - free(writeblenfileStruct->writeBuffer); - free(writeblenfileStruct); - return err; - } - - BLO_setcurrentversionnumber(version); - err = BLO_writeblenfile_process(writeblenfileStruct, - version, - sizeof(version)); - if (err) { - free(writeblenfileStruct->writeBuffer); - free(writeblenfileStruct); - return err; - } - - memset(flags, 0, sizeof(flags)); - err = BLO_writeblenfile_process(writeblenfileStruct, - flags, - sizeof(flags)); - if (err) { - free(writeblenfileStruct->writeBuffer); - free(writeblenfileStruct); - return err; - } - - // we'll have to write out the filesize in the end - // remember the location in the file but make sure to - // flush all cached data first... - - flushbuffer(writeblenfileStruct); - writeblenfileStruct->filesizeoffset = lseek(fileDes, 0, SEEK_CUR); - memset(&filesize, 0, sizeof(filesize)); - err = BLO_writeblenfile_process(writeblenfileStruct, - &filesize, - sizeof(filesize)); - if (err) { - free(writeblenfileStruct->writeBuffer); - free(writeblenfileStruct); - return err; - } - - memset(reserved, 0, sizeof(reserved)); - err = BLO_writeblenfile_process(writeblenfileStruct, - reserved, - sizeof(reserved)); - if (err) { - free(writeblenfileStruct->writeBuffer); - free(writeblenfileStruct); - return err; - } -#ifndef NDEBUG - fprintf(GEN_errorstream, - "BLO_writeblenfile writes streamGlueHeader of %u bytes\n", - STREAMGLUEHEADERSIZE); -#endif - - // Update streamGlueHeader that initiated us and write it away - // Note that streamGlueHeader is *behind* the magic fileheader - streamGlueHeader->totalStreamLength = htonl(0 + dataIn); - streamGlueHeader->crc = htonl(crc32(0L, - (const Bytef *) streamGlueHeader, STREAMGLUEHEADERSIZE - 4)); - err = BLO_writeblenfile_process(writeblenfileStruct, - (unsigned char *) streamGlueHeader, - STREAMGLUEHEADERSIZE); - if (err) { - free(writeblenfileStruct->writeBuffer); - free(writeblenfileStruct); - return err; - } - -#ifndef NDEBUG - fprintf(GEN_errorstream, - "BLO_writeblenfile writes %u bytes raw data\n", - dataIn); -#endif - - // write raw data - err = BLO_writeblenfile_process(writeblenfileStruct, - data, - dataIn); - if (err) { - free(writeblenfileStruct->writeBuffer); - free(writeblenfileStruct); - return err; - } - - err = flushbuffer(writeblenfileStruct); - if (err) { - free(writeblenfileStruct->writeBuffer); - free(writeblenfileStruct); - return err; - } - - // write filesize in header - // calculate filesize - filesize = lseek(fileDes, 0, SEEK_CUR); - filesize -= writeblenfileStruct->filestartoffset; - -#ifndef NDEBUG - fprintf(GEN_errorstream, - "BLO_writeblenfile total file size %u bytes\n", - filesize); -#endif - - // TODO There should be error catching here as well. - // goto filesize location in file - lseek(fileDes, writeblenfileStruct->filesizeoffset, SEEK_SET); - // and write out filesize in network byte order - filesize = htonl(filesize); - write(fileDes, &filesize, sizeof(filesize)); - // seek to end of file to cover up our tracks - lseek(fileDes, 0, SEEK_END); - - // clean up - free(writeblenfileStruct->writeBuffer); - free(writeblenfileStruct); - - return (err); -} - -/** - * Buffers data and writes it to disk when necessary - * @param control structure holding all variables - * @param dataIn Length of new chunk of data - * @param data Pointer to new chunk of data - */ - int -BLO_writeblenfile_process( - struct BLO_writeblenfileStruct *control, - unsigned char *data, - unsigned int dataIn) -{ - int err = 0; - unsigned int written; - - if (control && data) { - if (dataIn) { - // do we need to flush data ? - if ((dataIn + control->inBuffer) > control->bufferSize) { - err = flushbuffer(control); - } - - if (! err) { - // do we now have enough space in the buffer ? - if ((dataIn + control->inBuffer) <= control->bufferSize) { - // yes, just copy it to the buffer - memcpy(control->writeBuffer + control->inBuffer, data, dataIn); - control->inBuffer += dataIn; - } else { - // write data out immediately - written = write(control->fileDes, data, dataIn); - if (written != dataIn) { - err = BWS_SETFUNCTION(BWS_WRITEBLENFILE) | - BWS_SETSPECERR(BWS_WRITE); - } - } - } - } - } else { -#ifndef NDEBUG - fprintf(GEN_errorstream, - "BLO_writeblenfile_process: invalid parameters\n"); -#endif - err = BWS_SETFUNCTION(BWS_WRITEBLENFILE) | - BWS_SETSPECERR(BWS_PARAM); - } - - return err; -} - diff --git a/source/blender/writeblenfile/intern/Makefile b/source/blender/writeblenfile/intern/Makefile deleted file mode 100644 index e5ac144195f..00000000000 --- a/source/blender/writeblenfile/intern/Makefile +++ /dev/null @@ -1,58 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. The Blender -# Foundation also sells licenses for use in proprietary software under -# the Blender License. See http://www.blender.org/BL/ for information -# about this. -# -# This program 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL/BL DUAL LICENSE BLOCK ***** -# -# - -LIBNAME = writeblenfile -DIR = $(OCGDIR)/blender/$(LIBNAME) - -include nan_compile.mk - -ifeq ($(OS),$(findstring $(OS), "beos darwin freebsd linux openbsd solaris windows")) - CFLAGS += -funsigned-char -endif - -CFLAGS += $(LEVEL_2_C_WARNINGS) - -ifeq ($(OS),$(findstring $(OS), "solaris windows")) - CPPFLAGS += -I$(NAN_ZLIB)/include -endif - -# path to our own external headerfiles -CPPFLAGS += -I.. - -# external modules -CPPFLAGS += -I../../../kernel/gen_messaging -CPPFLAGS += -I../../writestreamglue -CPPFLAGS += -I../../readstreamglue -CPPFLAGS += -I../../readblenfile -CPPFLAGS += -I../../blenloader - diff --git a/source/blender/writeblenfile/test/Makefile b/source/blender/writeblenfile/test/Makefile deleted file mode 100644 index fe07aa8c9b4..00000000000 --- a/source/blender/writeblenfile/test/Makefile +++ /dev/null @@ -1,54 +0,0 @@ -# -# $Id$ -# -# ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. The Blender -# Foundation also sells licenses for use in proprietary software under -# the Blender License. See http://www.blender.org/BL/ for information -# about this. -# -# This program 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. -# All rights reserved. -# -# The Original Code is: all of this file. -# -# Contributor(s): none yet. -# -# ***** END GPL/BL DUAL LICENSE BLOCK ***** -# -# - -LIBNAME = writeblenfile -DIR = $(OCGDIR)/blender/$(LIBNAME) -ALLTARGETS = $(OBJS) $(DIR)/$(DEBUG_DIR)test$(EXT) - -include nan_compile.mk - -ifeq ($(OS),$(findstring $(OS), "beos darwin freebsd linux openbsd solaris windows")) - CFLAGS += -funsigned-char -endif - -CFLAGS += $(LEVEL_2_C_WARNINGS) - -# path to our own external headerfiles -CPPFLAGS += -I.. -CPPFLAGS += -I../../streamglue - -# TODO include right .mk for ldflags -$(DIR)/$(DEBUG_DIR)test$(EXT): $(OBJS) ../intern/BLO_writeblenfile.c - $(CC) $(LDFLAGS) -o $@ $(OBJS) $(OCGDIR)/blender/writeblenfile/$(DEBUG_DIR)libwriteblenfile.a - $(DIR)/$(DEBUG_DIR)test$(EXT) - diff --git a/source/blender/writeblenfile/test/test.c b/source/blender/writeblenfile/test/test.c deleted file mode 100644 index 450176c0761..00000000000 --- a/source/blender/writeblenfile/test/test.c +++ /dev/null @@ -1,48 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. The Blender - * Foundation also sells licenses for use in proprietary software under - * the Blender License. See http://www.blender.org/BL/ for information - * about this. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL/BL DUAL LICENSE BLOCK ***** - */ -#include // strlen -#include "BLO_writeblenfile.h" - -#ifdef HAVE_CONFIG_H -#include -#endif - -main() -{ - struct BLO_writeblenfileStruct *control; - char *string = "Hello world"; - - - control = BLO_writeblenfile_begin(); - BLO_writeblenfile_process(control, string, strlen(string)); - BLO_writeblenfile_end(control); -} -- cgit v1.2.3