1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
/*
flext - C++ layer for Max/MSP and pd (pure data) externals
Copyright (c) 2001-2003 Thomas Grill (xovo@gmx.net)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
*/
/*! \file flutil.cpp
\brief Implementation of the various utility functions.
*/
#include "flext.h"
#include <string.h>
#if FLEXT_OS == FLEXT_OS_WIN
#include <windows.h>
#elif FLEXT_OS == FLEXT_OS_MAC
#ifdef __MWERKS__
#include <MacMemory.h>
#else
#include <Carbon/Carbon.h>
#endif
#endif
void flext::CopyMem(void *dst,const void *src,int bytes)
{
#if FLEXT_OS == FLEXT_OS_WIN
MoveMemory(dst,src,bytes);
#elif FLEXT_OS == FLEXT_OS_MAC
BlockMoveData(src,dst,bytes);
#else
memcpy(dst,src,bytes);
#endif
}
void flext::ZeroMem(void *dst,int bytes)
{
#if FLEXT_OS == FLEXT_OS_WIN
ZeroMemory(dst,bytes);
#elif FLEXT_OS == FLEXT_OS_MAC
BlockZero(dst,bytes);
#else
memset(dst,0,bytes);
#endif
}
bool flext::Forward(const t_symbol *recv,const t_symbol *s,int argc,const t_atom *argv)
{
void *cl = recv->s_thing;
if(!cl) return false;
#if FLEXT_SYS == FLEXT_SYS_PD
pd_typedmess((t_class **)cl,(t_symbol *)s,argc,(t_atom *)argv);
#elif FLEXT_SYS == FLEXT_SYS_MAX
typedmess(recv->s_thing,(t_symbol *)s,argc,(t_atom *)argv);
#else
#error Not implemented
#endif
return true;
}
|