[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] SF.net SVN: supercollider:[8247] trunk



Revision: 8247
          http://supercollider.svn.sourceforge.net/supercollider/?rev=8247&view=rev
Author:   danstowell
Date:     2008-12-22 21:35:03 +0000 (Mon, 22 Dec 2008)

Log Message:
-----------
Rearrange code slightly so as to avoid code-duplication and method-overwriting for windows.
Includes tweak to windows primitive for pathMatch.
Couple of other windowsy fixes.

Modified Paths:
--------------
    trunk/Source/lang/LangPrimSource/OSCData.cpp
    trunk/Source/lang/LangPrimSource/PyrStringPrim.cpp
    trunk/Source/server/SC_World.cpp
    trunk/build/SCClassLibrary/Common/Audio/SynthDef.sc
    trunk/build/SCClassLibrary/Common/Control/Score.sc
    trunk/build/SCClassLibrary/Common/Control/Server.sc
    trunk/build/SCClassLibrary/Platform/windows/extString.sc
    trunk/windows/TODO.txt
    trunk/windows/sc3-win-installer-template.wxs

Removed Paths:
-------------
    trunk/build/SCClassLibrary/Platform/windows/extScore.sc
    trunk/build/SCClassLibrary/Platform/windows/extServer.sc
    trunk/build/SCClassLibrary/Platform/windows/extSynthDef.sc

Modified: trunk/Source/lang/LangPrimSource/OSCData.cpp
===================================================================
--- trunk/Source/lang/LangPrimSource/OSCData.cpp	2008-12-22 21:15:00 UTC (rev 8246)
+++ trunk/Source/lang/LangPrimSource/OSCData.cpp	2008-12-22 21:35:03 UTC (rev 8247)
@@ -927,6 +927,13 @@
 	
 	return errNone;
 }
+#else   // is windows
+int prQuitInProcessServer(VMGlobals *g, int numArgsPushed);
+int prQuitInProcessServer(VMGlobals *g, int numArgsPushed)
+{
+	// no-op. Better to have this than to overwrite in lang.
+	return errNone;
+}
 #endif
 //#ifndef SC_WIN32
 
@@ -1029,8 +1036,8 @@
 	definePrimitive(base, index++, "_Exit", prExit, 1, 0);	
 #ifndef SC_WIN32
   definePrimitive(base, index++, "_BootInProcessServer", prBootInProcessServer, 1, 0);	
+#endif
 	definePrimitive(base, index++, "_QuitInProcessServer", prQuitInProcessServer, 1, 0);
-#endif
 	definePrimitive(base, index++, "_AllocSharedControls", prAllocSharedControls, 2, 0);	
 	definePrimitive(base, index++, "_SetSharedControl", prSetSharedControl, 3, 0);	
 	definePrimitive(base, index++, "_GetSharedControl", prGetSharedControl, 2, 0);	

Modified: trunk/Source/lang/LangPrimSource/PyrStringPrim.cpp
===================================================================
--- trunk/Source/lang/LangPrimSource/PyrStringPrim.cpp	2008-12-22 21:15:00 UTC (rev 8246)
+++ trunk/Source/lang/LangPrimSource/PyrStringPrim.cpp	2008-12-22 21:35:03 UTC (rev 8247)
@@ -335,8 +335,12 @@
     nbPaths = 0;
   }
 
-	if (hFind == INVALID_HANDLE_VALUE) 
+  if (hFind == INVALID_HANDLE_VALUE) {
+	// This is what happens when no matches. So we create an empty array to return.
+    PyrObject* array = newPyrArray(g->gc, 0, 0, true);
+	SetObject(a, array);
     return errNone;
+  }
     
   do {
     nbPaths++;
@@ -349,10 +353,11 @@
     nbPaths = 0;
   }
 
