ps2sdk  1.1
A collection of Open Source libraries used for developing applications on Sony's PlayStation 2® (PS2).
erl-loader.c File Reference
#include <string.h>
#include <erl.h>
+ Include dependency graph for erl-loader.c:

Go to the source code of this file.

Data Structures

struct  export_list_t
 

Typedefs

typedef void(* func_t) (void)
 

Functions

static void parse_boot_path (int argc, char **argv)
 
static void export_symbols ()
 
int main (int argc, char **argv)
 

Variables

struct export_list_t export_list []
 
static char * prohibit_list []
 

Typedef Documentation

◆ func_t

typedef void(* func_t) (void)

Definition at line 67 of file erl-loader.c.

Function Documentation

◆ export_symbols()

static void export_symbols ( )
static

Definition at line 50 of file erl-loader.c.

50  {
51  struct export_list_t * p;
52  int i, prohibit;
53 
54  for (p = export_list; p->name; p++) {
55  prohibit = 0;
56  for (i = 0; prohibit_list[i]; i++) {
57  if (!(strcmp(prohibit_list[i], p->name))) {
58  prohibit = 1;
59  break;
60  }
61  }
62  if (!prohibit)
64  }
65 }
static char * prohibit_list[]
Definition: erl-loader.c:44
struct export_list_t export_list[]
int erl_add_global_symbol(const char *symbol, u32 address)
Definition: erl.c:574
void * pointer
Definition: dummy-exports.c:3
unsigned int u32
Definition: tamtypes.h:30

References erl_add_global_symbol(), export_list, export_list_t::name, export_list_t::pointer, and prohibit_list.

Referenced by main().

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 69 of file erl-loader.c.

69  {
70  struct symbol_t * s;
71  int i;
72 
73  parse_boot_path(argc, argv);
74 
76 
77  if (argc >= 2) {
78  for (i = 1; i < argc; i++) {
79  _init_load_erl_from_file(argv[i], 0);
80  }
81  } else {
82  _init_load_erl_from_file("main.erl", 0);
83  }
84 
85  if ((s = erl_find_symbol("main"))) {
86  ((func_t) s->address)();
87  }
88 
89  return 0;
90 }
void(* func_t)(void)
Definition: erl-loader.c:67
static void parse_boot_path(int argc, char **argv)
Definition: erl-loader.c:21
static void export_symbols()
Definition: erl-loader.c:50
struct symbol_t * erl_find_symbol(const char *symbol)
Definition: erl.c:443
struct erl_record_t * _init_load_erl_from_file(const char *fname, char *erl_id)
Definition: erl.c:1012
s32 s
Definition: ps2ipc.c:30
Definition: erl.h:42

References _init_load_erl_from_file(), erl_find_symbol(), export_symbols(), parse_boot_path(), and s.

◆ parse_boot_path()

static void parse_boot_path ( int  argc,
char **  argv 
)
static

Definition at line 21 of file erl-loader.c.

21  {
22  char * p;
23 
24  if (argc == 0) // Are people still using naplink ? :P
25  strcpy(_init_erl_prefix, "host:");
26 
27  strcpy(_init_erl_prefix, argv[0]);
28 
29  p = strrchr(_init_erl_prefix, '/');
30 
31  if (!p)
32  p = strrchr(_init_erl_prefix, '\\');
33 
34  if (!p)
35  p = strrchr(_init_erl_prefix, ':');
36 
37  if (!p)
38  return;
39 
40  *(++p) = 0;
42 }
char _init_erl_prefix[]
Definition: erl.c:281

References _init_erl_prefix.

Referenced by main().

Variable Documentation

◆ export_list

struct export_list_t export_list[]

Referenced by export_symbols().

◆ prohibit_list

char* prohibit_list[]
static
Initial value:
= {
"_edata", "_end", "_end_bss", "_fbss", "_fdata", "_fini",
"_ftext", "_gp", "_init", "main",
0
}

Definition at line 44 of file erl-loader.c.

Referenced by export_symbols().