|
From: <pst...@us...> - 2008-03-29 23:58:38
|
Revision: 353
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=353&view=rev
Author: pstieber
Date: 2008-03-29 16:58:36 -0700 (Sat, 29 Mar 2008)
Log Message:
-----------
Made cosmetic changes.
Modified Paths:
--------------
trunk/jazz/src/Configuration.cpp
Modified: trunk/jazz/src/Configuration.cpp
===================================================================
--- trunk/jazz/src/Configuration.cpp 2008-03-29 23:57:51 UTC (rev 352)
+++ trunk/jazz/src/Configuration.cpp 2008-03-29 23:58:36 UTC (rev 353)
@@ -649,12 +649,12 @@
{
// include file
wxString pathname = FindFile(StrValue(entry));
- cout << "include "<< entry<<endl;
+ cout << "include " << entry << endl;
IncLevel++;
assert(IncLevel < MaxIncs);
if (pathname)
{
- FdArr[IncLevel] = fopen(pathname,"r");
+ FdArr[IncLevel] = fopen(pathname, "r");
}
else
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-03-30 05:05:07
|
Revision: 358
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=358&view=rev
Author: pstieber
Date: 2008-03-29 22:05:05 -0700 (Sat, 29 Mar 2008)
Log Message:
-----------
Made a cosmetic change.
Modified Paths:
--------------
trunk/jazz/src/Configuration.cpp
Modified: trunk/jazz/src/Configuration.cpp
===================================================================
--- trunk/jazz/src/Configuration.cpp 2008-03-30 03:05:55 UTC (rev 357)
+++ trunk/jazz/src/Configuration.cpp 2008-03-30 05:05:05 UTC (rev 358)
@@ -341,7 +341,7 @@
wxString tConfig::File()
{
wxString FileName = FindFile("jazz.cfg");
- if(FileName.IsEmpty())
+ if (FileName.IsEmpty())
{
FileName = FindFile(".jazz");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-04-02 04:40:11
|
Revision: 386
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=386&view=rev
Author: pstieber
Date: 2008-04-01 21:40:09 -0700 (Tue, 01 Apr 2008)
Log Message:
-----------
Added some index checking.
Modified Paths:
--------------
trunk/jazz/src/Configuration.cpp
Modified: trunk/jazz/src/Configuration.cpp
===================================================================
--- trunk/jazz/src/Configuration.cpp 2008-04-02 04:31:05 UTC (rev 385)
+++ trunk/jazz/src/Configuration.cpp 2008-04-02 04:40:09 UTC (rev 386)
@@ -706,46 +706,65 @@
// Voice names
if (pVector == &mVoiceNames)
{
- assert(0 <= VoiceIndex && VoiceIndex < mVoiceNames.size());
+ if (VoiceIndex >= 0 && VoiceIndex < mVoiceNames.size())
+ {
+ int Value;
+ sscanf(buf, " %d %n", &Value, &j);
- long val;
- sscanf(buf, " %ld %n", &val, &j);
- if (gpConfig->GetValue(C_UseTwoCommandBankSelect))
- {
- assert(0 <= val && val <= 65536);
+ if (gpConfig->GetValue(C_UseTwoCommandBankSelect))
+ {
+ assert(0 <= Value && Value <= 65536);
+ }
+ else
+ {
+ assert(0 <= Value && Value <= 32639);
+ }
+
+ mVoiceNames[VoiceIndex + 1].second = Value + 1;
+
+ // Remove the off \n.
+ buf[strlen(buf) - 1] = 0;
+
+ mVoiceNames[VoiceIndex + 1].first = buf + j;
+
+ ++VoiceIndex;
}
else
{
- assert(0 <= val && val <= 32639);
+ cout
+ << "Voice index \"" << VoiceIndex << "\" out of range."
+ << endl;
}
- mVoiceNames[VoiceIndex + 1].second = val + 1;
-
- buf[strlen(buf) - 1] = 0; // cut off \n
- mVoiceNames[VoiceIndex + 1].first = buf + j;
-
- ++VoiceIndex;
}
// Drumset names
else if (pVector == &mDrumSets)
{
- long val;
- assert(0 <= DrumsetIndex && DrumsetIndex < 129);
- sscanf(buf, " %ld %n", &val, &j);
- if (gpConfig->GetValue(C_UseTwoCommandBankSelect))
+ if (DrumsetIndex >= 0 && DrumsetIndex < 129)
{
- assert(0 <= val && val <= 65536);
+ int Value;
+ sscanf(buf, " %d %n", &Value, &j);
+ if (gpConfig->GetValue(C_UseTwoCommandBankSelect))
+ {
+ assert(0 <= Value && Value <= 65536);
+ }
+ else
+ {
+ assert(0 <= Value && Value <= 32639);
+ }
+ mDrumSets[DrumsetIndex + 1].second = Value + 1;
+
+ buf[strlen(buf) - 1] = 0; // cut off \n
+ mDrumSets[DrumsetIndex + 1].first = buf + j;
+
+ ++DrumsetIndex;
}
else
{
- assert(0 <= val && val <= 32639);
+ cout
+ << "Drumset index \"" << DrumsetIndex << "\" out of range."
+ << endl;
}
- mDrumSets[DrumsetIndex + 1].second = val + 1;
-
- buf[strlen(buf) - 1] = 0; // cut off \n
- mDrumSets[DrumsetIndex + 1].first = buf + j;
-
- ++DrumsetIndex;
}
// Controller names.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-04-06 01:46:35
|
Revision: 403
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=403&view=rev
Author: pstieber
Date: 2008-04-05 18:46:32 -0700 (Sat, 05 Apr 2008)
Log Message:
-----------
Made cosmetic changes.
Modified Paths:
--------------
trunk/jazz/src/Configuration.cpp
Modified: trunk/jazz/src/Configuration.cpp
===================================================================
--- trunk/jazz/src/Configuration.cpp 2008-04-06 00:15:00 UTC (rev 402)
+++ trunk/jazz/src/Configuration.cpp 2008-04-06 01:46:32 UTC (rev 403)
@@ -174,28 +174,28 @@
Names[C_BankControlNumber] = new tConfigEntry(".bank_control_number", 0);
// Controller2 for bank select with two commands
- Names[C_BankControlNumber2] = new tConfigEntry(".bank_2nd_control_number",32);
+ Names[C_BankControlNumber2] = new tConfigEntry(".bank_2nd_control_number", 32);
// Max number of entries in bank table (two commands)
- Names[C_MaxBankTableEntries] = new tConfigEntry(".max_bank_table_entries",256);
+ Names[C_MaxBankTableEntries] = new tConfigEntry(".max_bank_table_entries", 256);
// Number of columns to draw in Parts dialogs
- Names[C_PartsColumnsMax] = new tConfigEntry(".parts_columns_max",4);
+ Names[C_PartsColumnsMax] = new tConfigEntry(".parts_columns_max", 4);
// Draw tracknames on the right too?
- Names[C_PartsTracknamesRight] = new tConfigEntry(".parts_tracknames_right",1);
+ Names[C_PartsTracknamesRight] = new tConfigEntry(".parts_tracknames_right", 1);
// Maximum number of voice names in .jazz
- Names[C_MaxVoiceNames] = new tConfigEntry(".max_voice_names",317);
+ Names[C_MaxVoiceNames] = new tConfigEntry(".max_voice_names", 317);
// Use two-command bank select?
Names[C_UseTwoCommandBankSelect] = new tConfigEntry(".use_two_command_bank_select", 0);
// Metronome settings
- Names[C_MetroIsAccented] = new tConfigEntry(".metronome_is_accented",1);
- Names[C_MetroVelocity] = new tConfigEntry(".metronome_velocity",127);
- Names[C_MetroNormalClick] = new tConfigEntry(".metronome_normal_click",37);
- Names[C_MetroAccentedClick] = new tConfigEntry(".metronome_accented_click",36);
+ Names[C_MetroIsAccented] = new tConfigEntry(".metronome_is_accented", 1);
+ Names[C_MetroVelocity] = new tConfigEntry(".metronome_velocity", 127);
+ Names[C_MetroNormalClick] = new tConfigEntry(".metronome_normal_click", 37);
+ Names[C_MetroAccentedClick] = new tConfigEntry(".metronome_accented_click", 36);
// Window geometry settings.
Names[C_TrackWinXpos] = new tConfigEntry(".trackwin_xpos", 10);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-04-06 22:47:06
|
Revision: 426
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=426&view=rev
Author: pstieber
Date: 2008-04-06 15:47:03 -0700 (Sun, 06 Apr 2008)
Log Message:
-----------
Made some cosmetic indentation changes.
Modified Paths:
--------------
trunk/jazz/src/Configuration.cpp
Modified: trunk/jazz/src/Configuration.cpp
===================================================================
--- trunk/jazz/src/Configuration.cpp 2008-04-06 22:08:58 UTC (rev 425)
+++ trunk/jazz/src/Configuration.cpp 2008-04-06 22:47:03 UTC (rev 426)
@@ -183,19 +183,25 @@
Names[C_PartsColumnsMax] = new tConfigEntry(".parts_columns_max", 4);
// Draw tracknames on the right too?
- Names[C_PartsTracknamesRight] = new tConfigEntry(".parts_tracknames_right", 1);
+ Names[C_PartsTracknamesRight] = new tConfigEntry(
+ ".parts_tracknames_right",
+ 1);
// Maximum number of voice names in .jazz
Names[C_MaxVoiceNames] = new tConfigEntry(".max_voice_names", 317);
// Use two-command bank select?
- Names[C_UseTwoCommandBankSelect] = new tConfigEntry(".use_two_command_bank_select", 0);
+ Names[C_UseTwoCommandBankSelect] = new tConfigEntry(
+ ".use_two_command_bank_select",
+ 0);
// Metronome settings
Names[C_MetroIsAccented] = new tConfigEntry(".metronome_is_accented", 1);
Names[C_MetroVelocity] = new tConfigEntry(".metronome_velocity", 127);
Names[C_MetroNormalClick] = new tConfigEntry(".metronome_normal_click", 37);
- Names[C_MetroAccentedClick] = new tConfigEntry(".metronome_accented_click", 36);
+ Names[C_MetroAccentedClick] = new tConfigEntry(
+ ".metronome_accented_click",
+ 36);
// Window geometry settings.
Names[C_TrackWinXpos] = new tConfigEntry(".trackwin_xpos", 10);
@@ -232,7 +238,7 @@
Names[C_SendSynthReset] = new tConfigEntry(".send_synth_reset", 1);
// Current include file
- Names[C_Include] = new tConfigEntry(".include","");
+ Names[C_Include] = new tConfigEntry(".include", "");
// Entries with empty values
Names[C_BankTable] = new tConfigEntry(".bank_table");
@@ -249,8 +255,8 @@
Names[C_ThruInput] = new tConfigEntry(".thru_input", 0);
Names[C_ThruOutput] = new tConfigEntry(".thru_output", 0);
- //enable/disable welcome
- Names[C_EnableWelcome] = new tConfigEntry(".enable_welcome",1);
+ // Enable/disable splash dialog.
+ Names[C_EnableWelcome] = new tConfigEntry(".enable_welcome", 1);
// Other initialization
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-04-11 14:04:50
|
Revision: 454
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=454&view=rev
Author: pstieber
Date: 2008-04-11 07:04:39 -0700 (Fri, 11 Apr 2008)
Log Message:
-----------
1. Changed to use an std::stack so that an arbitrary number of include files could be
handled.
2. Changed some warning messages.
3. Made come comment changes.
Modified Paths:
--------------
trunk/jazz/src/Configuration.cpp
Modified: trunk/jazz/src/Configuration.cpp
===================================================================
--- trunk/jazz/src/Configuration.cpp 2008-04-11 02:49:02 UTC (rev 453)
+++ trunk/jazz/src/Configuration.cpp 2008-04-11 14:04:39 UTC (rev 454)
@@ -29,6 +29,7 @@
#include "FindFile.h"
#include "Globals.h"
+#include <stack>
#include <iostream>
#include <sstream>
@@ -676,6 +677,8 @@
mFileName = FileName;
+ // Get the current working directory so the code can return to this
+ // directory when it is done reading the configuration file.
wxString OriginalCurrentWorkingDirectory = ::wxGetCwd();
wxFileName FileNameObject(mFileName);
@@ -689,50 +692,46 @@
vector<pair<string, int> >* pVector = 0;
- const int MaxIncs = 10;
+ stack<FILE*> FileDescriptors;
- FILE *FdArr[MaxIncs];
- int IncLevel = 0;
-
- for (i = 0; i < MaxIncs; ++i)
- {
- FdArr[i] = NULL;
- }
-
cout
<< "JZConfiguration::LoadConfig:" << '\n'
<< " \"" << mFileName << '"'
<< endl;
- FdArr[IncLevel] = fopen(mFileName.c_str(), "r");
- if (FdArr[IncLevel] == NULL)
+ FileDescriptors.push(fopen(mFileName.c_str(), "r"));
+ if (FileDescriptors.top() == NULL)
{
- wxMessageBox(
- "Error reading config file.\n"
- "Please check permissions and set the environment variable\n"
- "JAZZ to the installation directory",
- "Warning",
- wxOK);
+ wxString String;
+ String
+ << "Error reading config file..." << '\n'
+ << '"' << mFileName << '"' << '\n'
+ << "Please check permissions and set the environment variable" << '\n'
+ << "JAZZ to the installation directory";
+ ::wxMessageBox(String, "Warning", wxOK);
+
+ // Return to the original working directory.
::wxSetWorkingDirectory(OriginalCurrentWorkingDirectory);
+
return;
}
while (1)
{
- // Read a line from the current file
- if (fgets(buf, sizeof(buf), FdArr[IncLevel]) == NULL)
+ // Read a line from the current file.
+ if (fgets(buf, sizeof(buf), FileDescriptors.top()) == NULL)
{
- fclose(FdArr[IncLevel]);
- FdArr[IncLevel] = NULL;
- --IncLevel;
- if (IncLevel < 0)
+ fclose(FileDescriptors.top());
+ FileDescriptors.pop();
+ if (FileDescriptors.empty())
{
- // Last line of jazz.cfg (.jazz)
+ // The code has reached the last line of the Jazz++ configuration file
+ // (jazz.cfg or .jazz).
break;
}
else
{
- // Last line of current include-file
+ // The code has reached the last line of current include-file.
continue;
}
}
@@ -789,24 +788,23 @@
// include file
wxString pathname = FindFile(GetStrValue(entry));
cout << "include " << entry << endl;
- IncLevel++;
- assert(IncLevel < MaxIncs);
if (pathname)
{
- FdArr[IncLevel] = fopen(pathname, "r");
+ FileDescriptors.push(fopen(pathname, "r"));
}
else
{
- FdArr[IncLevel] = NULL;
+ FileDescriptors.push(NULL);
}
- if (FdArr[IncLevel] == NULL)
+ if (FileDescriptors.top() == NULL)
{
wxString String;
String
- << "Could not open config include file \"" << buf << "\"";
- wxMessageBox(String, "Warning", wxOK);
- --IncLevel;
+ << "Could not open configuration include file:" << '\n'
+ << '"' << buf << '"';
+ ::wxMessageBox(String, "Warning", wxOK);
+ FileDescriptors.pop();
}
}
break;
@@ -838,7 +836,7 @@
mVoiceNames[VoiceIndex + 1].second = Value + 1;
- // Remove the off \n.
+ // Remove the \n.
buf[strlen(buf) - 1] = 0;
mVoiceNames[VoiceIndex + 1].first = buf + j;
@@ -870,7 +868,9 @@
}
mDrumSets[DrumsetIndex + 1].second = Value + 1;
- buf[strlen(buf) - 1] = 0; // cut off \n
+ // Remove the \n.
+ buf[strlen(buf) - 1] = 0;
+
mDrumSets[DrumsetIndex + 1].first = buf + j;
++DrumsetIndex;
@@ -888,8 +888,10 @@
{
sscanf(buf, " %d %n", &i, &j);
assert(0 <= i && i <= 127);
- buf[strlen(buf) - 1] = 0; // cut off \n
+ // Remove the \n.
+ buf[strlen(buf) - 1] = 0;
+
mCtrlNames[i + 1].first = buf + j;
}
@@ -898,17 +900,19 @@
{
sscanf(buf, " %d %n", &i, &j);
assert(0 <= i && i <= 127);
- buf[strlen(buf) - 1] = 0; // cut off \n
+ // Remove the \n.
+ buf[strlen(buf) - 1] = 0;
+
mDrumNames[i + 1].first = buf + j;
}
else
{
wxString String;
String
- << "LoadConfig: error reading line" << "\n"
- << buf;
- wxMessageBox(String, "Warning", wxOK);
+ << "LoadConfig: error reading line" << '\n'
+ << '"' << buf << '"';
+ ::wxMessageBox(String, "Warning", wxOK);
}
}
@@ -929,5 +933,6 @@
}
}
+ // Return to the original working directory.
::wxSetWorkingDirectory(OriginalCurrentWorkingDirectory);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-06-12 22:48:50
|
Revision: 600
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=600&view=rev
Author: pstieber
Date: 2008-06-12 15:48:43 -0700 (Thu, 12 Jun 2008)
Log Message:
-----------
Added .c_str() to a GetName call.
Modified Paths:
--------------
trunk/jazz/src/Configuration.cpp
Modified: trunk/jazz/src/Configuration.cpp
===================================================================
--- trunk/jazz/src/Configuration.cpp 2008-06-12 20:16:54 UTC (rev 599)
+++ trunk/jazz/src/Configuration.cpp 2008-06-12 22:48:43 UTC (rev 600)
@@ -476,7 +476,7 @@
int result = 1;
if (mNames[entry]->GetType() == eConfigEntryTypeInt)
{
- sprintf(format, "%s %%d", mNames[entry]->GetName());
+ sprintf(format, "%s %%d", mNames[entry]->GetName().c_str());
int Value;
result = sscanf(buf, format, &Value);
mNames[entry]->SetValue(Value);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|