scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

getindex.c (442B)


      1 #include <errno.h>
      2 #include <stdio.h>
      3 
      4 #include <scc/mach.h>
      5 
      6 #include "libmach.h"
      7 
      8 #include "elf/fun.h"
      9 #include "coff32/fun.h"
     10 
     11 static int (*ops[NFORMATS])(long *, char ***, long **, FILE *) = {
     12 	[COFF32] = coff32getidx,
     13 };
     14 
     15 int
     16 getindex(int type, long *nsyms, char ***names, long **offs, FILE *fp)
     17 {
     18 	int fmt;
     19 
     20 	fmt = FORMAT(type);
     21 	if (fmt >= NFORMATS) {
     22 		errno = ERANGE;
     23 		return -1;
     24 	}
     25 
     26 	return (*ops[fmt])(nsyms, names, offs, fp);
     27 }
     28