-	PyrObject* array = newPyrArray(g->gc, nbPaths , 0, true);
-	SetObject(a, array);
-	if (hFind == INVALID_HANDLE_VALUE) 
+  PyrObject* array = newPyrArray(g->gc, nbPaths , 0, true);
+  SetObject(a, array);
+  if (hFind == INVALID_HANDLE_VALUE) {
     return errNone;
+  }
     
   int i = 0;
   do {

Modified: trunk/Source/server/SC_World.cpp
===================================================================
--- trunk/Source/server/SC_World.cpp	2008-12-22 21:15:00 UTC (rev 8246)
+++ trunk/Source/server/SC_World.cpp	2008-12-22 21:35:03 UTC (rev 8247)
@@ -249,11 +249,7 @@
 	if(getenv("SC_SYNTHDEF_PATH")){
 		if(world->mVerbosity > 0)
 			printf("Loading synthdefs from path: %s\n", getenv("SC_SYNTHDEF_PATH"));
-#ifdef SC_WIN32
-		SC_StringParser sp(getenv("SC_SYNTHDEF_PATH"), ';');
-#else
-		SC_StringParser sp(getenv("SC_SYNTHDEF_PATH"), ':');
-#endif
+		SC_StringParser sp(getenv("SC_SYNTHDEF_PATH"), SC_STRPARSE_PATHDELIMITER);
 		while (!sp.AtEnd()) {
 			GraphDef *list = 0;
 			char *path = const_cast<char *>(sp.NextToken());

Modified: trunk/build/SCClassLibrary/Common/Audio/SynthDef.sc
===================================================================
--- trunk/build/SCClassLibrary/Common/Audio/SynthDef.sc	2008-12-22 21:15:00 UTC (rev 8246)
+++ trunk/build/SCClassLibrary/Common/Audio/SynthDef.sc	2008-12-22 21:35:03 UTC (rev 8247)
@@ -26,7 +26,11 @@
 	
 	*initClass {
 		synthDefDir = Platform.userAppSupportDir ++ "/synthdefs/";
-		("mkdir -p"+synthDefDir.quote).systemCmd; // Ensure exists
+                // Ensure exists:
+		("mkdir"
+			+ Platform.case(\windows, {""}, {"-p"}) // -p option doesn't exist on win
+			+ synthDefDir.quote
+		).systemCmd;
 	}
 	
 	*new { arg name, ugenGraphFunc, rates, prependArgs, variants, metadata;

Modified: trunk/build/SCClassLibrary/Common/Control/Score.sc
===================================================================
--- trunk/build/SCClassLibrary/Common/Control/Score.sc	2008-12-22 21:15:00 UTC (rev 8246)
+++ trunk/build/SCClassLibrary/Common/Control/Score.sc	2008-12-22 21:35:03 UTC (rev 8247)
@@ -3,7 +3,7 @@
 	classvar <>program, <>options;
 
 	*initClass {
-		program = "./scsynth";
+		program = Platform.case(\windows, {".\\scsynth.exe"}, {"./scsynth"});
 		options = ServerOptions.new;
 	}
 
@@ -97,13 +97,13 @@
 		};
 	}
 		
-	recordNRT { arg oscFilePath, outputFilePath, inputFilePath, sampleRate = 44100, headerFormat =
-		"AIFF", sampleFormat = "int16", options, completionString="", duration = nil;
-		this.writeOSCFile(oscFilePath, 0, duration);
-		unixCmd(program + " -N" + oscFilePath + (inputFilePath ? "_") + "\""++outputFilePath++"\""
-		 	+ sampleRate + headerFormat + sampleFormat +
-			(options ? Score.options).asOptionsString
-			+ completionString);
+	recordNRT { arg oscFilePath, outputFilePath, inputFilePath, sampleRate = 44100, headerFormat =
+		"AIFF", sampleFormat = "int16", options, completionString="", duration = nil;
+		this.writeOSCFile(oscFilePath, 0, duration);
+		unixCmd(program + " -N" + oscFilePath + (inputFilePath ? "_") + "\""++outputFilePath++"\""
+		 	+ sampleRate + headerFormat + sampleFormat +
+			(options ? Score.options).asOptionsString
+			+ completionString);
 	}
 	
 	*recordNRT { arg list, oscFilePath, outputFilePath, inputFilePath, sampleRate = 44100, 

Modified: trunk/build/SCClassLibrary/Common/Control/Server.sc
===================================================================
--- trunk/build/SCClassLibrary/Common/Control/Server.sc	2008-12-22 21:15:00 UTC (rev 8246)
+++ trunk/build/SCClassLibrary/Common/Control/Server.sc	2008-12-22 21:35:03 UTC (rev 8247)
@@ -260,9 +260,13 @@
 		Class.initClassTree(NotificationCenter);
 		named = IdentityDictionary.new;
 		set = Set.new;
-		internal = Server.new(\internal, NetAddr.new);
 		default = local = Server.new(\localhost, NetAddr("127.0.0.1", 57110));
-		program = "cd % && exec ./scsynth".format(String.scDir.quote);
+		Platform.switch(\windows, {
+			program = "scsynth.exe";
+		}, {
+			internal = Server.new(\internal, NetAddr.new);
+			program = "cd % && exec ./scsynth".format(String.scDir.quote);
+		});
 	}
 	
 	*fromName { arg name;

Deleted: trunk/build/SCClassLibrary/Platform/windows/extScore.sc
===================================================================
--- trunk/build/SCClassLibrary/Platform/windows/extScore.sc	2008-12-22 21:15:00 UTC (rev 8246)
+++ trunk/build/SCClassLibrary/Platform/windows/extScore.sc	2008-12-22 21:35:03 UTC (rev 8247)
@@ -1,6 +0,0 @@
-+ Score {
-
-	*initClass {
-		program = ".\\scsynth.exe";
-	}
-}
\ No newline at end of file

Deleted: trunk/build/SCClassLibrary/Platform/windows/extServer.sc
===================================================================
--- trunk/build/SCClassLibrary/Platform/windows/extServer.sc	2008-12-22 21:15:00 UTC (rev 8246)
+++ trunk/build/SCClassLibrary/Platform/windows/extServer.sc	2008-12-22 21:35:03 UTC (rev 8247)
@@ -1,14 +0,0 @@
-+ Server { 
-
-	// no internal server on windows
-	*initClass {
-		Class.initClassTree(ServerOptions);
-		Class.initClassTree(NotificationCenter);
-		named = IdentityDictionary.new;
-		set = Set.new;
-		default = local = Server.new(\localhost, NetAddr("127.0.0.1", 57110));
-		program = "scsynth.exe";
-	}
-
-	quitInProcess {}	// no internal server, this should be a no-op
-}

Modified: trunk/build/SCClassLibrary/Platform/windows/extString.sc
===================================================================
--- trunk/build/SCClassLibrary/Platform/windows/extString.sc	2008-12-22 21:15:00 UTC (rev 8246)
+++ trunk/build/SCClassLibrary/Platform/windows/extString.sc	2008-12-22 21:35:03 UTC (rev 8247)
@@ -26,19 +26,6 @@
 
 	}
 
-		// make pathmatch on win conform to unix behavior.
-
-	pathMatch { var res;
-
-		res = this.prPathMatch;
-
-		^if (res.isKindOf(String), [], res);
-
-	}
-
-
-
-	prPathMatch { _StringPathMatch ^this.primitiveFailed } // orig
-
 }
 
+   
\ No newline at end of file

Deleted: trunk/build/SCClassLibrary/Platform/windows/extSynthDef.sc
===================================================================
--- trunk/build/SCClassLibrary/Platform/windows/extSynthDef.sc	2008-12-22 21:15:00 UTC (rev 8246)
+++ trunk/build/SCClassLibrary/Platform/windows/extSynthDef.sc	2008-12-22 21:35:03 UTC (rev 8247)
@@ -1,10 +0,0 @@
-+ SynthDef {	
-
-    // This fixes the bug of a '-p' directory being created on windows.
-    // -p is a unix option to mkdir, it is not recognised by the windows mkdir program
-	*initClass {
-		synthDefDir = Platform.userAppSupportDir ++ "\\synthdefs\\";
-		("mkdir " + synthDefDir.quote).systemCmd; // Ensure exists
-	}
-    
-}
\ No newline at end of file

Modified: trunk/windows/TODO.txt
===================================================================
--- trunk/windows/TODO.txt	2008-12-22 21:15:00 UTC (rev 8246)
+++ trunk/windows/TODO.txt	2008-12-22 21:35:03 UTC (rev 8247)
@@ -6,18 +6,17 @@
 
 */
 
-
+--------------------------------------------------------------
+Fix system clock scheduling:
 
-Fix system clock scheduling:
+This is bad:
 
-
+r = Routine({ loop { "!@#$%".scramble.postln; 1.0.wait }
+}).play(SystemClock);  // cpu 100%
+r.stop; 
 
-This is bad:
-
-r = Routine({ loop { "!@#$%".scramble.postln; 1.0.wait }
-
-}).play(SystemClock);  // cpu 100%
-
-
-
-r.stop; 
\ No newline at end of file
+--------------------------------------------------------------
+Double-clicking an .sc or .scd file in Windows:
+Currently doesn't do what it should - it launches sc, 
+whereas instead it should launch sc only if needed and then it
+should cause sc to open the document in a new window.

Modified: trunk/windows/sc3-win-installer-template.wxs
===================================================================
--- trunk/windows/sc3-win-installer-template.wxs	2008-12-22 21:15:00 UTC (rev 8246)
+++ trunk/windows/sc3-win-installer-template.wxs	2008-12-22 21:35:03 UTC (rev 8247)
@@ -37,13 +37,13 @@
 <DirectoryRef Id="SC3INSTALLLOCATION">
 	
 	<Component Id="ProductComponent" Guid="CF69B856-C79D-11DD-84EF-AD7E56D89593">
-		<File Id="scsynthExecutable" Name="scsynth.exe"
-								Source="../build/scsynth.exe" DiskId="1">
-		</File>
 		<!-- Note: python scripts build Psycollider.exe but here we rename it to SuperCollider.exe -->
 		<File Id="sclangExecutable" Name="SuperCollider.exe"
 								Source="../Psycollider/Psycollider/dist/Psycollider.exe" DiskId="1">
 		</File>
+		<File Id="scsynthExecutable" Name="scsynth.exe"
+								Source="../build/scsynth.exe" DiskId="1">
+		</File>
 		<File Id="w9xpopen" Name="w9xpopen.exe"
 								Source="../Psycollider/Psycollider/dist/w9xpopen.exe" DiskId="1">
 		</File>
@@ -77,8 +77,6 @@
 					Value='[SC3INSTALLLOCATION]' />
 		<Environment Id='ScPluginPath'    Name='SC_PLUGIN_PATH'   Action='set' System='yes' Part='all'
 					Value='[SC3INSTALLLOCATION]plugins' />
-		<Environment Id='ScSynthdefPath' Name='SC_SYNTHDEF_PATH' Action='set' System='yes' Part='all'
-					Value='[SC3INSTALLLOCATION]synthdefs' />
 
 		
 		<!-- filetype associations -->
@@ -106,11 +104,13 @@
 	</Component>
 </DirectoryRef>
 
+<!-- NO, don't create this. The SC synthdefs folder should be user-specific - allow the lang to create it
 <DirectoryRef Id="SCsynthdefsFolder">
 	<Component Id="SCsynthdefs" Guid="3A2D01E8-C839-11DD-BDF4-3D6556D89593">
 		<CreateFolder/>
 	</Component>
 </DirectoryRef>
+-->
 
 <DirectoryRef Id="ApplicationProgramsFolder">
 	<Component Id="ApplicationShortcut" Guid="7511071E-C90B-11DD-BB90-C59D55D89593">
@@ -127,7 +127,7 @@
 <Feature Id="ProductFeature" Title="SuperCollider" Description="SuperCollider 3 for Windows (with Psycollider IDE)" Level="1">
 	<ComponentRef Id="ProductComponent" />
 	<ComponentRef Id="SCextensions" />
-	<ComponentRef Id="SCsynthdefs" />
+	<!-- RM <ComponentRef Id="SCsynthdefs" /> -->
 	<ComponentRef Id="ApplicationShortcut" />
 </Feature>
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

_______________________________________________
sc-dev mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/