diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/makefile.darwin | 3 | ||||
-rw-r--r-- | src/z_count.c | 35 | ||||
-rw-r--r-- | src/z_pack.c | 2 | ||||
-rw-r--r-- | src/z_urn.c | 120 | ||||
-rw-r--r-- | src/zexy.dsp | 22 |
5 files changed, 14 insertions, 168 deletions
diff --git a/src/makefile.darwin b/src/makefile.darwin index 6cbbf37..e29363e 100644 --- a/src/makefile.darwin +++ b/src/makefile.darwin @@ -37,7 +37,8 @@ TARGETS = zexy \ z_dfreq z_sigzero z_pdf \ z_sfplay z_sfrecord \ z_sigpack z_wrap \ - z_prime z_random + z_prime z_random \ + z_operating_system # ----------------------- MACOSX ---------------------------- .SUFFIXES: .pd_darwin diff --git a/src/z_count.c b/src/z_count.c deleted file mode 100644 index 103be4f..0000000 --- a/src/z_count.c +++ /dev/null @@ -1,35 +0,0 @@ -#include "m_pd.h" - -static t_class *prime_class; - -typedef struct _prime { - t_object x_obj; - t_int i_count; -} t_prime; - - -void prime_bug(t_prime *x) -{ - bug("bug!"); -} - -void *prime_new(t_floatarg f) -{ - t_prime *x = (t_prime *)pd_new(prime_class); - - x->i_count=f; - outlet_new(&x->x_obj, &s_float); - - return (void *)x; -} - -void z_prime_setup(void) { - prime_class = class_new(gensym("prime"), - (t_newmethod)prime_new, - 0, sizeof(t_prime), - CLASS_DEFAULT, 0); - - class_addbang(prime_class, prime_bang); - class_addmethod(prime_class, (t_method)prime_bug, gensym("bug"), 0); - class_addmethod(prime_class, (t_method)prime_error, gensym("error"), 0); -} diff --git a/src/z_pack.c b/src/z_pack.c index a889f93..6484093 100644 --- a/src/z_pack.c +++ b/src/z_pack.c @@ -12,7 +12,7 @@ #include <string.h> #ifdef NT #include <memory.h> -#error do we need memory.h +//#error do we need memory.h #endif diff --git a/src/z_urn.c b/src/z_urn.c deleted file mode 100644 index 5b31330..0000000 --- a/src/z_urn.c +++ /dev/null @@ -1,120 +0,0 @@ - -/* 1008:forum::für::umläute:2001 */ - -/* - urn : "generate random numbers without duplicates" - very max-like -*/ - -#include "zexy.h" - -/* ------------------------- urn ------------------------------- */ - -static t_class *urn_class; - -typedef struct _urn -{ - t_object x_obj; - unsigned int x_seed; /* the seed of the generator */ - - unsigned int x_range; /* max. random-number + 1 */ - unsigned int x_count; /* how many random numbers have we generated ? */ - char *x_state; /* has this number been generated already ? */ -} t_urn; - -static int makeseed(void) -{ - static unsigned int random_nextseed = 1489853723; - random_nextseed = random_nextseed * 435898247 + 938284287; - return (random_nextseed & 0x7fffffff); -} - -static void urn_clear(t_urn *x) -{ - unsigned int i=x->x_range; - t_int *dummy=(t_int*)x->x_state; - while(i--)*dummy++=0; - x->x_count=0; -} - -static void makestate(t_urn *x, unsigned int newrange) -{ - if (x->x_range == newrange)return; - - if (x->x_range && x->x_state) { - freebytes(x->x_state, sizeof(char)*x->x_range); - x->x_state=0; - } - - x->x_range=newrange; - x->x_state=getbytes(sizeof(char)*x->x_range); - - urn_clear(x); -} - -static void urn_bang(t_urn *x) -{ - unsigned int range = (x->x_range<1?1:x->x_range); - unsigned int randval = (unsigned int)x->x_state; - - unsigned int nval, used=1; - - if (x->x_count>=range)urn_clear(x); - - while (used) { - randval = randval * 472940017 + 832416023; - nval = ((double)range) * ((double)randval) - * (1./4294967296.); - if (nval >= range) nval = range-1; - used=x->x_state[nval]; - } - - x->x_count++; - x->x_state[nval]=1; - outlet_float(x->x_obj.ob_outlet, nval); -} - -static void urn_flt2(t_urn *x, t_float f) -{ - unsigned int range = (f<1)?1:f; - makestate(x, range); -} - - -static void urn_seed(t_urn *x, t_float f) -{ - x->x_seed = f; -} - -static void *urn_new(t_floatarg f) -{ - t_urn *x = (t_urn *)pd_new(urn_class); - - if (f<1.0)f=1.0; - x->x_range = f; - x->x_seed = makeseed(); - inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("")); - outlet_new(&x->x_obj, &s_float); - return (x); - - return (x); -} - -static void urn_setup(void) -{ - urn_class = class_new(gensym("urn"), (t_newmethod)urn_new, - 0, sizeof(t_urn), 0, A_DEFFLOAT, 0); - - class_addbang (urn_class, urn_bang); - class_addmethod(urn_class, (t_method)urn_clear, gensym("clear"), 0); - class_addmethod(urn_class, (t_method)urn_flt2, gensym(""), A_DEFFLOAT, 0); - class_addmethod(urn_class, (t_method)urn_seed, gensym("seed"), A_DEFFLOAT, 0); - - - class_sethelpsymbol(urn_class, gensym("zexy/urn")); -} - -void z_random_setup(void) -{ - urn_setup(); -} diff --git a/src/zexy.dsp b/src/zexy.dsp index 798a35f..98c27ce 100644 --- a/src/zexy.dsp +++ b/src/zexy.dsp @@ -39,7 +39,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZEXY_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /I "..\..\src" /D "WIN32" /D "NT" /D "_WINDOWS" /D "ZEXY" /FR /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /I "..\..\..\pd\src" /D "WIN32" /D "NT" /D "_WINDOWS" /D "ZEXY" /FR /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /win32
# SUBTRACT MTL /mktyplib203
@@ -50,7 +50,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib wsock32.lib uuid.lib libc.lib oldnames.lib pd.lib /nologo /dll /machine:I386 /nodefaultlib /out:"..\zexy.dll" /libpath:"../../bin" /export:zexy_setup
+# ADD LINK32 kernel32.lib wsock32.lib uuid.lib libc.lib oldnames.lib pd.lib /nologo /dll /machine:I386 /nodefaultlib /out:"..\zexy.dll" /libpath:"../../bin" /libpath:"C:\Programme\pd\bin" /export:zexy_setup
# SUBTRACT LINK32 /pdb:none
# Begin Target
@@ -80,10 +80,6 @@ SOURCE=.\z_dfreq.c # End Source File
# Begin Source File
-SOURCE=.\z_down.c
-# End Source File
-# Begin Source File
-
SOURCE=.\z_drip.c
# End Source File
# Begin Source File
@@ -108,10 +104,6 @@ SOURCE=.\z_msgfile.c # End Source File
# Begin Source File
-SOURCE=.\z_mtx.c
-# End Source File
-# Begin Source File
-
SOURCE=.\z_multiline.c
# End Source File
# Begin Source File
@@ -128,6 +120,10 @@ SOURCE=.\z_nop.c # End Source File
# Begin Source File
+SOURCE=.\z_operating_system.c
+# End Source File
+# Begin Source File
+
SOURCE=.\z_pack.c
# End Source File
# Begin Source File
@@ -136,7 +132,7 @@ SOURCE=.\z_pdf.c # End Source File
# Begin Source File
-SOURCE=.\z_point.c
+SOURCE=.\z_prime.c
# End Source File
# Begin Source File
@@ -200,6 +196,10 @@ SOURCE=.\z_testfun.c # End Source File
# Begin Source File
+SOURCE=.\z_wrap.c
+# End Source File
+# Begin Source File
+
SOURCE=.\z_zdelay.c
# End Source File
# Begin Source File
|