Example #1
0
/**
 * Implements rules from ISO 15417 Annex E
 */
void dxsmooth(int *indexliste)
{ /* Implements rules from ISO 15417 Annex E */
	int i, current, last, next, length;
	
	for(i = 0; i < *(indexliste); i++) {
		current = list[1][i];
		length = list[0][i];
		if(i != 0) { last = list[1][i - 1]; } else { last = FALSE; }
		if(i != *(indexliste) - 1) { next = list[1][i + 1]; } else { next = FALSE; }
		
		if(i == 0) { /* first block */
			if((*(indexliste) == 1) && ((length == 2) && (current == ABORC))) { /* Rule 1a */ list[1][i] = LATCHC; }
			if(current == ABORC) { 
				if(length >= 4) {/* Rule 1b */ list[1][i] = LATCHC; } else { list[1][i] = AORB; current = AORB; }
			}
			if(current == SHIFTA) { /* Rule 1c */ list[1][i] = LATCHA; }
			if((current == AORB) && (next == SHIFTA)) { /* Rule 1c */ list[1][i] = LATCHA; current = LATCHA; }
			if(current == AORB) { /* Rule 1d */ list[1][i] = LATCHB; }
		} else {
			if((current == ABORC) && (length >= 4)) { /* Rule 3 */ list[1][i] = LATCHC; current = LATCHC; }
			if(current == ABORC) { list[1][i] = AORB; current = AORB; }
			if((current == AORB) && (last == LATCHA)) { list[1][i] = LATCHA; current = LATCHA; }
			if((current == AORB) && (last == LATCHB)) { list[1][i] = LATCHB; current = LATCHB; }
			if((current == AORB) && (next == SHIFTA)) { list[1][i] = LATCHA; current = LATCHA; }
			if((current == AORB) && (next == SHIFTB)) { list[1][i] = LATCHB; current = LATCHB; }
			if(current == AORB) { list[1][i] = LATCHB; current = LATCHB; }
			if((current == SHIFTA) && (length > 1)) { /* Rule 4 */ list[1][i] = LATCHA; current = LATCHA; }
			if((current == SHIFTB) && (length > 1)) { /* Rule 5 */ list[1][i] = LATCHB; current = LATCHB; }
			if((current == SHIFTA) && (last == LATCHA)) { list[1][i] = LATCHA; current = LATCHA; }
			if((current == SHIFTB) && (last == LATCHB)) { list[1][i] = LATCHB; current = LATCHB; }
			if((current == SHIFTA) && (last == LATCHC)) { list[1][i] = LATCHA; current = LATCHA; }
			if((current == SHIFTB) && (last == LATCHC)) { list[1][i] = LATCHB; current = LATCHB; }
		} /* Rule 2 is implimented elsewhere, Rule 6 is implied */
	}
	grwp(indexliste);

}
Example #2
0
/**
 * Implements rules from ISO 15417 Annex E
 */
static void dxsmooth(int *indexliste)
{
	int current, length, last, next;

	for (int i = 0; i < *indexliste; i++) {
		current = list[1][i];
		length = list[0][i];

		if (i != 0)
			last = list[1][i - 1];
		else
			last = FALSE;

		if (i != *indexliste - 1)
			next = list[1][i + 1];
		else
			next = FALSE;

		if (i == 0) {
			/* first block */
			if (*indexliste == 1 && length == 2 && current == ABORC)
				/* Rule 1a */
				list[1][i] = LATCHC;

			if (current == ABORC) {
				if (length >= 4)
					/* Rule 1b */
					list[1][i] = LATCHC;
				else
					list[1][i] = current = AORB;
			}

			if (current == SHIFTA)
				/* Rule 1c */
				list[1][i] = LATCHA;
			if (current == AORB && next == SHIFTA)
				/* Rule 1c */
				list[1][i] = current = LATCHA;
			if (current == AORB)
				/* Rule 1d */
				list[1][i] = LATCHB;
		} else {
			if (current == ABORC && length >= 4)
				/* Rule 3 */
				list[1][i] = current = LATCHC;
			if (current == ABORC)
				list[1][i] = current = AORB;
			if (current == AORB && last == LATCHA)
				list[1][i] = current = LATCHA;
			if (current == AORB && last == LATCHB)
				list[1][i] = current = LATCHB;
			if (current == AORB && next == SHIFTA)
				list[1][i] = current = LATCHA;
			if (current == AORB && next == SHIFTB)
				list[1][i] = current = LATCHB;
			if (current == AORB)
				list[1][i] = current = LATCHB;
			if (current == SHIFTA && length > 1)
				/* Rule 4 */
				list[1][i] = current = LATCHA;
			if (current == SHIFTB && length > 1)
				/* Rule 5 */
				list[1][i] = current = LATCHB;
			if (current == SHIFTA && last == LATCHA)
				list[1][i] = current = LATCHA;
			if (current == SHIFTB && last == LATCHB)
				list[1][i] = current = LATCHB;
			if (current == SHIFTA && last == LATCHC)
				list[1][i] = current = LATCHA;
			if (current == SHIFTB && last == LATCHC)
				list[1][i] = current = LATCHB;
		} /* Rule 2 is implimented elsewhere, Rule 6 is implied */
	}
	grwp(indexliste);
}