* src/devices/dev.c, src/devices/dev.h: Added first_device()
and next_device() to abstract manipulations to the devices list. Now change all the code that uses direct access to these functions...
This commit is contained in:
parent
fe8d08d0a9
commit
f1953e2885
|
|
@ -1,3 +1,9 @@
|
|||
2000-07-05 Arno W. Peters <A.W.Peters@ieee.org>
|
||||
|
||||
* src/devices/dev.c: Added first_device() and next_device() to
|
||||
abstract manipulations to the devices list. Now change all the
|
||||
code that uses direct access to these functions...
|
||||
|
||||
2000-07-03 Arno W. Peters <A.W.Peters@ieee.org>
|
||||
|
||||
* src/parser/alias.c, src/parser/alias.h: contain frontend alias
|
||||
|
|
|
|||
|
|
@ -158,14 +158,43 @@ num_devices(void)
|
|||
return sizeof(DEVices)/sizeof(SPICEdev *);
|
||||
}
|
||||
|
||||
|
||||
IFdevice **
|
||||
devices_ptr(void)
|
||||
{
|
||||
return (IFdevice **) DEVices;
|
||||
}
|
||||
|
||||
|
||||
SPICEdev **
|
||||
devices(void)
|
||||
{
|
||||
return DEVices;
|
||||
}
|
||||
|
||||
|
||||
/* Returns the first device in the list, or NULL if the list is empty */
|
||||
SPICEdev *
|
||||
first_device(void)
|
||||
{
|
||||
return DEVices[0];
|
||||
}
|
||||
|
||||
|
||||
/* Returns the next device on the list, or NULL if no more devices
|
||||
left. */
|
||||
SPICEdev *
|
||||
next_device(SPICEdev *current)
|
||||
{
|
||||
SPICEdev *ret;
|
||||
int index;
|
||||
|
||||
index = (current - first_device()) / sizeof(SPICEdev *);
|
||||
if (index < num_devices()) {
|
||||
ret = DEVices[index + 1];
|
||||
} else {
|
||||
ret = NULL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
#ifndef _DEV_H
|
||||
#define _DEV_H
|
||||
|
||||
|
||||
int num_devices(void);
|
||||
IFdevice **devices_ptr(void);
|
||||
SPICEdev **devices(void);
|
||||
SPICEdev *first_device(void);
|
||||
SPICEdev *next_device(SPICEdev *current);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue