~ubuntu-branches/ubuntu/maverick/vice/maverick

« back to all changes in this revision

Viewing changes to src/fliplist.c

  • Committer: Bazaar Package Importer
  • Author(s): Zed Pobre
  • Date: 2005-02-01 11:30:26 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050201113026-3eyakzsmmheclvjg
Tags: 1.16-1
* New upstream version
* Fixes crash on 64-bit architectures (closes: #287640)
* x128 working again (closes: #286767)
* Works fine with /dev/dsp in use (not in the main changelog, but tested
  on my local machine as working).  Presumably, this also takes care of
  the issue with dsp being held.  I'm not sure if this is because I'm
  testing it on a 2.6 kernel now -- if you are still having problems
  with /dev/dsp, please reopen the bugs. (closes: #152952, #207942)
* Don't kill Makefile.in on clean

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
    if (util_string_set(&fliplist_file_name, (const char *)v))
74
74
        return 0;
75
75
 
76
 
    flip_load_list((unsigned int)-1, fliplist_file_name, 0);
 
76
    fliplist_load_list((unsigned int)-1, fliplist_file_name, 0);
77
77
 
78
78
    return 0;
79
79
}
92
92
    if (resources_register(resources) < 0)
93
93
        return -1;
94
94
 
 
95
    return 0;
 
96
}
 
97
 
 
98
void fliplist_resources_shutdown(void)
 
99
{
 
100
    int i;
 
101
 
 
102
    for (i = 0; i < NUM_DRIVES; i++)
 
103
        fliplist_clear_list(8 + i);
 
104
    lib_free(fliplist_file_name);
95
105
    lib_free(resources[0].factory_value);
96
 
 
97
 
    return 0;
98
106
}
99
107
 
100
108
static const cmdline_option_t cmdline_options[] =
112
120
/* ------------------------------------------------------------------------- */
113
121
/* interface functions */
114
122
 
115
 
void flip_shutdown(void)
 
123
void fliplist_shutdown(void)
116
124
{
117
 
    lib_free(current_image);
 
125
    if (current_image != NULL)
 
126
        lib_free(current_image);
118
127
}
119
128
 
120
 
void flip_set_current(unsigned int unit, const char *filename)
 
129
void fliplist_set_current(unsigned int unit, const char *filename)
121
130
{
122
131
    if (current_image != NULL)
123
132
        lib_free(current_image);
125
134
    current_drive = unit;
126
135
}
127
136
 
128
 
char *flip_get_head(unsigned int unit)
 
137
#if 0
 
138
char *fliplist_get_head(unsigned int unit)
129
139
{
130
140
    if (fliplist[unit - 8])
131
141
        return fliplist[unit - 8]->image;
132
142
    return (char *) NULL;
133
143
}
 
144
#endif
134
145
 
135
 
char *flip_get_next(unsigned int unit)
 
146
char *fliplist_get_next(unsigned int unit)
136
147
{
137
148
    if (fliplist[unit - 8])
138
149
        return fliplist[unit - 8]->next->image;
139
150
    return (char *) NULL;
140
151
}
141
152
 
142
 
char *flip_get_prev(unsigned int unit)
 
153
char *fliplist_get_prev(unsigned int unit)
143
154
{
144
155
    if (fliplist[unit - 8])
145
156
        return fliplist[unit - 8]->prev->image;
146
157
    return (char *) NULL;
147
158
}
148
159
 
149
 
char *flip_get_image(void *fl)
 
160
char *fliplist_get_image(void *fl)
150
161
{
151
162
    return ((struct fliplist_t *) fl)->image;
152
163
}
153
164
 
154
 
unsigned int flip_get_unit(void *fl)
 
165
unsigned int fliplist_get_unit(void *fl)
155
166
{
156
167
    return ((struct fliplist_t *) fl)->unit;
157
168
}
158
169
 
159
 
void flip_add_image(unsigned int unit)
 
170
void fliplist_add_image(unsigned int unit)
160
171
{
161
172
    struct fliplist_t *n;
162
173
 
184
195
    show_fliplist(unit);
185
196
}
186
197
 
187
 
void flip_remove(unsigned int unit, char *image)
 
198
void fliplist_remove(unsigned int unit, char *image)
188
199
{
189
200
    struct fliplist_t *tmp;
190
201
 
215
226
 
216
227
        if (strcmp(it->image, image) == 0) {
217
228
            /* it's the head */
218
 
            flip_remove(unit, NULL);
 
229
            fliplist_remove(unit, NULL);
219
230
            return;
220
231
        }
221
232
        it = it->next;
238
249
    }
239
250
}
240
251
 
241
 
void flip_attach_head (unsigned int unit, int direction)
 
252
void fliplist_attach_head (unsigned int unit, int direction)
242
253
{
243
254
    if (fliplist[unit - 8] == (struct fliplist_t *)NULL)
244
255
        return;
255
266
    }
256
267
}
257
268
 
258
 
void *flip_init_iterate(unsigned int unit)
 
269
void *fliplist_init_iterate(unsigned int unit)
259
270
{
260
271
    void *ret = NULL;
261
272
 
267
278
    return ret;
268
279
}
269
280
 
270
 
void *flip_next_iterate(unsigned int unit)
 
281
void *fliplist_next_iterate(unsigned int unit)
271
282
{
272
283
    void *ret = NULL;
273
284
 
280
291
    return ret;
281
292
}
282
293
 
283
 
void flip_clear_list(unsigned int unit)
 
294
void fliplist_clear_list(unsigned int unit)
284
295
{
285
296
    struct fliplist_t *flip = fliplist[unit - 8];
286
297
 
298
309
    }
299
310
}
300
311
 
301
 
int flip_save_list(unsigned int unit, const char *filename)
 
312
int fliplist_save_list(unsigned int unit, const char *filename)
302
313
{
303
314
    int all_units = 0;
304
315
    struct fliplist_t *flip;
335
346
    return 0;
336
347
}
337
348
 
338
 
int flip_load_list(unsigned int unit, const char *filename, int autoattach)
 
349
int fliplist_load_list(unsigned int unit, const char *filename, int autoattach)
339
350
{
340
351
    FILE *fp;
341
352
    char buffer[buffer_size];
342
353
    int all_units = 0, i;
343
354
 
344
 
    if (filename == NULL || (fp = fopen(filename, MODE_READ)) == NULL)
 
355
    if (filename == NULL || *filename == 0 || (fp = fopen(filename, MODE_READ)) == NULL)
345
356
        return -1;
346
357
 
347
358
    buffer[0] = '\0';
355
366
    if (unit == (unsigned int)-1) {
356
367
        all_units = 1;
357
368
        for (i = 0; i < NUM_DRIVES; i++)
358
 
            flip_clear_list(i+8);
 
369
            fliplist_clear_list(i+8);
359
370
    }
360
371
    else
361
 
        flip_clear_list(unit);
 
372
        fliplist_clear_list(unit);
362
373
 
363
374
    while (!feof(fp)) {
364
375
        char *b;
422
433
 
423
434
 
424
435
    if (autoattach)
425
 
        flip_attach_head(unit, 1);
 
436
        fliplist_attach_head(unit, 1);
426
437
 
427
438
    return 0;
428
439
}