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:
authorKent Mein <mein@cs.umn.edu>2006-06-17 00:00:00 +0400
committerKent Mein <mein@cs.umn.edu>2006-06-17 00:00:00 +0400
commit8918232465c742db520078b107077ecdd3cace48 (patch)
treeccbad2ffa50b8c46770998a1ff88eff3e3b8c27f /source/blender/blenpluginapi
parent3593d0684adcb27a037678d40dd843a4914793db (diff)
This is a modified version of patch #4200
http://projects.blender.org/tracker/index.php?func=detail&aid=4200&group_id=9&atid=127 It adds platform depenant prefix to function calls (extern on non windows platforms more complicated on windows) So that windows plugins can reference functions inside of blender. there is a small TODO still... Make release should build the helper library required under windows and modify how they build the plugins: dlltool --input-def plugin.DEF --output-lib libblenerplugin.a --dllname blender.exe and the pulgins should be made with: gcc -c (pluginname).c gcc -shared -o (pluginname).dll (pluginname).o libblenderplugin.a Kent
Diffstat (limited to 'source/blender/blenpluginapi')
-rw-r--r--source/blender/blenpluginapi/externdef.h43
-rw-r--r--source/blender/blenpluginapi/iff.h94
-rw-r--r--source/blender/blenpluginapi/intern/pluginapi.c94
-rw-r--r--source/blender/blenpluginapi/plugin.DEF40
-rw-r--r--source/blender/blenpluginapi/plugin.h9
-rw-r--r--source/blender/blenpluginapi/util.h11
6 files changed, 197 insertions, 94 deletions
diff --git a/source/blender/blenpluginapi/externdef.h b/source/blender/blenpluginapi/externdef.h
new file mode 100644
index 00000000000..7322841e608
--- /dev/null
+++ b/source/blender/blenpluginapi/externdef.h
@@ -0,0 +1,43 @@
+/* Copyright (c) 1999, Not a Number / NeoGeo b.v.
+ *
+ * All rights reserved.
+ *
+ * Contact: info@blender.org
+ * Information: http://www.blender.org
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _EXTERNDEF_H
+#define _EXTERNDEF_H
+
+#ifdef WIN32
+ #ifdef PLUGIN_INTERN
+ #define LIBEXPORT __declspec(dllexport)
+ #else
+ #define LIBEXPORT extern __declspec(dllimport)
+ #endif
+#elif !defined(WIN32)
+ #define LIBEXPORT extern
+#endif
+
+#endif /* _EXTERNDEF_H */
diff --git a/source/blender/blenpluginapi/iff.h b/source/blender/blenpluginapi/iff.h
index 6ff84b11c39..e0536651f1b 100644
--- a/source/blender/blenpluginapi/iff.h
+++ b/source/blender/blenpluginapi/iff.h
@@ -33,6 +33,7 @@
#include <sys/types.h>
#include "util.h"
+#include "externdef.h"
#define IB_rect (1 << 0)
#define IB_planes (1 << 1)
@@ -159,58 +160,47 @@ typedef struct ImBuf{
int refcounter;
} ImBuf;
-extern struct ImBuf *allocImBuf(short,short,uchar,uint,uchar);
-extern struct ImBuf *dupImBuf(struct ImBuf *);
-extern void freeImBuf(struct ImBuf*);
-
-extern short converttocmap(struct ImBuf* ibuf);
-
-extern short saveiff(struct ImBuf *,char *,int);
-
-extern struct ImBuf *loadiffmem(int *,int);
-extern struct ImBuf *loadifffile(int,int);
-extern struct ImBuf *loadiffname(char *,int);
-extern struct ImBuf *testiffname(char *,int);
-
-extern struct ImBuf *onehalf(struct ImBuf *);
-extern struct ImBuf *onethird(struct ImBuf *);
-extern struct ImBuf *halflace(struct ImBuf *);
-extern struct ImBuf *half_x(struct ImBuf *);
-extern struct ImBuf *half_y(struct ImBuf *);
-extern struct ImBuf *double_x(struct ImBuf *);
-extern struct ImBuf *double_y(struct ImBuf *);
-extern struct ImBuf *double_fast_x(struct ImBuf *);
-extern struct ImBuf *double_fast_y(struct ImBuf *);
-
-extern int ispic(char *);
-
-extern void dit2(struct ImBuf *, short, short);
-extern void dit0(struct ImBuf *, short, short);
-
-extern struct ImBuf *scaleImBuf(struct ImBuf *, short, short);
-extern struct ImBuf *scalefastImBuf(struct ImBuf *, short, short);
-extern struct ImBuf *scalefieldImBuf(struct ImBuf *, short, short);
-extern struct ImBuf *scalefastfieldImBuf(struct ImBuf *, short, short);
-
-/* Not sure if needed or not... was in the release version of this header.
-I think its old but figured I'd leave it for a bit just incase.
-mein@cs.umn.edu
-extern void floyd(struct ImBuf *, short, short);
-extern void dit3(struct ImBuf *, short, short);
-extern void dit4(struct ImBuf *, short, short);
-extern void (*ditherfunc)(struct ImBuf *, short, short);
-extern long getdither();
-*/
-
-extern void de_interlace(struct ImBuf *ib);
-extern void interlace(struct ImBuf *ib);
-extern void gamwarp(struct ImBuf *ibuf, double gamma);
-
-extern void rectop(struct ImBuf *dbuf, struct ImBuf *sbuf,
- int destx, int desty, int srcx,
- int srcy, int width, int height,
- void (*operation)(unsigned int *, unsigned int*, int, int),
- int value);
+LIBEXPORT struct ImBuf *allocImBuf(short,short,uchar,uint,uchar);
+LIBEXPORT struct ImBuf *dupImBuf(struct ImBuf *);
+LIBEXPORT void freeImBuf(struct ImBuf*);
+
+LIBEXPORT short converttocmap(struct ImBuf* ibuf);
+
+LIBEXPORT short saveiff(struct ImBuf *,char *,int);
+
+LIBEXPORT struct ImBuf *loadiffmem(int *,int);
+LIBEXPORT struct ImBuf *loadifffile(int,int);
+LIBEXPORT struct ImBuf *loadiffname(char *,int);
+LIBEXPORT struct ImBuf *testiffname(char *,int);
+
+LIBEXPORT struct ImBuf *onehalf(struct ImBuf *);
+LIBEXPORT struct ImBuf *onethird(struct ImBuf *);
+LIBEXPORT struct ImBuf *halflace(struct ImBuf *);
+LIBEXPORT struct ImBuf *half_x(struct ImBuf *);
+LIBEXPORT struct ImBuf *half_y(struct ImBuf *);
+LIBEXPORT struct ImBuf *double_x(struct ImBuf *);
+LIBEXPORT struct ImBuf *double_y(struct ImBuf *);
+LIBEXPORT struct ImBuf *double_fast_x(struct ImBuf *);
+LIBEXPORT struct ImBuf *double_fast_y(struct ImBuf *);
+
+LIBEXPORT int ispic(char *);
+
+LIBEXPORT void dit2(struct ImBuf *, short, short);
+LIBEXPORT void dit0(struct ImBuf *, short, short);
+
+LIBEXPORT struct ImBuf *scaleImBuf(struct ImBuf *, short, short);
+LIBEXPORT struct ImBuf *scalefastImBuf(struct ImBuf *, short, short);
+LIBEXPORT struct ImBuf *scalefieldImBuf(struct ImBuf *, short, short);
+LIBEXPORT struct ImBuf *scalefastfieldImBuf(struct ImBuf *, short, short);
+
+LIBEXPORT void de_interlace(struct ImBuf *ib);
+LIBEXPORT void interlace(struct ImBuf *ib);
+LIBEXPORT void gamwarp(struct ImBuf *ibuf, double gamma);
+
+LIBEXPORT void IMB_rectcpy(struct ImBuf *dbuf, struct ImBuf *sbuf,
+ int destx, int desty, int srcx, int srcy, int width, int height);
+
+LIBEXPORT void IMB_rectfill(struct ImBuf *drect, float col[4]);
#endif /* IFF_H */
diff --git a/source/blender/blenpluginapi/intern/pluginapi.c b/source/blender/blenpluginapi/intern/pluginapi.c
index a60880fb535..872c8c55141 100644
--- a/source/blender/blenpluginapi/intern/pluginapi.c
+++ b/source/blender/blenpluginapi/intern/pluginapi.c
@@ -41,6 +41,9 @@
* - util.h : Useful defines, memory management.
*/
+#define PLUGIN_INTERN /* This tells the LIBEXPORT macro to compile with
+ dll export set on windows */
+
#ifdef WIN32
#include "blenpluginapi/util.h"
#else
@@ -51,32 +54,50 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h" /* util and noise functions */
+#include "BLI_threads.h" /* For threadsfe guardedalloc malloc/calloc/free */
#include "IMB_imbuf.h" /* image buffer stuff */
/* -------------------------------------------------------------------------- */
/* stuff from util.h */
/* -------------------------------------------------------------------------- */
-void *mallocN(int len, char *str)
+LIBEXPORT void *mallocN(int len, char *str)
{
return MEM_mallocN(len, str);
}
-void *callocN(int len, char *str)
+LIBEXPORT void *callocN(int len, char *str)
{
return MEM_callocN(len, str);
}
-short freeN(void *vmemh)
+LIBEXPORT short freeN(void *vmemh)
{
return MEM_freeN(vmemh);
}
+
+LIBEXPORT void *mallocT(int len, char *str)
+{
+ return MEM_mallocT(len, str);
+}
+
+LIBEXPORT void *callocT(int len, char *str)
+{
+ return MEM_callocT(len, str);
+}
+
+LIBEXPORT void freeT(void *vmemh)
+{
+ return MEM_freeT(vmemh);
+}
+
+
/* -------------------------------------------------------------------------- */
/* stuff from iff.h */
/* -------------------------------------------------------------------------- */
-struct ImBuf *allocImBuf(short x,
+LIBEXPORT struct ImBuf *allocImBuf(short x,
short y,
uchar d,
uint flags,
@@ -86,109 +107,109 @@ struct ImBuf *allocImBuf(short x,
}
-struct ImBuf *dupImBuf(struct ImBuf *ib)
+LIBEXPORT struct ImBuf *dupImBuf(struct ImBuf *ib)
{
return IMB_dupImBuf(ib);
}
-void freeImBuf(struct ImBuf* ib)
+LIBEXPORT void freeImBuf(struct ImBuf* ib)
{
IMB_freeImBuf(ib);
}
-short converttocmap(struct ImBuf* ibuf)
+LIBEXPORT short converttocmap(struct ImBuf* ibuf)
{
return IMB_converttocmap(ibuf);
}
-short saveiff(struct ImBuf *ib,
+LIBEXPORT short saveiff(struct ImBuf *ib,
char *c,
int i)
{
return IMB_saveiff(ib, c, i);
}
-struct ImBuf *loadiffmem(int *mem,int flags)
+LIBEXPORT struct ImBuf *loadiffmem(int *mem,int flags)
{
return IMB_loadiffmem(mem, flags);
}
-struct ImBuf *loadifffile(int a,
+LIBEXPORT struct ImBuf *loadifffile(int a,
int b)
{
return IMB_loadifffile(a, b);
}
-struct ImBuf *loadiffname(char *n,
+LIBEXPORT struct ImBuf *loadiffname(char *n,
int flags)
{
return IMB_loadiffname(n, flags);
}
-struct ImBuf *testiffname(char *n,
+LIBEXPORT struct ImBuf *testiffname(char *n,
int flags)
{
return IMB_testiffname(n, flags);
}
-struct ImBuf *onehalf(struct ImBuf *ib)
+LIBEXPORT struct ImBuf *onehalf(struct ImBuf *ib)
{
return IMB_onehalf(ib);
}
-struct ImBuf *onethird(struct ImBuf *ib)
+LIBEXPORT struct ImBuf *onethird(struct ImBuf *ib)
{
return IMB_onethird(ib);
}
-struct ImBuf *halflace(struct ImBuf *ib)
+LIBEXPORT struct ImBuf *halflace(struct ImBuf *ib)
{
return IMB_halflace(ib);
}
-struct ImBuf *half_x(struct ImBuf *ib)
+LIBEXPORT struct ImBuf *half_x(struct ImBuf *ib)
{
return IMB_half_x(ib);
}
-struct ImBuf *half_y(struct ImBuf *ib)
+LIBEXPORT struct ImBuf *half_y(struct ImBuf *ib)
{
return IMB_half_y(ib);
}
-struct ImBuf *double_x(struct ImBuf *ib)
+LIBEXPORT struct ImBuf *double_x(struct ImBuf *ib)
{
return IMB_double_x(ib);
}
-struct ImBuf *double_y(struct ImBuf *ib)
+LIBEXPORT struct ImBuf *double_y(struct ImBuf *ib)
{
return IMB_double_y(ib);
}
-struct ImBuf *double_fast_x(struct ImBuf *ib)
+LIBEXPORT struct ImBuf *double_fast_x(struct ImBuf *ib)
{
return IMB_double_fast_x(ib);
}
-struct ImBuf *double_fast_y(struct ImBuf *ib)
+LIBEXPORT struct ImBuf *double_fast_y(struct ImBuf *ib)
{
return IMB_double_fast_y(ib);
}
-int ispic(char * name)
+LIBEXPORT int ispic(char * name)
{
return IMB_ispic(name);
}
-void dit2(struct ImBuf *ib,
+LIBEXPORT void dit2(struct ImBuf *ib,
short a,
short b)
{
IMB_dit2(ib, a, b);
}
-void dit0(struct ImBuf *ib,
+LIBEXPORT void dit0(struct ImBuf *ib,
short a,
short b)
{
@@ -198,14 +219,14 @@ void dit0(struct ImBuf *ib,
/* still the same name */
/* void (*ditherfunc)(struct ImBuf *, short, short){} */
-struct ImBuf *scaleImBuf(struct ImBuf *ib,
+LIBEXPORT struct ImBuf *scaleImBuf(struct ImBuf *ib,
short nx,
short ny)
{
return IMB_scaleImBuf(ib, nx, ny);
}
-struct ImBuf *scalefastImBuf(struct ImBuf *ib,
+LIBEXPORT struct ImBuf *scalefastImBuf(struct ImBuf *ib,
short x,
short y)
{
@@ -213,14 +234,14 @@ struct ImBuf *scalefastImBuf(struct ImBuf *ib,
}
-struct ImBuf *scalefieldImBuf(struct ImBuf *ib,
+LIBEXPORT struct ImBuf *scalefieldImBuf(struct ImBuf *ib,
short x,
short y)
{
return IMB_scalefieldImBuf(ib, x, y);
}
-struct ImBuf *scalefastfieldImBuf(struct ImBuf *ib,
+LIBEXPORT struct ImBuf *scalefastfieldImBuf(struct ImBuf *ib,
short x,
short y)
{
@@ -231,17 +252,17 @@ struct ImBuf *scalefastfieldImBuf(struct ImBuf *ib,
* even though they aren't in the header
*/
-void interlace(struct ImBuf *ibuf)
+LIBEXPORT void interlace(struct ImBuf *ibuf)
{
IMB_interlace(ibuf);
}
-void gamwarp(struct ImBuf *ibuf, double gamma)
+LIBEXPORT void gamwarp(struct ImBuf *ibuf, double gamma)
{
IMB_gamwarp(ibuf,gamma);
}
-void de_interlace(struct ImBuf *ib)
+LIBEXPORT void de_interlace(struct ImBuf *ib)
{
IMB_de_interlace(ib);
}
@@ -257,7 +278,7 @@ void de_interlace(struct ImBuf *ib)
/* int plugin_seq_getversion(void); */
/* void plugin_getinfo(PluginInfo *); */
-float hnoise(float noisesize,
+LIBEXPORT float hnoise(float noisesize,
float x,
float y,
float z)
@@ -265,7 +286,7 @@ float hnoise(float noisesize,
return BLI_hnoise(noisesize, x, y, z);
}
-float hnoisep(float noisesize,
+LIBEXPORT float hnoisep(float noisesize,
float x,
float y,
float z)
@@ -273,7 +294,7 @@ float hnoisep(float noisesize,
return BLI_hnoisep(noisesize, x, y, z);
}
-float turbulence(float noisesize,
+LIBEXPORT float turbulence(float noisesize,
float x,
float y,
float z,
@@ -282,7 +303,7 @@ float turbulence(float noisesize,
return BLI_turbulence(noisesize, x, y, z, depth);
}
-float turbulence1(float noisesize,
+LIBEXPORT float turbulence1(float noisesize,
float x,
float y,
float z,
@@ -305,6 +326,9 @@ int pluginapi_force_ref(void)
return (int) mallocN +
(int) callocN +
(int) freeN +
+ (int) mallocT +
+ (int) callocT +
+ (int) freeT +
(int) allocImBuf +
(int) dupImBuf +
(int) freeImBuf +
diff --git a/source/blender/blenpluginapi/plugin.DEF b/source/blender/blenpluginapi/plugin.DEF
new file mode 100644
index 00000000000..ae2692c7cff
--- /dev/null
+++ b/source/blender/blenpluginapi/plugin.DEF
@@ -0,0 +1,40 @@
+LIBRARY
+EXPORTS
+mallocN
+callocN
+freeN
+mallocT
+callocT
+freeT
+hnoise
+hnoisep
+turbulence
+turbulence1
+allocImBuf
+dupImBuf
+freeImBuf
+converttocmap
+saveiff
+loadiffmem
+loadifffile
+loadiffname
+testiffname
+onehalf
+onethird
+halflace
+half_x
+half_y
+double_x
+double_y
+double_fast_x
+double_fast_y
+ispic
+dit2
+dit0
+scaleImBuf
+scalefastImBuf
+scalefieldImBuf
+scalefastfieldImBuf
+de_interlace
+interlace
+gamwarp
diff --git a/source/blender/blenpluginapi/plugin.h b/source/blender/blenpluginapi/plugin.h
index 9d353cc611a..f7ffc7e7c8e 100644
--- a/source/blender/blenpluginapi/plugin.h
+++ b/source/blender/blenpluginapi/plugin.h
@@ -31,6 +31,7 @@
#ifndef PLUGIN_H
#define PLUGIN_H
+#include "externdef.h"
#include "iff.h"
#include "util.h"
#include "floatpatch.h"
@@ -87,14 +88,14 @@ void plugin_getinfo(PluginInfo *);
/* *************** API functions ******************** */
/* derived from the famous Perlin noise */
-extern float hnoise(float noisesize, float x, float y, float z);
+LIBEXPORT float hnoise(float noisesize, float x, float y, float z);
/* the original Perlin noise */
-extern float hnoisep(float noisesize, float x, float y, float z);
+LIBEXPORT float hnoisep(float noisesize, float x, float y, float z);
/* soft turbulence */
-extern float turbulence(float noisesize, float x, float y, float z, int depth);
+LIBEXPORT float turbulence(float noisesize, float x, float y, float z, int depth);
/* hard turbulence */
-extern float turbulence1(float noisesize, float x, float y, float z, int depth);
+LIBEXPORT float turbulence1(float noisesize, float x, float y, float z, int depth);
#endif /* PLUGIN_H */
diff --git a/source/blender/blenpluginapi/util.h b/source/blender/blenpluginapi/util.h
index da566bf3969..b0b5f3aae54 100644
--- a/source/blender/blenpluginapi/util.h
+++ b/source/blender/blenpluginapi/util.h
@@ -34,6 +34,7 @@
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
+#include "externdef.h"
#ifndef NULL
#define NULL 0
@@ -87,9 +88,13 @@
#define PRINT3(d, e, f, var1, var2, var3) printf(# var1 ":%" # d " " # var2 ":%" # e " " # var3 ":%" # f "\n", var1, var2, var3)
#define PRINT4(d, e, f, g, var1, var2, var3, var4) printf(# var1 ":%" # d " " # var2 ":%" # e " " # var3 ":%" # f " " # var4 ":%" # g "\n", var1, var2, var3, var4)
-extern void *mallocN(int len, char *str);
-extern void *callocN(int len, char *str);
-extern short freeN(void *vmemh);
+LIBEXPORT void *mallocN(int len, char *str);
+LIBEXPORT void *callocN(int len, char *str);
+LIBEXPORT short freeN(void *vmemh);
+
+LIBEXPORT void *mallocT(int len, char *str);
+LIBEXPORT void *callocT(int len, char *str);
+LIBEXPORT void freeT(void *vmemh);
#endif /* UTIL_H */