Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Working on batchlan refactor

  • Loading branch information...
commit 3d95ce928b2255142b2f821aa122a8c52efce2b8 1 parent a413b26
Sergei Pond spond authored
23 src/core/matrix.cpp
@@ -9146,8 +9146,6 @@ void _AssociativeList::Merge (_PMathObj p)
9146 9146 //SW20111207: I don't think we should ever have to worry about avl traversing
9147 9147 //here as long as the other methods are implemented properly
9148 9148
9149   - unsigned long num_items;
9150   - unsigned long i;
9151 9149
9152 9150 if(p==this){
9153 9151 return;
@@ -9155,16 +9153,21 @@ void _AssociativeList::Merge (_PMathObj p)
9155 9153
9156 9154 if (p && p->ObjectClass() == ASSOCIATIVE_LIST) {
9157 9155
9158   - _AssociativeList *rhs = (_AssociativeList*) p;
9159   - _List* p_keys = rhs->GetKeys();
  9156 + _AssociativeList *rhs = (_AssociativeList*) p;
  9157 +
  9158 + _SimpleList hist;
  9159 + long ls,
  9160 + cn = rhs->avl.Traverser (hist,ls,rhs->avl.GetRoot());
9160 9161
9161   - num_items = p_keys->Count();
9162 9162
9163   - for (i=0; i<num_items;i++) {
9164   - MStore(*(_String*)p_keys[0][i],rhs->GetByKey(*(_String*)p_keys[0][i]),false);
9165   - }
9166   -
9167   - delete p_keys;
  9163 +
  9164 + /* SLKP20120111: we need to skip over "blanks" (e.g. resulting from previous delete operations)
  9165 + here; using the traversal of the second list is the easiest way to go. */
  9166 +
  9167 + while (cn >= 0) {
  9168 + MStore(*(_String*)(*(_List*)rhs->avl.dataList)(cn),(_PMathObj)rhs->avl.GetXtra (cn),true);
  9169 + cn = avl.Traverser (hist,ls);
  9170 + }
9168 9171 }
9169 9172 else {
9170 9173 WarnError ("Associative list merge operation requires an associative list argument.");
5 src/core/parser2.cpp
@@ -1250,6 +1250,11 @@ long Parse (_Formula* f, _String& s, long& variableReference, _VariableCo
1250 1250 }
1251 1251 }
1252 1252 if (numeric.isAllowed [s.getChar(i)]) {
  1253 + if (twoToken) {
  1254 + _String thisOp (s.getChar(i-1));
  1255 + levelOps->AppendNewInstance (new _Operation (thisOp,1L));
  1256 + }
  1257 +
1253 1258 long j = 1;
1254 1259
1255 1260 while ( i+j<s.sLength && (numeric.isAllowed [s.getChar(i+j)] || ((s.getChar(i+j)=='-' || s.getChar(i+j)=='+' )&& tolower(s.getChar(i+j-1))=='e')) ) {
15 src/core/strings.cpp
@@ -1737,10 +1737,9 @@ void _String::ProcessParameter(void)
1737 1737
1738 1738 //_______________________________________________________________________
1739 1739
1740   -void _String::ProcessFileName (bool isWrite, bool acceptStringVars, Ptr theP)
  1740 +void _String::ProcessFileName (bool isWrite, bool acceptStringVars, Ptr theP, bool assume_platform_specific)
1741 1741 {
1742 1742 if (Equal(&getFString) || Equal (&tempFString)) { // prompt user for file
1743   -
1744 1743 if (Equal (&tempFString)) {
1745 1744 #if not defined __MINGW32__ && not defined __WINDOZE__
1746 1745 #ifdef __MAC__
@@ -1768,7 +1767,13 @@ void _String::ProcessFileName (bool isWrite, bool acceptStringVars, Ptr theP)
1768 1767 *this = WriteFileDialogInput ();
1769 1768 }
1770 1769 }
1771   - ProcessFileName(false,false,theP);
  1770 + ProcessFileName(false,false,theP,
  1771 + #if defined __MAC__ || defined __WINDOZE__
  1772 + true
  1773 + #else
  1774 + false
  1775 + #endif
  1776 + );
1772 1777 CheckReceptacleAndStore(&useLastFString,empty,false, new _FString (*this, false), false);
1773 1778 return;
1774 1779 }
@@ -1888,7 +1893,7 @@ void _String::ProcessFileName (bool isWrite, bool acceptStringVars, Ptr theP)
1888 1893 #endif
1889 1894
1890 1895 #ifdef __MAC__
1891   - if (Find('/')!=-1) { // UNIX PATH
  1896 + if (!assume_platform_specific && Find('/')!=-1) { // UNIX PATH
1892 1897 bool rootPath = false;
1893 1898 if (sData[0]=='/') {
1894 1899 rootPath = true;
@@ -1906,7 +1911,7 @@ void _String::ProcessFileName (bool isWrite, bool acceptStringVars, Ptr theP)
1906 1911 *this = _String(':')&*this;
1907 1912 }
1908 1913 } else {
1909   - if (Find('\\')!=-1) { // DOS PATH (ASSUME PARTIAL)
  1914 + if (!assume_platform_specific && Find('\\')!=-1) { // DOS PATH (ASSUME PARTIAL)
1910 1915 if (beginswith("..")) {
1911 1916 *this = _String('\\')&Cut(2,-1);
1912 1917 }

0 comments on commit 3d95ce9

Please sign in to comment.
Something went wrong with that request. Please try again.