jp (Jam STAPL Player) Version 2.5
port Actel modifications to newer Altera version

by: Michał Mirosław <mirq-linux@rere.qmqm.pl>

--- jp_25/source/jamexec.c      2004-05-26 15:36:04.000000000 +0200
+++ actel-stapl/jamexec.c       2003-05-22 16:07:32.000000000 +0200
@@ -4005,6 +3817,18 @@ JAM_RETURN_TYPE jam_process_export
 	JAME_EXPRESSION_TYPE expr_type = JAM_ILLEGAL_EXPR_TYPE;
 	JAM_RETURN_TYPE status = JAMC_SYNTAX_ERROR;
 
+	/* boolean array variables */
+	char ba_save_ch = 0;
+	int ba_expr_begin = 0;
+	int ba_expr_end = 0;
+	long ba_start_index = 0L;
+	long ba_stop_index = 0L;
+	long *ba_literal_array_data = NULL;
+	JAMS_SYMBOL_RECORD *ba_symbol_record = NULL;
+	JAMS_HEAP_RECORD *ba_heap_record = NULL;
+	unsigned char* ba_source_heap_data = NULL;
+	/* end of boolean array variables */
+
 	if ((jam_version == 2) && (jam_phase != JAM_PROCEDURE_PHASE))
 	{
 		return (JAMC_PHASE_ERROR);
@@ -4052,6 +3876,91 @@ JAM_RETURN_TYPE jam_process_export
 				++index;	/* step over comma */
 				expr_begin = index;
 
+				/* check if it is a boolean array */
+				while (jam_isspace(statement_buffer[index]) &&
+					(index < JAMC_MAX_STATEMENT_LENGTH))
+				{
+					++index;
+				}
+				ba_expr_begin = index;
+				if (jam_is_name_char(statement_buffer[index]) &&
+					(index < JAMC_MAX_STATEMENT_LENGTH))
+				{
+					++index;
+					while (jam_is_name_char(statement_buffer[index]) &&
+						(index < JAMC_MAX_STATEMENT_LENGTH))
+					{
+						++index;
+					}
+					while (jam_isspace(statement_buffer[index]) &&
+						(index < JAMC_MAX_STATEMENT_LENGTH))
+					{
+						++index;
+					}
+					if (statement_buffer[index] == JAMC_LBRACKET_CHAR)
+					{
+						while ((statement_buffer[index] != JAMC_NULL_CHAR) &&
+							(index < JAMC_MAX_STATEMENT_LENGTH))
+						{
+							++index;
+						}
+						while ((statement_buffer[index] != JAMC_SEMICOLON_CHAR) &&
+							(index > 0))
+						{
+							--index;
+						}
+						ba_expr_end = index;
+						ba_save_ch = statement_buffer[ba_expr_end];
+						statement_buffer[ba_expr_end] = JAMC_NULL_CHAR;
+						status = jam_get_array_argument(
+							&statement_buffer[ba_expr_begin],
+							&ba_symbol_record,
+							&ba_literal_array_data,
+							&ba_start_index,
+							&ba_stop_index, 0);
+						statement_buffer[ba_expr_end] = ba_save_ch;
+
+						if (status == JAMC_SUCCESS)
+						{
+							if (ba_symbol_record != NULL)
+							{
+								if ((ba_symbol_record->type ==
+									JAM_BOOLEAN_ARRAY_WRITABLE) ||
+									(ba_symbol_record->type ==
+									JAM_BOOLEAN_ARRAY_INITIALIZED))
+								{
+									ba_heap_record = (JAMS_HEAP_RECORD *)
+										ba_symbol_record->value;
+									if ((ba_start_index < 0L) || 
+										(ba_start_index >= ba_heap_record->dimension) ||
+										(ba_stop_index < 0L) ||
+										(ba_stop_index >= ba_heap_record->dimension))
+									{
+										return JAMC_BOUNDS_ERROR;
+									}
+									ba_source_heap_data = (unsigned char*)ba_heap_record->data;
+									statement_buffer[key_end] = JAMC_NULL_CHAR;
+									jam_export_boolean_array(&statement_buffer[key_begin],
+										&ba_source_heap_data[ba_start_index], ba_stop_index - ba_start_index + 1L);
+									return JAMC_SUCCESS;
+								}
+								else
+									return JAMC_TYPE_MISMATCH;
+							}
+							else
+							{
+								return JAMC_INTERNAL_ERROR;
+							}
+						}
+						else
+						{
+							return status;
+						}
+					}
+				}
+				/* end of boolean array check */
+
+				index = expr_begin;
 				while ((statement_buffer[index] != JAMC_SEMICOLON_CHAR) &&
 					(statement_buffer[index] != JAMC_NULL_CHAR) &&
 					(index < JAMC_MAX_STATEMENT_LENGTH))
@@ -5539,6 +5448,7 @@ JAM_RETURN_TYPE jam_process_assignment
 	JAMS_HEAP_RECORD *heap_record = NULL;
 	JAM_RETURN_TYPE status = JAMC_SYNTAX_ERROR;
 
+
 	if (let & (jam_version == 0)) jam_version = 1;
 
 	if ((!let) & (jam_version == 0)) jam_version = 2;
