Browse Source

* src/devices/dev.c, src/devices/dev.h: Added first_device()


			
			
				pre-master-46
			
			
		
arno 26 years ago
parent
commit
f1953e2885
  1. 6
      ChangeLog
  2. 29
      src/spicelib/devices/dev.c
  3. 3
      src/spicelib/devices/dev.h

6
ChangeLog

@ -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

29
src/spicelib/devices/dev.c

@ -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;
}

3
src/spicelib/devices/dev.h

@ -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…
Cancel
Save