diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2005-04-07 15:00:32 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2005-04-07 15:00:32 +0000 |
commit | 69dbb48d5aecd79db7de86b57b502490b4d4ada8 (patch) | |
tree | 8b2c3c8b59815077f73c7ced5fd141b31dde2806 | |
parent | 29b900a7e14097229773eb5942303d673c6d1b73 (diff) |
resurrected delsplit external
changed delimiter specification
more fixes
svn path=/trunk/; revision=2686
-rw-r--r-- | externals/grill/delsplit/delsplit.dsp | 95 | ||||
-rwxr-xr-x | externals/grill/delsplit/delsplit.mpw | 81 | ||||
-rw-r--r-- | externals/grill/delsplit/delsplit.vcproj.vspscc | 10 | ||||
-rw-r--r-- | externals/grill/delsplit/help-delsplit.pd | 17 | ||||
-rwxr-xr-x | externals/grill/delsplit/main.cpp | 133 | ||||
-rw-r--r-- | externals/grill/delsplit/package.txt | 2 |
6 files changed, 90 insertions, 248 deletions
diff --git a/externals/grill/delsplit/delsplit.dsp b/externals/grill/delsplit/delsplit.dsp deleted file mode 100644 index f8e2da93..00000000 --- a/externals/grill/delsplit/delsplit.dsp +++ /dev/null @@ -1,95 +0,0 @@ -# Microsoft Developer Studio Project File - Name="delsplit" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** NICHT BEARBEITEN ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=delsplit - Win32 Debug -!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE -!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl -!MESSAGE -!MESSAGE NMAKE /f "delsplit.mak". -!MESSAGE -!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben -!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel: -!MESSAGE -!MESSAGE NMAKE /f "delsplit.mak" CFG="delsplit - Win32 Debug" -!MESSAGE -!MESSAGE Für die Konfiguration stehen zur Auswahl: -!MESSAGE -!MESSAGE "delsplit - Win32 Release" (basierend auf "Win32 (x86) Dynamic-Link Library") -!MESSAGE "delsplit - Win32 Debug" (basierend auf "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "delsplit" -# PROP Scc_LocalPath "." -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "delsplit - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "pd-msvc/r" -# PROP Intermediate_Dir "pd-msvc/r" -# 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 "DELSPLIT_EXPORTS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "c:\programme\audio\pd\src" /I "f:\prog\max\flext\source" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D FLEXT_SYS=2 /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0xc07 /d "NDEBUG" -# ADD RSC /l 0xc07 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# 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 user32.lib gdi32.lib pd.lib flext-pdwin.lib /nologo /dll /machine:I386 /libpath:"c:\programme\audio\pd\bin" /libpath:"f:\prog\max\flext\pd-msvc" - -!ELSEIF "$(CFG)" == "delsplit - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "pd-msvc/d" -# PROP Intermediate_Dir "pd-msvc/d" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DELSPLIT_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "c:\programme\audio\pd\src" /I "f:\prog\max\flext\source" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D FLEXT_SYS=2 /FR /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0xc07 /d "_DEBUG" -# ADD RSC /l 0xc07 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# 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 /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib pd.lib flext_d-pdwin.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"c:\programme\audio\pd\bin" /libpath:"f:\prog\max\flext\pd-msvc" - -!ENDIF - -# Begin Target - -# Name "delsplit - Win32 Release" -# Name "delsplit - Win32 Debug" -# Begin Source File - -SOURCE=.\main.cpp -# End Source File -# End Target -# End Project diff --git a/externals/grill/delsplit/delsplit.mpw b/externals/grill/delsplit/delsplit.mpw deleted file mode 100755 index d167f4b1..00000000 --- a/externals/grill/delsplit/delsplit.mpw +++ /dev/null @@ -1,81 +0,0 @@ -# delsplit - split symbol with delimiter into list -# Copyright (c) 2002 Thomas Grill (xovo@gmx.net) -# -# Makefile for Apple MPW-PR -# -# usage: make -f delsplit.mpw -# -# --------------------------------------------- - -MAKEFILE = delsplit.mpw -¥MondoBuild¥ = {MAKEFILE} # Make blank to avoid rebuilds when makefile is modified - -Name = delsplit - -ObjDir = :MPW: -MaxSDK = HD Daten:Prog Stuff:Max/MSP SDK:SDK Examples -flext = ::flext: -Includes = -i :,"{flext}source","{MaxSDK}:Max Includes","{MaxSDK}:MSP Includes" -Defines = -d MAXMSP - -Sym-PPC = -sym off -Flags = -bool on -enum int -includes unix -opt speed,unroll,unswitch - - -PPCCPlusOptions = {Includes} {Sym-PPC} {Defines} {Flags} - - -### Source Files ### - -SrcFiles = main.cpp -Headers = - - -### Object Files ### - -Obj-PPC = ¶ - "{ObjDir}main.cpp.x" - -LibFiles-Ext = ¶ - "{flext}MPW:flext.o" ¶ - "{MaxSDK}:Max Includes:MaxLib" ¶ - "{MaxSDK}:MSP Includes:MaxAudioLib" - -### Libraries ### - -LibFiles-PPC = ¶ - "{SharedLibraries}StdCLib" ¶ - "{SharedLibraries}MathLib" ¶ - "{PPCLibraries}StdCRuntime.o" ¶ - "{PPCLibraries}PPCCRuntime.o" ¶ - "{PPCLibraries}MrCPlusLib.o" ¶ - - -### Default Rules ### - -{ObjDir} Ä : - -.cpp.x Ä .cpp {¥MondoBuild¥} {Headers} - {PPCCPlus} {depDir}{default}.cpp -o {targDir}{default}.cpp.x {PPCCPlusOptions} - - -### Build Rules ### - -all Ä Folder {¥MondoBuild¥} {ObjDir}{Name} - -Folder ÄÄ - if !`Exists {ObjDir}` ; NewFolder {ObjDir} ; end - -{ObjDir}{Name} Ä {Obj-PPC} - PPCLink ¶ - -o {Targ} ¶ - {deps} ¶ - {LibFiles-Ext} ¶ - {LibFiles-PPC} ¶ - {Sym-PPC} ¶ - -mf -d ¶ - -t 'iLaF' ¶ - -c 'max2' ¶ - -xm s ¶ - -export main ¶ - -main main diff --git a/externals/grill/delsplit/delsplit.vcproj.vspscc b/externals/grill/delsplit/delsplit.vcproj.vspscc deleted file mode 100644 index 6cb031bc..00000000 --- a/externals/grill/delsplit/delsplit.vcproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT" -} diff --git a/externals/grill/delsplit/help-delsplit.pd b/externals/grill/delsplit/help-delsplit.pd new file mode 100644 index 00000000..3ed32b9e --- /dev/null +++ b/externals/grill/delsplit/help-delsplit.pd @@ -0,0 +1,17 @@ +#N canvas 300 90 458 286 12;
+#X msg 264 133 symbol -;
+#X msg 232 57 list;
+#X msg 242 84 list +;
+#X obj 105 229 print;
+#X obj 43 69 tosymbol;
+#X msg 42 42 ask+asd-ssds;
+#X symbolatom 251 111 10 0 0 0 - - -;
+#X obj 105 203 delsplit;
+#X text 273 54 space;
+#X connect 0 0 7 1;
+#X connect 1 0 7 1;
+#X connect 2 0 7 1;
+#X connect 4 0 7 0;
+#X connect 5 0 4 0;
+#X connect 6 0 7 1;
+#X connect 7 0 3 0;
diff --git a/externals/grill/delsplit/main.cpp b/externals/grill/delsplit/main.cpp index bfd2b52c..bf65a6b7 100755 --- a/externals/grill/delsplit/main.cpp +++ b/externals/grill/delsplit/main.cpp @@ -2,16 +2,18 @@ delsplit - split a delimited list-in-a-symbol -Copyright (c) 2002-2003 Thomas Grill (xovo@gmx.net) +Copyright (c) 2002-2005 Thomas Grill (gr@grrrr.org) For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. */ +#define FLEXT_ATTRIBUTES 1 + #include <flext.h> -#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401) -#error You need at least flext version 0.4.1 +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 500) +#error You need at least flext version 0.5.0 #endif #include <string.h> @@ -19,15 +21,8 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include <stdio.h> #include <ctype.h> -#define I int -#define L long -#define F float -#define D double -#define V void -#define C char -#define BL bool -#define VERSION "0.1.2" +#define VERSION "0.1.4" #ifdef __MWERKS__ #define STD std @@ -42,52 +37,54 @@ class delsplit: FLEXT_HEADER_S(delsplit,flext_base,Setup) public: - delsplit(I argc,const t_atom *argv); + delsplit(int argc,const t_atom *argv); protected: - V m_list(const t_symbol *s); - V m_del(const t_symbol *s); + void m_list(const t_symbol *s); + void m_del(const t_symbol *s,int argc,const t_atom *argv); const t_symbol *delim; - virtual void m_help(); - - static V SetAtom(t_atom &l,const C *s); + static void SetAtom(t_atom &l,const char *s); private: - static V Setup(t_classid c); + static void Setup(t_classid c); + static const t_symbol *sym__space; + FLEXT_CALLBACK_S(m_list) - FLEXT_CALLBACK_S(m_del) + FLEXT_CALLBACK_A(m_del) + FLEXT_ATTRVAR_S(delim) }; FLEXT_NEW_V("delsplit",delsplit) -V delsplit::Setup(t_classid c) +const t_symbol *delsplit::sym__space = NULL; + +void delsplit::Setup(t_classid c) { + sym__space = MakeSymbol(" "); + FLEXT_CADDMETHOD(c,0,m_list); FLEXT_CADDMETHOD(c,1,m_del); + FLEXT_CADDATTR_VAR1(c,"del",delim); } -delsplit::delsplit(I argc,const t_atom *argv): - delim(NULL) +delsplit::delsplit(int argc,const t_atom *argv): + delim(sym__) { AddInAnything("Symbol in, representing the delimited list"); - AddInSymbol("Set the Delimiter"); + AddInAnything("Set the Delimiter"); AddOutList("The split list"); - if(argc && IsSymbol(argv[0])) delim = GetSymbol(argv[0]); + m_del(sym_list,argc,argv); } -V delsplit::m_help() -{ - post("%s version " VERSION " (using flext " FLEXT_VERSTR "), (C) 2002 Thomas Grill",thisName()); -} /** \brief check whether string represents a number \ret 0..integer, 1..float, -1..no number */ -static I chknum(const C *s) +static int chknum(const char *s) { int num = 0,pts = 0; for(const char *si = s; *s; ++s) { @@ -98,49 +95,61 @@ static I chknum(const C *s) return (num > 0 && pts <= 1)?pts:-1; } -V delsplit::SetAtom(t_atom &l,const C *s) +void delsplit::m_del(const t_symbol *s,int argc,const t_atom *argv) +{ + delim = NULL; + if(s == sym_symbol) { + FLEXT_ASSERT(argc == 1 && IsSymbol(argv[0])); + delim = GetSymbol(argv[0]); + } + else if(s == sym_list) { + if(argc == 0) + delim = sym__space; + else if(argc >= 1 && IsSymbol(argv[0])) + delim = GetSymbol(argv[0]); + } + + if(!delim) { + post("%s - Argument must be a symbol, list or int/float/bang",thisName()); + delim = sym__space; + } +} + +void delsplit::SetAtom(t_atom &l,const char *s) { - I n = chknum(s); + int n = chknum(s); if(n < 0) SetString(l,s); else if(n == 0) SetInt(l,atoi(s)); else - SetFloat(l,(F)atof(s)); + SetFloat(l,(float)atof(s)); } -V delsplit::m_list(const t_symbol *sym) +void delsplit::m_list(const t_symbol *sym) { - if(delim) { - t_atom lst[256]; - int cnt = 0; - const C *sdel = GetString(delim); - I ldel = strlen(sdel); - C str[1024]; - strcpy(str,GetString(sym)); - - for(const char *s = str; *s; ) { - C *e = strstr(s,sdel); - if(!e) { - SetAtom(lst[cnt++],s); - break; - } - else { - *e = 0; - SetAtom(lst[cnt++],s); - s = e+ldel; - } + FLEXT_ASSERT(delim); + + t_atom lst[256]; + int cnt = 0; + const char *sdel = GetString(delim); + int ldel = strlen(sdel); + char str[1024]; + strcpy(str,GetString(sym)); + + for(const char *s = str; *s; ) { + char *e = strstr(s,sdel); + if(!e) { + SetAtom(lst[cnt++],s); + break; + } + else { + *e = 0; + SetAtom(lst[cnt++],s); + s = e+ldel; } - - ToOutList(0,cnt,lst); } - else - post("%s - No delimiter defined",thisName()); -} - -V delsplit::m_del(const t_symbol *s) -{ - delim = s; + + ToOutList(0,cnt,lst); } - diff --git a/externals/grill/delsplit/package.txt b/externals/grill/delsplit/package.txt new file mode 100644 index 00000000..ac8107ee --- /dev/null +++ b/externals/grill/delsplit/package.txt @@ -0,0 +1,2 @@ +NAME=delsplit
+SRCS=main.cpp
|