getindex.c - scc - simple c99 compiler
 (HTM) git clone git://git.simple-cc.org/scc
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Submodules
 (DIR) README
 (DIR) 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