Previous 15994 Revisions Next

r7093 Thursday 21st January, 2010 at 07:15:21 UTC by Miodrag Milanović
Fixed some astring issues, make -listxml work fine
[src/mess]filemngr.c image.c infomess.c tapectrl.c
[src/mess/devices]cartslot.c messram.c multcart.c
[src/mess/machine]abc77.c beta.c cbmiec.c ieee488.c

src/mess/devices/cartslot.c
r7092r7093
327327static const cartslot_pcb_type *identify_pcb(const device_config *device)
328328{
329329   const cartslot_config *config = get_config(device);
330   astring *pcb_name = astring_alloc();
330   astring pcb_name;
331331   const cartslot_pcb_type *pcb_type = NULL;
332332   multicart_t *mc;
333333   int i;
r7092r7093
339339      if (me == MCERR_NONE)
340340      {
341341         /* this was a multicart - read from it */
342         astring_cpyc(pcb_name, mc->pcb_type);
342         astring_cpyc(&pcb_name, mc->pcb_type);
343343         multicart_close(mc);
344344      }
345345      else
r7092r7093
349349         if (image_pcb(device) != NULL)
350350         {
351351            /* read from hash file */
352            astring_cpyc(pcb_name, image_pcb(device));
352            astring_cpyc(&pcb_name, image_pcb(device));
353353         }
354354      }
355355
356356      /* look for PCB type with matching name */
357357      for (i = 0; (i < ARRAY_LENGTH(config->pcb_types)) && (config->pcb_types[i].name != NULL); i++)
358358      {
359         if ((config->pcb_types[i].name[0] == '\0') || !strcmp(astring_c(pcb_name), config->pcb_types[i].name))
359         if ((config->pcb_types[i].name[0] == '\0') || !strcmp(astring_c(&pcb_name), config->pcb_types[i].name))
360360         {
361361            pcb_type = &config->pcb_types[i];
362362            break;
r7092r7093
365365
366366      /* check for unknown PCB type */
367367      if ((mc != NULL) && (pcb_type == NULL))
368         fatalerror("Unknown PCB type \"%s\"\n", astring_c(pcb_name));
368         fatalerror("Unknown PCB type \"%s\"\n", astring_c(&pcb_name));
369369   }
370370   else
371371   {
src/mess/devices/messram.c
r7092r7093
191191            {
192192               const char *s;
193193
194               astring *buffer = astring_alloc();
195               astring_cpyc(buffer, config->extra_options);
196               astring_replacechr(buffer, ',', 0);
194               astring buffer;
195               astring_cpyc(&buffer, config->extra_options);
196               astring_replacechr(&buffer, ',', 0);
197197
198               s = astring_c(buffer);
198               s = astring_c(&buffer);
199199
200200               /* try to parse each option */
201201               while(*s != '\0')
r7092r7093
213213
214214                  s += strlen(s) + 1;
215215               }
216
217               astring_free(buffer);
218216            }
219217
220218         } else {
src/mess/devices/multcart.c
r7092r7093
242242   {
243243      if (strcmp(ram_type, "persistent")==0)
244244      {
245         astring tmp;
246
245247         /* Get the file name. */
246248         ram_filename = xml_get_attribute_string(resource_node, "file", NULL);
247249         if (ram_filename==NULL)
248250            return MCERR_XML_ERROR;
249251
250         ram_pathname = astring_assemble_3(astring_alloc(), state->multicart->gamedrv_name, PATH_SEPARATOR, ram_filename);
252         ram_pathname = astring_assemble_3(&tmp, state->multicart->gamedrv_name, PATH_SEPARATOR, ram_filename);
251253
252254         /* Save the file name so that we can write the contents on unloading.
253255               If the RAM resource has no filename, we know that it was volatile only. */
src/mess/tapectrl.c
r7092r7093
9292
9393static void menu_tape_control_populate(running_machine *machine, ui_menu *menu, tape_control_menu_state *menustate)
9494{
95   astring *timepos = astring_alloc();
95   astring timepos;
9696   cassette_state state;
9797   int count = cassette_count(machine);
9898   UINT32 flags = 0;
r7092r7093
111111      ui_menu_item_append(menu, image_typename_id(menustate->device), image_filename(menustate->device), flags, NULL);
112112
113113      /* state */
114      tapecontrol_gettime(timepos, menustate->device, NULL, NULL);
114      tapecontrol_gettime(&timepos, menustate->device, NULL, NULL);
115115      state = cassette_get_state(menustate->device);
116116      ui_menu_item_append(
117117         menu,
r7092r7093
121121               ? ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? UI_playing : UI_playing_inhibited)
122122               : ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? UI_recording : UI_recording_inhibited)
123123               )),
124         astring_c(timepos),
124         astring_c(&timepos),
125125         0,
126126         NULL);
127127
r7092r7093
145145      /* no tape loaded */
146146      ui_menu_item_append(menu, ui_getstring(UI_notapeimageloaded), NULL, flags, NULL);
147147   }
148
149   if (timepos != NULL)
150      astring_free(timepos);
151148}
152149
153150
src/mess/image.c
r7092r7093
712712{
713713    file_error filerr = FILERR_NOT_FOUND;
714714    image_error_t err = IMAGE_ERROR_FILENOTFOUND;
715    astring *revised_path = astring_alloc();
715    astring revised_path;
716716
717717    /* attempt to read the file */
718    filerr = zippath_fopen(path, open_flags, &image->file, revised_path);
718    filerr = zippath_fopen(path, open_flags, &image->file, &revised_path);
719719
720720    /* did the open succeed? */
721721    switch(filerr)
r7092r7093
754754
755755    /* if successful, set the file name */
756756    if (filerr == FILERR_NONE)
757        set_image_filename(image, astring_c(revised_path));
757        set_image_filename(image, astring_c(&revised_path));
758758
759    astring_free(revised_path);
760759    return err;
761760}
762761
src/mess/infomess.c
r7092r7093
129129      {
130130         const char *s;
131131
132         astring *buffer = astring_alloc();
133         astring_cpyc(buffer, config->extra_options);
134         astring_replacechr(buffer, ',', 0);
132         astring buffer;
133         astring_cpyc(&buffer, config->extra_options);
134         astring_replacechr(&buffer, ',', 0);
135135
136         s = astring_c(buffer);
136         s = astring_c(&buffer);
137137
138138         /* try to parse each option */
139139         while(*s != '\0')
r7092r7093
141141            fprintf(out, "\t\t<ramoption>%u</ramoption>\n",  messram_parse_string(s));
142142            s += strlen(s) + 1;
143143         }
144         astring_free(buffer);
145144      }
146145   }
147146}
src/mess/filemngr.c
r7092r7093
304304
305305static void menu_file_create_populate(running_machine *machine, ui_menu *menu, void *state, void *selection)
306306{
307   astring *buffer = astring_alloc();
307   astring buffer;
308308   file_create_menu_state *menustate = (file_create_menu_state *) state;
309309   const device_config *device = menustate->manager_menustate->selected_device;
310310   const image_device_format *format;
r7092r7093
313313   /* append the "New Image Name" item */
314314   if (selection == ITEMREF_NEW_IMAGE_NAME)
315315   {
316      astring_assemble_2(buffer, menustate->filename_buffer, "_");
317      new_image_name = astring_c(buffer);
316      astring_assemble_2(&buffer, menustate->filename_buffer, "_");
317      new_image_name = astring_c(&buffer);
318318   }
319319   else
320320   {
r7092r7093
336336
337337   /* set up custom render proc */
338338   ui_menu_set_custom_render(menu, file_create_render_extra, ui_get_line_height() + 3.0f * UI_BOX_TB_BORDER, 0);
339
340   /* cleanup */
341   astring_free(buffer);
342339}
343340
344341
src/mess/machine/cbmiec.c
r7092r7093
363363   const cbm_iec_daisy_chain *daisy = get_interface(device);
364364   int i;
365365
366   astring *tempstring = astring_alloc();
367366   cbm_iec_daisy_state *head = NULL;
368367   cbm_iec_daisy_state **tailptr = &head;
369368
r7092r7093
377376
378377      if ((*tailptr)->device == NULL)
379378      {
380         astring_free(tempstring);
381379         fatalerror("Unable to locate device '%s'", daisy->tag);
382380      }
383381
r7092r7093
397395
398396   cbm_iec->daisy_state = head;
399397
400   astring_free(tempstring);
401
402398   /* register for state saving */
403399//  state_save_register_device_item(device, 0, cbm_iec->);
404400}
src/mess/machine/beta.c
r7092r7093
308308static DEVICE_START( beta_disk )
309309{
310310   beta_disk_state *beta = get_safe_token(device);
311   astring *tempstring = astring_alloc();
311   astring tempstring;
312312
313313   /* validate arguments */
314314   assert(device->tag != NULL);
315315
316316   /* find our WD179x */
317   astring_printf(tempstring, "%s:%s", device->tag.cstr(), "wd179x");
318   beta->wd179x = devtag_get_device(device->machine, astring_c(tempstring));
319
320   astring_free(tempstring);
317   astring_printf(&tempstring, "%s:%s", device->tag.cstr(), "wd179x");
318   beta->wd179x = devtag_get_device(device->machine, astring_c(&tempstring));
321319}
322320
323321/*-------------------------------------------------
src/mess/machine/abc77.c
r7092r7093
404404   abc77_t *abc77 = (abc77_t *)device->token;
405405   const abc77_interface *intf = get_interface(device);
406406
407   astring *tempstring = astring_alloc();
407   astring tempstring;
408408
409409   /* resolve callbacks */
410410   devcb_resolve_write_line(&abc77->out_txd_func, &intf->out_txd_func, device);
r7092r7093
412412   devcb_resolve_write_line(&abc77->out_keydown_func, &intf->out_keydown_func, device);
413413
414414   /* find our CPU */
415   astring_printf(tempstring, "%s:%s", device->tag.cstr(), I8035_TAG);
416   abc77->cpu = devtag_get_device(device->machine, astring_c(tempstring));
417   astring_free(tempstring);
415   astring_printf(&tempstring, "%s:%s", device->tag.cstr(), I8035_TAG);
416   abc77->cpu = devtag_get_device(device->machine, astring_c(&tempstring));
418417
419418   /* allocate reset timer */
420419   abc77->reset_timer = timer_alloc(device->machine, reset_tick, (FPTR *) device);
src/mess/machine/ieee488.c
r7092r7093
257257   const ieee488_daisy_chain *daisy = get_interface(device);
258258   int i;
259259
260   astring *tempstring = astring_alloc();
261260   ieee488_daisy_state *head = NULL;
262261   ieee488_daisy_state **tailptr = &head;
263262
r7092r7093
272271
273272      if ((*tailptr)->device == NULL)
274273      {
275         astring_free(tempstring);
276274         fatalerror("Unable to locate device '%s'", daisy->tag);
277275      }
278276
r7092r7093
300298
301299   ieee488->daisy_state = head;
302300
303   astring_free(tempstring);
304
305301   /* register for state saving */
306302//   state_save_register_device_item(device, 0, ieee488->);
307303}

Previous 15994 Revisions Next


© 1998-2018 The MESS Team