mirror of
https://github.com/open-simh/simtools.git
synced 2026-01-28 12:58:43 +00:00
First step in the support of multiple formats of macro (or object) libraries.
No test included since I don't have a distributable RSX .MLB file available at this time.
This commit is contained in:
49
mlb2.c
Normal file
49
mlb2.c
Normal file
@@ -0,0 +1,49 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "mlb.h"
|
||||
|
||||
MLB_VTBL *mlb_vtbls[] = {
|
||||
&mlb_rsx_vtbl,
|
||||
NULL
|
||||
};
|
||||
|
||||
MLB *mlb_open(
|
||||
char *name,
|
||||
int allow_object_library)
|
||||
{
|
||||
MLB_VTBL *vtbl;
|
||||
MLB *mlb = NULL;
|
||||
int i;
|
||||
|
||||
for (i = 0; (vtbl = mlb_vtbls[i]); i++) {
|
||||
mlb = vtbl->mlb_open(name, allow_object_library);
|
||||
if (mlb != NULL) {
|
||||
mlb->name = strdup(name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return mlb;
|
||||
}
|
||||
|
||||
BUFFER *mlb_entry(
|
||||
MLB *mlb,
|
||||
char *name)
|
||||
{
|
||||
return mlb->vtbl->mlb_entry(mlb, name);
|
||||
}
|
||||
|
||||
void mlb_close(
|
||||
MLB *mlb)
|
||||
{
|
||||
free(mlb->name);
|
||||
mlb->vtbl->mlb_close(mlb);
|
||||
}
|
||||
|
||||
void mlb_extract(
|
||||
MLB *mlb)
|
||||
{
|
||||
mlb->vtbl->mlb_extract(mlb);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user