+ /* split into fields */
+ num_pic_words = split_words (pic_word, pic_buf);
+
+ /* ignore comment / empty lines */
+ if (num_pic_words > 0)
+ {
+
+ if (STRCASECMP (pic_word[0], "processor") == 0)
+ {
+ if (pic_name == NULL)
+ {
+ int dcount;
+
+ /* this is the mode where we read all the processors in - store the names for now */
+ if (num_processor_names > 0)
+ {
+ /* store away all the previous processor definitions */
+ for (dcount = 1; dcount < num_processor_names; dcount++)
+ {
+ create_pic (processor_name[dcount], pic_maxram,
+ pic_bankmsk, pic_confsiz, pic_program,
+ pic_data, pic_eeprom, pic_io);
+ } // for
+ } // if
+
+ /* copy processor names */
+ num_processor_names = num_pic_words;
+ for (dcount = 1; dcount < num_processor_names; dcount++)
+ {
+ processor_name[dcount] = pic_word[dcount];
+ pic_word[dcount] = NULL;
+ } // for
+ } // if
+ else
+ {
+ /* if we've just completed reading a processor definition stop now */
+ if (found_processor)
+ done = TRUE;
+ else
+ {
+ /* check if this processor name is a match */
+ for (wcount = 1; wcount < num_pic_words; wcount++)
+ {
+ /* skip uninteresting prefixes */
+ char *found_name = sanitise_processor_name (pic_word[wcount]);
+
+ if (STRCASECMP (found_name, simple_pic_name) == 0)
+ found_processor = TRUE;
+ } // for
+ } // if
+ } // if
+ } // if
+ else
+ {
+ if (found_processor || pic_name == NULL)
+ {
+ /* only parse a processor section if we've found the one we want */
+ if (STRCASECMP (pic_word[0], "maxram") == 0 && num_pic_words > 1)
+ {
+ pic_maxram = parse_config_value (pic_word[1]);
+ setMaxRAM (pic_maxram);
+ } // if
+
+ else if (STRCASECMP (pic_word[0], "bankmsk") == 0 && num_pic_words > 1)
+ pic_bankmsk = parse_config_value (pic_word[1]);
+
+ else if (STRCASECMP (pic_word[0], "confsiz") == 0 && num_pic_words > 1)
+ pic_confsiz = parse_config_value (pic_word[1]);
+
+ else if (STRCASECMP (pic_word[0], "program") == 0 && num_pic_words > 1)
+ pic_program = parse_config_value (pic_word[1]);
+
+ else if (STRCASECMP (pic_word[0], "data") == 0 && num_pic_words > 1)
+ pic_data = parse_config_value (pic_word[1]);
+
+ else if (STRCASECMP (pic_word[0], "eeprom") == 0 && num_pic_words > 1)
+ pic_eeprom = parse_config_value (pic_word[1]);
+
+ else if (STRCASECMP (pic_word[0], "io") == 0 && num_pic_words > 1)
+ pic_io = parse_config_value (pic_word[1]);
+
+ else if (STRCASECMP (pic_word[0], "regmap") == 0 && num_pic_words > 2)
+ {
+ if (found_processor)
+ register_map (num_pic_words, pic_word);
+ } // if
+
+ else if (STRCASECMP (pic_word[0], "memmap") == 0 && num_pic_words > 2)
+ {
+ if (found_processor)
+ ram_map (num_pic_words, pic_word);
+ } // if
+
+ else
+ {
+ fprintf (stderr, "WARNING: %s: bad syntax `%s'\n",
+ DEVICE_FILE_NAME, pic_word[0]);
+ } // if
+ } // if
+ } // if
+ } // if
+ } // while
+
+ fclose (pic_file);
+
+ split_words (pic_word, NULL);
+ free (pic_word);
+
+ /* if we're in read-the-lot mode then create the final processor definition */
+ if (pic_name == NULL)
+ {
+ if (num_processor_names > 0)
+ {
+ /* store away all the previous processor definitions */
+ int dcount;
+
+ for (dcount = 1; dcount < num_processor_names; dcount++)
+ {
+ create_pic (processor_name[dcount], pic_maxram, pic_bankmsk,
+ pic_confsiz, pic_program, pic_data, pic_eeprom,
+ pic_io);
+ } // for
+ } // if
+ } // if
+ else
+ {
+ /* in search mode */
+ if (found_processor)
+ {
+ split_words (processor_name, NULL);
+ free (processor_name);
+
+ /* create a new pic entry */
+ return create_pic (pic_name, pic_maxram, pic_bankmsk,
+ pic_confsiz, pic_program, pic_data,
+ pic_eeprom, pic_io);
+ } // if
+ } // if
+
+ split_words (processor_name, NULL);
+ free (processor_name);
+
+ return NULL;