/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/*
*
* (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
*
*/
#include "LETypes.h"
#include "MorphTables.h"
#include "StateTables.h"
#include "MorphStateTables.h"
#include "SubtableProcessor.h"
#include "StateTableProcessor.h"
#include "IndicRearrangementProcessor.h"
#include "LEGlyphStorage.h"
#include "LESwaps.h"
IndicRearrangementProcessor::IndicRearrangementProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success)
entryTable(stateTableHeader, success, (const IndicRearrangementStateEntry*)(&stateTableHeader->stHeader),
int16Table(stateTableHeader, success, (const le_int16*)entryTable.getAlias(), 0, LE_UNBOUNDED_ARRAY)
{
}
{
}
{
firstGlyph = 0;
lastGlyph = 0;
}
ByteOffset IndicRearrangementProcessor::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index)
{
if (flags & irfMarkFirst) {
}
if (flags & irfMarkLast) {
}
if (!(flags & irfDontAdvance)) {
// XXX: Should handle reverse too...
currGlyph += 1;
}
return newState;
}
{
}
void IndicRearrangementProcessor::doRearrangementAction(LEGlyphStorage &glyphStorage, IndicRearrangementVerb verb) const
{
LEGlyphID a, b, c, d;
switch(verb)
{
case irvNoAction:
break;
case irvxA:
a = glyphStorage[firstGlyph];
x = firstGlyph + 1;
while (x <= lastGlyph) {
x += 1;
}
glyphStorage[lastGlyph] = a;
break;
case irvDx:
d = glyphStorage[lastGlyph];
x = lastGlyph - 1;
while (x >= firstGlyph) {
x -= 1;
}
glyphStorage[firstGlyph] = d;
break;
case irvDxA:
a = glyphStorage[firstGlyph];
glyphStorage[lastGlyph] = a;
break;
case irvxAB:
a = glyphStorage[firstGlyph];
x = firstGlyph + 2;
while (x <= lastGlyph) {
x += 1;
}
glyphStorage[lastGlyph] = b;
break;
case irvxBA:
a = glyphStorage[firstGlyph];
x = firstGlyph + 2;
while (x <= lastGlyph) {
x += 1;
}
glyphStorage[lastGlyph] = a;
break;
case irvCDx:
d = glyphStorage[lastGlyph];
x = lastGlyph - 2;
while (x >= firstGlyph) {
x -= 1;
}
glyphStorage[firstGlyph] = c;
break;
case irvDCx:
d = glyphStorage[lastGlyph];
x = lastGlyph - 2;
while (x >= firstGlyph) {
x -= 1;
}
glyphStorage[firstGlyph] = d;
break;
case irvCDxA:
a = glyphStorage[firstGlyph];
d = glyphStorage[lastGlyph];
x = lastGlyph - 2;
while (x > firstGlyph) {
x -= 1;
}
glyphStorage[firstGlyph] = c;
glyphStorage[lastGlyph] = a;
break;
case irvDCxA:
a = glyphStorage[firstGlyph];
d = glyphStorage[lastGlyph];
x = lastGlyph - 2;
while (x > firstGlyph) {
x -= 1;
}
glyphStorage[firstGlyph] = d;
glyphStorage[lastGlyph] = a;
break;
case irvDxAB:
a = glyphStorage[firstGlyph];
d = glyphStorage[lastGlyph];
x = firstGlyph + 2;
while (x < lastGlyph) {
x += 1;
}
glyphStorage[firstGlyph] = d;
glyphStorage[lastGlyph] = b;
break;
case irvDxBA:
a = glyphStorage[firstGlyph];
d = glyphStorage[lastGlyph];
x = firstGlyph + 2;
while (x < lastGlyph) {
x += 1;
}
glyphStorage[firstGlyph] = d;
glyphStorage[lastGlyph] = a;
break;
case irvCDxAB:
a = glyphStorage[firstGlyph];
glyphStorage[lastGlyph] = b;
break;
case irvCDxBA:
a = glyphStorage[firstGlyph];
glyphStorage[lastGlyph] = a;
break;
case irvDCxAB:
a = glyphStorage[firstGlyph];
glyphStorage[lastGlyph] = b;
break;
case irvDCxBA:
a = glyphStorage[firstGlyph];
glyphStorage[lastGlyph] = a;
break;
default:
break;
}
}