Previous 15994 Revisions Next

r11468 Saturday 7th May, 2011 at 08:59:45 UTC by Miodrag Milanović
Removed not needed dependencies for castool building (no whatsnew)
[src/mess/tools/castool]castool.mak main.c stubs.c

src/mess/tools/castool/stubs.c
r11467r11468
1#include "emu.h"
2#include "emuopts.h"
3#include "pool.h"
4#include <ctype.h>
5#include <stdarg.h>
6
7/* Variables to hold the status of various game options */
8static FILE *errorlog;
9
10const game_driver *const drivers[1] = { NULL };
11int rompath_extra;
12int history_filename;
13int mameinfo_filename;
14
15void CLIB_DECL logerror(const char *text,...)
16{
17   va_list arg;
18   va_start(arg,text);
19   if (errorlog)
20      vfprintf(errorlog,text,arg);
21   va_end(arg);
22}
23
24/* ----------------------------------------------------------------------- */
25/* total hack */
26
27file_error mame_fopen(const char *searchpath, const char *filename, UINT32 openflags, emu_file **file)
28{
29   char buffer[2048];
30   snprintf(buffer, sizeof(buffer), "crc/%s", filename);
31   *file = (emu_file *) fopen(buffer, "r");
32   return FILERR_NONE;
33}
34
35char *mame_fgets(char *s, int n, emu_file *file)
36{
37   return fgets(s, n, (FILE *) file);
38}
39
40UINT32 mame_fwrite(emu_file *file, const void *buffer, UINT32 length)
41{
42   return fwrite(buffer, 1, length, (FILE *) file);
43}
44
45void mame_fclose(emu_file *file)
46{
47   fclose((FILE *) file);
48}
49
50int CLIB_DECL mame_fprintf(emu_file *f, const char *fmt, ...)
51{
52   int rc;
53   va_list va;
54   va_start(va, fmt);
55   rc = vfprintf(stderr, fmt, va);
56   va_end(va);
57   return rc;
58}
59
60void mame_printf_error(const char *format, ...)
61{
62}
63
64void mame_printf_warning(const char *format, ...)
65{
66}
67
68void mame_printf_info(const char *format, ...)
69{
70}
71
72void mame_printf_debug(const char *format, ...)
73{
74}
75
76
77
78/***************************************************************************
79    TYPE DEFINITIONS
80***************************************************************************/
81
82enum _memory_block_overlap
83{
84   OVERLAP_NONE,
85   OVERLAP_PARTIAL,
86   OVERLAP_FULL
87};
88typedef enum _memory_block_overlap memory_block_overlap;
89
90
91
92/***************************************************************************
93    GLOBAL VARIABLES
94***************************************************************************/
95
96/* pool list */
97static object_pool *pools[64];
98
99/* resource tracking */
100int resource_tracking_tag = 0;
101
102
103
104/***************************************************************************
105    PROTOTYPES
106***************************************************************************/
107
108/***************************************************************************
109    CORE IMPLEMENTATION
110***************************************************************************/
111/*-------------------------------------------------
112    current_pool - identifies the current memory
113    pool
114-------------------------------------------------*/
115
116static object_pool *current_pool(void)
117{
118   object_pool *pool;
119   assert_always((resource_tracking_tag > 0) && (resource_tracking_tag <= ARRAY_LENGTH(pools)), "Invalid resource_tracking_tag");
120   pool = pools[resource_tracking_tag - 1];
121   assert_always(pool != NULL, "current_pool() is NULL");
122   return pool;
123}
124
125
126/*-------------------------------------------------
127    restrack_register_object - registers an
128    object with the current pool
129-------------------------------------------------*/
130
131void *restrack_register_object(object_type type, void *ptr, size_t size, const char *file, int line)
132{
133   return pool_object_add_file_line(current_pool(), type, ptr, size, file, line);
134}
135
136
137/*-------------------------------------------------
138    auto_malloc_file_line - allocate auto-
139    freeing memory
140-------------------------------------------------*/
141
142void *auto_malloc_file_line(running_machine &machine, size_t size, const char *file, int line)
143{
144   void *result = pool_malloc_file_line(current_pool(), size, file, line);
145   return result;
146}
147
148
149/*-------------------------------------------------
150    auto_realloc_file_line - reallocate auto-
151    freeing memory
152-------------------------------------------------*/
153
154void *auto_realloc_file_line(running_machine &machine, void *ptr, size_t size, const char *file, int line)
155{
156   object_pool *pool = current_pool();
157   if (ptr != NULL)
158   {
159      int tag = resource_tracking_tag;
160      for (; tag > 0; tag--)
161      {
162         pool = pools[tag - 1];
163         if (pool_object_exists(pool, OBJTYPE_MEMORY, ptr))
164            break;
165      }
166      assert_always(tag > 0, "Failed to find alloc in pool");
167   }
168
169   return pool_realloc_file_line(pool, ptr, size, file, line);
170}
171
172
173/*-------------------------------------------------
174    auto_strdup_file_line - allocate auto-freeing
175    string
176-------------------------------------------------*/
177
178char *auto_strdup_file_line(running_machine &machine, const char *str, const char *file, int line)
179{
180   return pool_strdup_file_line(current_pool(), str, file, line);
181}
182
183
184/*-------------------------------------------------
185    auto_strdup_allow_null_file_line - allocate
186    auto-freeing string if str is null
187-------------------------------------------------*/
188
189char *auto_strdup_allow_null_file_line(running_machine &machine, const char *str, const char *file, int line)
190{
191   return (str != NULL) ? auto_strdup_file_line(machine, str, file, line) : NULL;
192}
193
194
195
196void *malloc_or_die_file_line(size_t size, const char *file, int line)
197{
198   return malloc(size);
199}
src/mess/tools/castool/main.c
r11467r11468
1515#include <time.h>
1616#include <assert.h>
1717
18#include "emu.h"
19#include "fileio.h"
18#include "corestr.h"
2019
21#include "imagedev/cassette.h"
22
2320#include "formats/a26_cas.h"
2421#include "formats/apf_apt.h"
2522#include "formats/cbm_tap.h"
r11467r11468
133130
134131   if (argc > 1)
135132   {
136      if (!mame_stricmp("convert", argv[1]))
133      if (!core_stricmp("convert", argv[1]))
137134      {
138135         // convert command
139136         if (argc!=5) {
r11467r11468
142139            return -1;
143140         } else {
144141            for (i = 0; formats[i].name; i++) {
145               if (mame_stricmp(formats[i].name,argv[2])==0) {
142               if (core_stricmp(formats[i].name,argv[2])==0) {
146143                  selected_formats = formats[i].formats;
147144                  found = 1;
148145               }
src/mess/tools/castool/castool.mak
r11467r11468
1717CASTOOLOBJ = $(MESS_TOOLS)/castool
1818
1919
20
2120#-------------------------------------------------
2221# castool objects
2322#-------------------------------------------------
r11467r11468
2524OBJDIRS += \
2625   $(CASTOOLOBJ)
2726
28LIBCASTOOL = $(OBJ)/libcastool.a
29
30# castool lib objects
31CASTOOL_LIB_OBJS =                  \
32   $(OBJ)/version.o               \
33   $(EMUOBJ)/emualloc.o            \
34   $(EMUOBJ)/emucore.o               \
35   $(EMUOBJ)/emuopts.o             \
36   $(EMUOBJ)/memory.o               \
37
38
39$(LIBCASTOOL): $(CASTOOL_LIB_OBJS)
40
4127CASTOOL_OBJS = \
4228   $(CASTOOLOBJ)/main.o \
43   $(CASTOOLOBJ)/stubs.o \
44   $(MESS_TOOLS)/toolerr.o
4529
4630
4731
r11467r11468
4933# rules to build the castool executable
5034#-------------------------------------------------
5135
52$(CASTOOL): $(CASTOOL_OBJS) $(LIBCASTOOL) $(LIBUTIL) $(EXPAT) $(FORMATS_LIB) $(ZLIB) $(LIBOCORE)
36$(CASTOOL): $(CASTOOL_OBJS) $(FORMATS_LIB) $(LIBUTIL) $(EXPAT) $(ZLIB) $(LIBOCORE)
5337   @echo Linking $@...
5438   $(LD) $(LDFLAGS) $^ $(LIBS) -o $@

Previous 15994 Revisions Next


© 1998-2018 The MESS Team