зеркало из https://github.com/mozilla/gecko-dev.git
replace tabs with (Mork canonical) two spaces
This commit is contained in:
Родитель
0b93c37f4f
Коммит
8392ec5504
|
@ -190,25 +190,25 @@ morkEnv::OidAsHex(void* outBuf, const mdbOid& inOid)
|
|||
mork_u1
|
||||
morkEnv::HexToByte(mork_ch inFirstHex, mork_ch inSecondHex)
|
||||
{
|
||||
mork_u1 hi = 0; // high four hex bits
|
||||
mork_flags f = morkCh_GetFlags(inFirstHex);
|
||||
if ( morkFlags_IsDigit(f) )
|
||||
hi = inFirstHex - '0';
|
||||
else if ( morkFlags_IsUpper(f) )
|
||||
hi = (inFirstHex - 'A') + 10;
|
||||
else if ( morkFlags_IsLower(f) )
|
||||
hi = (inFirstHex - 'a') + 10;
|
||||
|
||||
mork_u1 lo = 0; // low four hex bits
|
||||
f = morkCh_GetFlags(inSecondHex);
|
||||
if ( morkFlags_IsDigit(f) )
|
||||
lo = inSecondHex - '0';
|
||||
else if ( morkFlags_IsUpper(f) )
|
||||
lo = (inSecondHex - 'A') + 10;
|
||||
else if ( morkFlags_IsLower(f) )
|
||||
lo = (inSecondHex - 'a') + 10;
|
||||
|
||||
return (mork_u1) ((hi << 4) | lo);
|
||||
mork_u1 hi = 0; // high four hex bits
|
||||
mork_flags f = morkCh_GetFlags(inFirstHex);
|
||||
if ( morkFlags_IsDigit(f) )
|
||||
hi = inFirstHex - '0';
|
||||
else if ( morkFlags_IsUpper(f) )
|
||||
hi = (inFirstHex - 'A') + 10;
|
||||
else if ( morkFlags_IsLower(f) )
|
||||
hi = (inFirstHex - 'a') + 10;
|
||||
|
||||
mork_u1 lo = 0; // low four hex bits
|
||||
f = morkCh_GetFlags(inSecondHex);
|
||||
if ( morkFlags_IsDigit(f) )
|
||||
lo = inSecondHex - '0';
|
||||
else if ( morkFlags_IsUpper(f) )
|
||||
lo = (inSecondHex - 'A') + 10;
|
||||
else if ( morkFlags_IsLower(f) )
|
||||
lo = (inSecondHex - 'a') + 10;
|
||||
|
||||
return (mork_u1) ((hi << 4) | lo);
|
||||
}
|
||||
|
||||
mork_size
|
||||
|
|
|
@ -825,27 +825,27 @@ morkBuf* morkParser::ReadValue(morkEnv* ev)
|
|||
{
|
||||
if ( c == '\\' ) // "\" escapes the next char?
|
||||
{
|
||||
if ( (c = s->Getc(ev)) == 0xA || c == 0xD ) // linebreak after \?
|
||||
c = this->eat_line_break(ev, c);
|
||||
if ( (c = s->Getc(ev)) == 0xA || c == 0xD ) // linebreak after \?
|
||||
c = this->eat_line_break(ev, c);
|
||||
|
||||
if ( c == EOF || ev->Bad() )
|
||||
break; // end while loop
|
||||
}
|
||||
else if ( c == '$' ) // "$" escapes next two hex digits?
|
||||
{
|
||||
if ( (c = s->Getc(ev)) != EOF && ev->Good() )
|
||||
{
|
||||
mork_ch first = (mork_ch) c; // first hex digit
|
||||
if ( (c = s->Getc(ev)) != EOF && ev->Good() )
|
||||
{
|
||||
mork_ch second = (mork_ch) c; // second hex digit
|
||||
c = ev->HexToByte(first, second);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
else
|
||||
break;
|
||||
if ( (c = s->Getc(ev)) != EOF && ev->Good() )
|
||||
{
|
||||
mork_ch first = (mork_ch) c; // first hex digit
|
||||
if ( (c = s->Getc(ev)) != EOF && ev->Good() )
|
||||
{
|
||||
mork_ch second = (mork_ch) c; // second hex digit
|
||||
c = ev->HexToByte(first, second);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
spool->Putc(ev, c);
|
||||
}
|
||||
|
|
|
@ -210,7 +210,7 @@ morkPortTableCursor::init_space_tables_map(morkEnv* ev)
|
|||
morkRowSpace* space = mPortTableCursor_RowSpace;
|
||||
if ( space && ev->Good() )
|
||||
{
|
||||
morkTableMapIter* ti = &mPortTableCursor_TableIter;
|
||||
morkTableMapIter* ti = &mPortTableCursor_TableIter;
|
||||
ti->InitTableMapIter(ev, &space->mRowSpace_Tables);
|
||||
if ( ev->Good() )
|
||||
mPortTableCursor_TablesDidEnd = morkBool_kFalse;
|
||||
|
|
|
@ -367,12 +367,12 @@ morkWriter::WriteYarn(morkEnv* ev, const mdbYarn* inYarn)
|
|||
const mork_u1* end = b + fill;
|
||||
while ( b < end && ev->Good() )
|
||||
{
|
||||
if ( lineSize + outSize >= mWriter_MaxLine ) // continue line?
|
||||
{
|
||||
if ( lineSize + outSize >= mWriter_MaxLine ) // continue line?
|
||||
{
|
||||
stream->PutByteThenNewline(ev, '\\');
|
||||
mWriter_LineSize = lineSize = outSize = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
c = *b++; // next byte to print
|
||||
if ( morkCh_IsValue(c) )
|
||||
{
|
||||
|
@ -1049,24 +1049,24 @@ morkWriter::WriteTokenToTokenMetaCell(morkEnv* ev,
|
|||
mWriter_LineSize += stream->Write(ev, buf, colSize + 3);
|
||||
}
|
||||
|
||||
if ( isKindCol )
|
||||
{
|
||||
p = buf;
|
||||
if ( isKindCol )
|
||||
{
|
||||
p = buf;
|
||||
mork_size valSize = ev->TokenAsHex(p, inValue);
|
||||
p += valSize;
|
||||
*p++ = ')';
|
||||
mWriter_LineSize += stream->Write(ev, buf, valSize + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->IndentAsNeeded(ev, morkWriter_kTableMetaCellValueDepth);
|
||||
mdbYarn* yarn = &mWriter_ColYarn;
|
||||
// mork_u1* yarnBuf = (mork_u1*) yarn->mYarn_Buf;
|
||||
mWriter_Store->TokenToString(ev, inValue, yarn);
|
||||
this->WriteYarn(ev, yarn);
|
||||
stream->Putc(ev, ')');
|
||||
++mWriter_LineSize;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this->IndentAsNeeded(ev, morkWriter_kTableMetaCellValueDepth);
|
||||
mdbYarn* yarn = &mWriter_ColYarn;
|
||||
// mork_u1* yarnBuf = (mork_u1*) yarn->mYarn_Buf;
|
||||
mWriter_Store->TokenToString(ev, inValue, yarn);
|
||||
this->WriteYarn(ev, yarn);
|
||||
stream->Putc(ev, ')');
|
||||
++mWriter_LineSize;
|
||||
}
|
||||
|
||||
// mork_fill fill = yarn->mYarn_Fill;
|
||||
// yarnBuf[ fill ] = ')'; // append terminator
|
||||
|
@ -1218,7 +1218,7 @@ morkWriter::StartTable(morkEnv* ev, morkTable* ioTable)
|
|||
{
|
||||
if ( r->IsRow() )
|
||||
{
|
||||
mWriter_SuppressDirtyRowNewline = morkBool_kTrue;
|
||||
mWriter_SuppressDirtyRowNewline = morkBool_kTrue;
|
||||
this->PutRow(ev, r);
|
||||
}
|
||||
else
|
||||
|
@ -1230,8 +1230,8 @@ morkWriter::StartTable(morkEnv* ev, morkTable* ioTable)
|
|||
|
||||
if ( mWriter_LineSize < mWriter_MaxIndent )
|
||||
{
|
||||
stream->Putc(ev, ' '); // nice white space
|
||||
++mWriter_LineSize;
|
||||
stream->Putc(ev, ' '); // nice white space
|
||||
++mWriter_LineSize;
|
||||
}
|
||||
|
||||
// mWriter_LineSize = stream->PutIndent(ev, morkWriter_kRowDepth);
|
||||
|
@ -1253,7 +1253,7 @@ morkWriter::PutRowDict(morkEnv* ev, morkRow* ioRow)
|
|||
if ( cells )
|
||||
{
|
||||
morkStream* stream = mWriter_Stream;
|
||||
mdbYarn yarn; // to ref content inside atom
|
||||
mdbYarn yarn; // to ref content inside atom
|
||||
char buf[ 64 ]; // buffer for staging the dict alias hex ID
|
||||
char* idBuf = buf + 1; // where the id always starts
|
||||
buf[ 0 ] = '('; // we always start with open paren
|
||||
|
@ -1267,12 +1267,12 @@ morkWriter::PutRowDict(morkEnv* ev, morkRow* ioRow)
|
|||
{
|
||||
if ( atom->IsBook() ) // is it possible to write atom ID?
|
||||
{
|
||||
if ( !this->DidStartDict() )
|
||||
{
|
||||
this->StartDict(ev);
|
||||
if ( ev->Bad() )
|
||||
break;
|
||||
}
|
||||
if ( !this->DidStartDict() )
|
||||
{
|
||||
this->StartDict(ev);
|
||||
if ( ev->Bad() )
|
||||
break;
|
||||
}
|
||||
atom->mAtom_Change = morkChange_kNil; // neutralize change
|
||||
|
||||
this->IndentAsNeeded(ev, morkWriter_kDictAliasDepth);
|
||||
|
@ -1280,25 +1280,25 @@ morkWriter::PutRowDict(morkEnv* ev, morkRow* ioRow)
|
|||
mork_size size = ev->TokenAsHex(idBuf, ba->mBookAtom_Id);
|
||||
mWriter_LineSize += stream->Write(ev, buf, size+1); // '('
|
||||
|
||||
if ( atom->AliasYarn(&yarn) )
|
||||
{
|
||||
if ( mWriter_DidStartDict && yarn.mYarn_Form != mWriter_DictForm )
|
||||
this->ChangeDictForm(ev, yarn.mYarn_Form);
|
||||
if ( atom->AliasYarn(&yarn) )
|
||||
{
|
||||
if ( mWriter_DidStartDict && yarn.mYarn_Form != mWriter_DictForm )
|
||||
this->ChangeDictForm(ev, yarn.mYarn_Form);
|
||||
|
||||
mork_size pending = yarn.mYarn_Fill + morkWriter_kYarnEscapeSlop + 1;
|
||||
this->IndentOverMaxLine(ev, pending, morkWriter_kDictAliasValueDepth);
|
||||
|
||||
stream->Putc(ev, '='); // start value
|
||||
++mWriter_LineSize;
|
||||
mork_size pending = yarn.mYarn_Fill + morkWriter_kYarnEscapeSlop + 1;
|
||||
this->IndentOverMaxLine(ev, pending, morkWriter_kDictAliasValueDepth);
|
||||
|
||||
stream->Putc(ev, '='); // start value
|
||||
++mWriter_LineSize;
|
||||
|
||||
this->WriteYarn(ev, &yarn);
|
||||
this->WriteYarn(ev, &yarn);
|
||||
|
||||
stream->Putc(ev, ')'); // end value
|
||||
++mWriter_LineSize;
|
||||
}
|
||||
else
|
||||
atom->BadAtomKindError(ev);
|
||||
|
||||
stream->Putc(ev, ')'); // end value
|
||||
++mWriter_LineSize;
|
||||
}
|
||||
else
|
||||
atom->BadAtomKindError(ev);
|
||||
|
||||
++mWriter_DoneCount;
|
||||
}
|
||||
}
|
||||
|
@ -1425,10 +1425,10 @@ morkWriter::PutRow(morkEnv* ev, morkRow* ioRow)
|
|||
|
||||
if ( ioRow->IsRowDirty() )
|
||||
{
|
||||
if ( mWriter_SuppressDirtyRowNewline )
|
||||
mWriter_SuppressDirtyRowNewline = morkBool_kFalse;
|
||||
else
|
||||
mWriter_LineSize = stream->PutIndent(ev, morkWriter_kRowDepth);
|
||||
if ( mWriter_SuppressDirtyRowNewline )
|
||||
mWriter_SuppressDirtyRowNewline = morkBool_kFalse;
|
||||
else
|
||||
mWriter_LineSize = stream->PutIndent(ev, morkWriter_kRowDepth);
|
||||
|
||||
ioRow->SetRowClean();
|
||||
mork_rid rid = roid->mOid_Id;
|
||||
|
|
|
@ -253,7 +253,7 @@ orkinRowCellCursor::GetCount(nsIMdbEnv* mev, mdb_count* outCount)
|
|||
outErr = ev->AsErr();
|
||||
}
|
||||
if ( outCount )
|
||||
*outCount = count;
|
||||
*outCount = count;
|
||||
return outErr;
|
||||
}
|
||||
|
||||
|
@ -271,7 +271,7 @@ orkinRowCellCursor::GetSeed(nsIMdbEnv* mev, mdb_seed* outSeed)
|
|||
outErr = ev->AsErr();
|
||||
}
|
||||
if ( outSeed )
|
||||
*outSeed = seed;
|
||||
*outSeed = seed;
|
||||
return outErr;
|
||||
}
|
||||
|
||||
|
@ -306,7 +306,7 @@ orkinRowCellCursor::GetPos(nsIMdbEnv* mev, mdb_pos* outPos)
|
|||
outErr = ev->AsErr();
|
||||
}
|
||||
if ( outPos )
|
||||
*outPos = pos;
|
||||
*outPos = pos;
|
||||
return outErr;
|
||||
}
|
||||
|
||||
|
@ -341,7 +341,7 @@ orkinRowCellCursor::GetDoFailOnSeedOutOfSync(nsIMdbEnv* mev, mdb_bool* outFail)
|
|||
outErr = ev->AsErr();
|
||||
}
|
||||
if ( outFail )
|
||||
*outFail = doFail;
|
||||
*outFail = doFail;
|
||||
return outErr;
|
||||
}
|
||||
// } ----- end attribute methods -----
|
||||
|
@ -365,21 +365,21 @@ orkinRowCellCursor::SetRow(nsIMdbEnv* mev, nsIMdbRow* ioRow)
|
|||
orkinRow* orow = (orkinRow*) ioRow;
|
||||
if ( orow->CanUseRow(mev, /*inMutable*/ morkBool_kFalse, &outErr, &row) )
|
||||
{
|
||||
morkStore* store = row->GetRowSpaceStore(ev);
|
||||
if ( store )
|
||||
{
|
||||
morkRowObject* rowObj = row->AcquireRowObject(ev, store);
|
||||
if ( rowObj )
|
||||
{
|
||||
morkRowObject::SlotStrongRowObject((morkRowObject*) 0, ev,
|
||||
&cursor->mRowCellCursor_RowObject);
|
||||
|
||||
cursor->mRowCellCursor_RowObject = rowObj; // take this strong ref
|
||||
cursor->mCursor_Seed = row->mRow_Seed;
|
||||
|
||||
row->GetCell(ev, cursor->mRowCellCursor_Col, &cursor->mCursor_Pos);
|
||||
}
|
||||
}
|
||||
morkStore* store = row->GetRowSpaceStore(ev);
|
||||
if ( store )
|
||||
{
|
||||
morkRowObject* rowObj = row->AcquireRowObject(ev, store);
|
||||
if ( rowObj )
|
||||
{
|
||||
morkRowObject::SlotStrongRowObject((morkRowObject*) 0, ev,
|
||||
&cursor->mRowCellCursor_RowObject);
|
||||
|
||||
cursor->mRowCellCursor_RowObject = rowObj; // take this strong ref
|
||||
cursor->mCursor_Seed = row->mRow_Seed;
|
||||
|
||||
row->GetCell(ev, cursor->mRowCellCursor_Col, &cursor->mCursor_Pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
outErr = ev->AsErr();
|
||||
}
|
||||
|
@ -399,12 +399,12 @@ orkinRowCellCursor::GetRow(nsIMdbEnv* mev, nsIMdbRow** acqRow)
|
|||
morkRowCellCursor* cursor = (morkRowCellCursor*) mHandle_Object;
|
||||
morkRowObject* rowObj = cursor->mRowCellCursor_RowObject;
|
||||
if ( rowObj )
|
||||
outRow = rowObj->AcquireRowHandle(ev);
|
||||
outRow = rowObj->AcquireRowHandle(ev);
|
||||
|
||||
outErr = ev->AsErr();
|
||||
}
|
||||
if ( acqRow )
|
||||
*acqRow = outRow;
|
||||
*acqRow = outRow;
|
||||
return outErr;
|
||||
}
|
||||
// } ----- end attribute methods -----
|
||||
|
@ -431,18 +431,18 @@ orkinRowCellCursor::MakeCell( // get cell at current pos in the row
|
|||
morkCell* cell = row->CellAt(ev, pos);
|
||||
if ( cell )
|
||||
{
|
||||
col = cell->GetColumn();
|
||||
outCell = row->AcquireCellHandle(ev, cell, col, pos);
|
||||
col = cell->GetColumn();
|
||||
outCell = row->AcquireCellHandle(ev, cell, col, pos);
|
||||
}
|
||||
outErr = ev->AsErr();
|
||||
}
|
||||
if ( acqCell )
|
||||
*acqCell = outCell;
|
||||
if ( outPos )
|
||||
*outPos = pos;
|
||||
if ( outColumn )
|
||||
*outColumn = col;
|
||||
|
||||
*acqCell = outCell;
|
||||
if ( outPos )
|
||||
*outPos = pos;
|
||||
if ( outColumn )
|
||||
*outColumn = col;
|
||||
|
||||
return outErr;
|
||||
}
|
||||
// } ----- end cell creation methods -----
|
||||
|
@ -467,7 +467,7 @@ orkinRowCellCursor::SeekCell( // same as SetRow() followed by MakeCell()
|
|||
outErr = ev->AsErr();
|
||||
}
|
||||
if ( acqCell )
|
||||
*acqCell = outCell;
|
||||
*acqCell = outCell;
|
||||
return outErr;
|
||||
}
|
||||
// } ----- end cell seeking methods -----
|
||||
|
|
|
@ -491,12 +491,12 @@ orkinTable::PosToOid( // get row member for a table position
|
|||
morkTable* table = (morkTable*) mHandle_Object;
|
||||
morkRow* row = table->SafeRowAt(ev, inRowPos);
|
||||
if ( row )
|
||||
roid = row->mRow_Oid;
|
||||
roid = row->mRow_Oid;
|
||||
|
||||
outErr = ev->AsErr();
|
||||
}
|
||||
if ( outOid )
|
||||
*outOid = roid;
|
||||
*outOid = roid;
|
||||
return outErr;
|
||||
}
|
||||
|
||||
|
@ -522,7 +522,7 @@ orkinTable::OidToPos( // test for the table position of a row member
|
|||
orkinTable::PosToRow( // get row member for a table position
|
||||
nsIMdbEnv* mev, // context
|
||||
mdb_pos inRowPos, // zero-based ordinal position of row in table
|
||||
nsIMdbRow** acqRow) // acquire row at table position inRowPos
|
||||
nsIMdbRow** acqRow) // acquire row at table position inRowPos
|
||||
{
|
||||
mdb_err outErr = 0;
|
||||
nsIMdbRow* outRow = 0;
|
||||
|
@ -534,11 +534,11 @@ orkinTable::PosToRow( // get row member for a table position
|
|||
morkRow* row = table->SafeRowAt(ev, inRowPos);
|
||||
if ( row && store )
|
||||
outRow = row->AcquireRowHandle(ev, store);
|
||||
|
||||
|
||||
outErr = ev->AsErr();
|
||||
}
|
||||
if ( acqRow )
|
||||
*acqRow = outRow;
|
||||
*acqRow = outRow;
|
||||
return outErr;
|
||||
}
|
||||
|
||||
|
|
|
@ -190,25 +190,25 @@ morkEnv::OidAsHex(void* outBuf, const mdbOid& inOid)
|
|||
mork_u1
|
||||
morkEnv::HexToByte(mork_ch inFirstHex, mork_ch inSecondHex)
|
||||
{
|
||||
mork_u1 hi = 0; // high four hex bits
|
||||
mork_flags f = morkCh_GetFlags(inFirstHex);
|
||||
if ( morkFlags_IsDigit(f) )
|
||||
hi = inFirstHex - '0';
|
||||
else if ( morkFlags_IsUpper(f) )
|
||||
hi = (inFirstHex - 'A') + 10;
|
||||
else if ( morkFlags_IsLower(f) )
|
||||
hi = (inFirstHex - 'a') + 10;
|
||||
|
||||
mork_u1 lo = 0; // low four hex bits
|
||||
f = morkCh_GetFlags(inSecondHex);
|
||||
if ( morkFlags_IsDigit(f) )
|
||||
lo = inSecondHex - '0';
|
||||
else if ( morkFlags_IsUpper(f) )
|
||||
lo = (inSecondHex - 'A') + 10;
|
||||
else if ( morkFlags_IsLower(f) )
|
||||
lo = (inSecondHex - 'a') + 10;
|
||||
|
||||
return (mork_u1) ((hi << 4) | lo);
|
||||
mork_u1 hi = 0; // high four hex bits
|
||||
mork_flags f = morkCh_GetFlags(inFirstHex);
|
||||
if ( morkFlags_IsDigit(f) )
|
||||
hi = inFirstHex - '0';
|
||||
else if ( morkFlags_IsUpper(f) )
|
||||
hi = (inFirstHex - 'A') + 10;
|
||||
else if ( morkFlags_IsLower(f) )
|
||||
hi = (inFirstHex - 'a') + 10;
|
||||
|
||||
mork_u1 lo = 0; // low four hex bits
|
||||
f = morkCh_GetFlags(inSecondHex);
|
||||
if ( morkFlags_IsDigit(f) )
|
||||
lo = inSecondHex - '0';
|
||||
else if ( morkFlags_IsUpper(f) )
|
||||
lo = (inSecondHex - 'A') + 10;
|
||||
else if ( morkFlags_IsLower(f) )
|
||||
lo = (inSecondHex - 'a') + 10;
|
||||
|
||||
return (mork_u1) ((hi << 4) | lo);
|
||||
}
|
||||
|
||||
mork_size
|
||||
|
|
|
@ -825,27 +825,27 @@ morkBuf* morkParser::ReadValue(morkEnv* ev)
|
|||
{
|
||||
if ( c == '\\' ) // "\" escapes the next char?
|
||||
{
|
||||
if ( (c = s->Getc(ev)) == 0xA || c == 0xD ) // linebreak after \?
|
||||
c = this->eat_line_break(ev, c);
|
||||
if ( (c = s->Getc(ev)) == 0xA || c == 0xD ) // linebreak after \?
|
||||
c = this->eat_line_break(ev, c);
|
||||
|
||||
if ( c == EOF || ev->Bad() )
|
||||
break; // end while loop
|
||||
}
|
||||
else if ( c == '$' ) // "$" escapes next two hex digits?
|
||||
{
|
||||
if ( (c = s->Getc(ev)) != EOF && ev->Good() )
|
||||
{
|
||||
mork_ch first = (mork_ch) c; // first hex digit
|
||||
if ( (c = s->Getc(ev)) != EOF && ev->Good() )
|
||||
{
|
||||
mork_ch second = (mork_ch) c; // second hex digit
|
||||
c = ev->HexToByte(first, second);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
else
|
||||
break;
|
||||
if ( (c = s->Getc(ev)) != EOF && ev->Good() )
|
||||
{
|
||||
mork_ch first = (mork_ch) c; // first hex digit
|
||||
if ( (c = s->Getc(ev)) != EOF && ev->Good() )
|
||||
{
|
||||
mork_ch second = (mork_ch) c; // second hex digit
|
||||
c = ev->HexToByte(first, second);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
spool->Putc(ev, c);
|
||||
}
|
||||
|
|
|
@ -210,7 +210,7 @@ morkPortTableCursor::init_space_tables_map(morkEnv* ev)
|
|||
morkRowSpace* space = mPortTableCursor_RowSpace;
|
||||
if ( space && ev->Good() )
|
||||
{
|
||||
morkTableMapIter* ti = &mPortTableCursor_TableIter;
|
||||
morkTableMapIter* ti = &mPortTableCursor_TableIter;
|
||||
ti->InitTableMapIter(ev, &space->mRowSpace_Tables);
|
||||
if ( ev->Good() )
|
||||
mPortTableCursor_TablesDidEnd = morkBool_kFalse;
|
||||
|
|
|
@ -367,12 +367,12 @@ morkWriter::WriteYarn(morkEnv* ev, const mdbYarn* inYarn)
|
|||
const mork_u1* end = b + fill;
|
||||
while ( b < end && ev->Good() )
|
||||
{
|
||||
if ( lineSize + outSize >= mWriter_MaxLine ) // continue line?
|
||||
{
|
||||
if ( lineSize + outSize >= mWriter_MaxLine ) // continue line?
|
||||
{
|
||||
stream->PutByteThenNewline(ev, '\\');
|
||||
mWriter_LineSize = lineSize = outSize = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
c = *b++; // next byte to print
|
||||
if ( morkCh_IsValue(c) )
|
||||
{
|
||||
|
@ -1049,24 +1049,24 @@ morkWriter::WriteTokenToTokenMetaCell(morkEnv* ev,
|
|||
mWriter_LineSize += stream->Write(ev, buf, colSize + 3);
|
||||
}
|
||||
|
||||
if ( isKindCol )
|
||||
{
|
||||
p = buf;
|
||||
if ( isKindCol )
|
||||
{
|
||||
p = buf;
|
||||
mork_size valSize = ev->TokenAsHex(p, inValue);
|
||||
p += valSize;
|
||||
*p++ = ')';
|
||||
mWriter_LineSize += stream->Write(ev, buf, valSize + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->IndentAsNeeded(ev, morkWriter_kTableMetaCellValueDepth);
|
||||
mdbYarn* yarn = &mWriter_ColYarn;
|
||||
// mork_u1* yarnBuf = (mork_u1*) yarn->mYarn_Buf;
|
||||
mWriter_Store->TokenToString(ev, inValue, yarn);
|
||||
this->WriteYarn(ev, yarn);
|
||||
stream->Putc(ev, ')');
|
||||
++mWriter_LineSize;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this->IndentAsNeeded(ev, morkWriter_kTableMetaCellValueDepth);
|
||||
mdbYarn* yarn = &mWriter_ColYarn;
|
||||
// mork_u1* yarnBuf = (mork_u1*) yarn->mYarn_Buf;
|
||||
mWriter_Store->TokenToString(ev, inValue, yarn);
|
||||
this->WriteYarn(ev, yarn);
|
||||
stream->Putc(ev, ')');
|
||||
++mWriter_LineSize;
|
||||
}
|
||||
|
||||
// mork_fill fill = yarn->mYarn_Fill;
|
||||
// yarnBuf[ fill ] = ')'; // append terminator
|
||||
|
@ -1218,7 +1218,7 @@ morkWriter::StartTable(morkEnv* ev, morkTable* ioTable)
|
|||
{
|
||||
if ( r->IsRow() )
|
||||
{
|
||||
mWriter_SuppressDirtyRowNewline = morkBool_kTrue;
|
||||
mWriter_SuppressDirtyRowNewline = morkBool_kTrue;
|
||||
this->PutRow(ev, r);
|
||||
}
|
||||
else
|
||||
|
@ -1230,8 +1230,8 @@ morkWriter::StartTable(morkEnv* ev, morkTable* ioTable)
|
|||
|
||||
if ( mWriter_LineSize < mWriter_MaxIndent )
|
||||
{
|
||||
stream->Putc(ev, ' '); // nice white space
|
||||
++mWriter_LineSize;
|
||||
stream->Putc(ev, ' '); // nice white space
|
||||
++mWriter_LineSize;
|
||||
}
|
||||
|
||||
// mWriter_LineSize = stream->PutIndent(ev, morkWriter_kRowDepth);
|
||||
|
@ -1253,7 +1253,7 @@ morkWriter::PutRowDict(morkEnv* ev, morkRow* ioRow)
|
|||
if ( cells )
|
||||
{
|
||||
morkStream* stream = mWriter_Stream;
|
||||
mdbYarn yarn; // to ref content inside atom
|
||||
mdbYarn yarn; // to ref content inside atom
|
||||
char buf[ 64 ]; // buffer for staging the dict alias hex ID
|
||||
char* idBuf = buf + 1; // where the id always starts
|
||||
buf[ 0 ] = '('; // we always start with open paren
|
||||
|
@ -1267,12 +1267,12 @@ morkWriter::PutRowDict(morkEnv* ev, morkRow* ioRow)
|
|||
{
|
||||
if ( atom->IsBook() ) // is it possible to write atom ID?
|
||||
{
|
||||
if ( !this->DidStartDict() )
|
||||
{
|
||||
this->StartDict(ev);
|
||||
if ( ev->Bad() )
|
||||
break;
|
||||
}
|
||||
if ( !this->DidStartDict() )
|
||||
{
|
||||
this->StartDict(ev);
|
||||
if ( ev->Bad() )
|
||||
break;
|
||||
}
|
||||
atom->mAtom_Change = morkChange_kNil; // neutralize change
|
||||
|
||||
this->IndentAsNeeded(ev, morkWriter_kDictAliasDepth);
|
||||
|
@ -1280,25 +1280,25 @@ morkWriter::PutRowDict(morkEnv* ev, morkRow* ioRow)
|
|||
mork_size size = ev->TokenAsHex(idBuf, ba->mBookAtom_Id);
|
||||
mWriter_LineSize += stream->Write(ev, buf, size+1); // '('
|
||||
|
||||
if ( atom->AliasYarn(&yarn) )
|
||||
{
|
||||
if ( mWriter_DidStartDict && yarn.mYarn_Form != mWriter_DictForm )
|
||||
this->ChangeDictForm(ev, yarn.mYarn_Form);
|
||||
if ( atom->AliasYarn(&yarn) )
|
||||
{
|
||||
if ( mWriter_DidStartDict && yarn.mYarn_Form != mWriter_DictForm )
|
||||
this->ChangeDictForm(ev, yarn.mYarn_Form);
|
||||
|
||||
mork_size pending = yarn.mYarn_Fill + morkWriter_kYarnEscapeSlop + 1;
|
||||
this->IndentOverMaxLine(ev, pending, morkWriter_kDictAliasValueDepth);
|
||||
|
||||
stream->Putc(ev, '='); // start value
|
||||
++mWriter_LineSize;
|
||||
mork_size pending = yarn.mYarn_Fill + morkWriter_kYarnEscapeSlop + 1;
|
||||
this->IndentOverMaxLine(ev, pending, morkWriter_kDictAliasValueDepth);
|
||||
|
||||
stream->Putc(ev, '='); // start value
|
||||
++mWriter_LineSize;
|
||||
|
||||
this->WriteYarn(ev, &yarn);
|
||||
this->WriteYarn(ev, &yarn);
|
||||
|
||||
stream->Putc(ev, ')'); // end value
|
||||
++mWriter_LineSize;
|
||||
}
|
||||
else
|
||||
atom->BadAtomKindError(ev);
|
||||
|
||||
stream->Putc(ev, ')'); // end value
|
||||
++mWriter_LineSize;
|
||||
}
|
||||
else
|
||||
atom->BadAtomKindError(ev);
|
||||
|
||||
++mWriter_DoneCount;
|
||||
}
|
||||
}
|
||||
|
@ -1425,10 +1425,10 @@ morkWriter::PutRow(morkEnv* ev, morkRow* ioRow)
|
|||
|
||||
if ( ioRow->IsRowDirty() )
|
||||
{
|
||||
if ( mWriter_SuppressDirtyRowNewline )
|
||||
mWriter_SuppressDirtyRowNewline = morkBool_kFalse;
|
||||
else
|
||||
mWriter_LineSize = stream->PutIndent(ev, morkWriter_kRowDepth);
|
||||
if ( mWriter_SuppressDirtyRowNewline )
|
||||
mWriter_SuppressDirtyRowNewline = morkBool_kFalse;
|
||||
else
|
||||
mWriter_LineSize = stream->PutIndent(ev, morkWriter_kRowDepth);
|
||||
|
||||
ioRow->SetRowClean();
|
||||
mork_rid rid = roid->mOid_Id;
|
||||
|
|
|
@ -253,7 +253,7 @@ orkinRowCellCursor::GetCount(nsIMdbEnv* mev, mdb_count* outCount)
|
|||
outErr = ev->AsErr();
|
||||
}
|
||||
if ( outCount )
|
||||
*outCount = count;
|
||||
*outCount = count;
|
||||
return outErr;
|
||||
}
|
||||
|
||||
|
@ -271,7 +271,7 @@ orkinRowCellCursor::GetSeed(nsIMdbEnv* mev, mdb_seed* outSeed)
|
|||
outErr = ev->AsErr();
|
||||
}
|
||||
if ( outSeed )
|
||||
*outSeed = seed;
|
||||
*outSeed = seed;
|
||||
return outErr;
|
||||
}
|
||||
|
||||
|
@ -306,7 +306,7 @@ orkinRowCellCursor::GetPos(nsIMdbEnv* mev, mdb_pos* outPos)
|
|||
outErr = ev->AsErr();
|
||||
}
|
||||
if ( outPos )
|
||||
*outPos = pos;
|
||||
*outPos = pos;
|
||||
return outErr;
|
||||
}
|
||||
|
||||
|
@ -341,7 +341,7 @@ orkinRowCellCursor::GetDoFailOnSeedOutOfSync(nsIMdbEnv* mev, mdb_bool* outFail)
|
|||
outErr = ev->AsErr();
|
||||
}
|
||||
if ( outFail )
|
||||
*outFail = doFail;
|
||||
*outFail = doFail;
|
||||
return outErr;
|
||||
}
|
||||
// } ----- end attribute methods -----
|
||||
|
@ -365,21 +365,21 @@ orkinRowCellCursor::SetRow(nsIMdbEnv* mev, nsIMdbRow* ioRow)
|
|||
orkinRow* orow = (orkinRow*) ioRow;
|
||||
if ( orow->CanUseRow(mev, /*inMutable*/ morkBool_kFalse, &outErr, &row) )
|
||||
{
|
||||
morkStore* store = row->GetRowSpaceStore(ev);
|
||||
if ( store )
|
||||
{
|
||||
morkRowObject* rowObj = row->AcquireRowObject(ev, store);
|
||||
if ( rowObj )
|
||||
{
|
||||
morkRowObject::SlotStrongRowObject((morkRowObject*) 0, ev,
|
||||
&cursor->mRowCellCursor_RowObject);
|
||||
|
||||
cursor->mRowCellCursor_RowObject = rowObj; // take this strong ref
|
||||
cursor->mCursor_Seed = row->mRow_Seed;
|
||||
|
||||
row->GetCell(ev, cursor->mRowCellCursor_Col, &cursor->mCursor_Pos);
|
||||
}
|
||||
}
|
||||
morkStore* store = row->GetRowSpaceStore(ev);
|
||||
if ( store )
|
||||
{
|
||||
morkRowObject* rowObj = row->AcquireRowObject(ev, store);
|
||||
if ( rowObj )
|
||||
{
|
||||
morkRowObject::SlotStrongRowObject((morkRowObject*) 0, ev,
|
||||
&cursor->mRowCellCursor_RowObject);
|
||||
|
||||
cursor->mRowCellCursor_RowObject = rowObj; // take this strong ref
|
||||
cursor->mCursor_Seed = row->mRow_Seed;
|
||||
|
||||
row->GetCell(ev, cursor->mRowCellCursor_Col, &cursor->mCursor_Pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
outErr = ev->AsErr();
|
||||
}
|
||||
|
@ -399,12 +399,12 @@ orkinRowCellCursor::GetRow(nsIMdbEnv* mev, nsIMdbRow** acqRow)
|
|||
morkRowCellCursor* cursor = (morkRowCellCursor*) mHandle_Object;
|
||||
morkRowObject* rowObj = cursor->mRowCellCursor_RowObject;
|
||||
if ( rowObj )
|
||||
outRow = rowObj->AcquireRowHandle(ev);
|
||||
outRow = rowObj->AcquireRowHandle(ev);
|
||||
|
||||
outErr = ev->AsErr();
|
||||
}
|
||||
if ( acqRow )
|
||||
*acqRow = outRow;
|
||||
*acqRow = outRow;
|
||||
return outErr;
|
||||
}
|
||||
// } ----- end attribute methods -----
|
||||
|
@ -431,18 +431,18 @@ orkinRowCellCursor::MakeCell( // get cell at current pos in the row
|
|||
morkCell* cell = row->CellAt(ev, pos);
|
||||
if ( cell )
|
||||
{
|
||||
col = cell->GetColumn();
|
||||
outCell = row->AcquireCellHandle(ev, cell, col, pos);
|
||||
col = cell->GetColumn();
|
||||
outCell = row->AcquireCellHandle(ev, cell, col, pos);
|
||||
}
|
||||
outErr = ev->AsErr();
|
||||
}
|
||||
if ( acqCell )
|
||||
*acqCell = outCell;
|
||||
if ( outPos )
|
||||
*outPos = pos;
|
||||
if ( outColumn )
|
||||
*outColumn = col;
|
||||
|
||||
*acqCell = outCell;
|
||||
if ( outPos )
|
||||
*outPos = pos;
|
||||
if ( outColumn )
|
||||
*outColumn = col;
|
||||
|
||||
return outErr;
|
||||
}
|
||||
// } ----- end cell creation methods -----
|
||||
|
@ -467,7 +467,7 @@ orkinRowCellCursor::SeekCell( // same as SetRow() followed by MakeCell()
|
|||
outErr = ev->AsErr();
|
||||
}
|
||||
if ( acqCell )
|
||||
*acqCell = outCell;
|
||||
*acqCell = outCell;
|
||||
return outErr;
|
||||
}
|
||||
// } ----- end cell seeking methods -----
|
||||
|
|
|
@ -491,12 +491,12 @@ orkinTable::PosToOid( // get row member for a table position
|
|||
morkTable* table = (morkTable*) mHandle_Object;
|
||||
morkRow* row = table->SafeRowAt(ev, inRowPos);
|
||||
if ( row )
|
||||
roid = row->mRow_Oid;
|
||||
roid = row->mRow_Oid;
|
||||
|
||||
outErr = ev->AsErr();
|
||||
}
|
||||
if ( outOid )
|
||||
*outOid = roid;
|
||||
*outOid = roid;
|
||||
return outErr;
|
||||
}
|
||||
|
||||
|
@ -522,7 +522,7 @@ orkinTable::OidToPos( // test for the table position of a row member
|
|||
orkinTable::PosToRow( // get row member for a table position
|
||||
nsIMdbEnv* mev, // context
|
||||
mdb_pos inRowPos, // zero-based ordinal position of row in table
|
||||
nsIMdbRow** acqRow) // acquire row at table position inRowPos
|
||||
nsIMdbRow** acqRow) // acquire row at table position inRowPos
|
||||
{
|
||||
mdb_err outErr = 0;
|
||||
nsIMdbRow* outRow = 0;
|
||||
|
@ -534,11 +534,11 @@ orkinTable::PosToRow( // get row member for a table position
|
|||
morkRow* row = table->SafeRowAt(ev, inRowPos);
|
||||
if ( row && store )
|
||||
outRow = row->AcquireRowHandle(ev, store);
|
||||
|
||||
|
||||
outErr = ev->AsErr();
|
||||
}
|
||||
if ( acqRow )
|
||||
*acqRow = outRow;
|
||||
*acqRow = outRow;
|
||||
return outErr;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче