Last change
on this file was
81,
checked in by rosiere, 17 years ago
|
- Finish Environment (and test)
- Continue predictor_unit
- Add external tools
- svn keyword "Id" set
|
-
Property svn:keywords set to
Id
|
File size:
1.7 KB
|
Line | |
---|
1 | #include "../include/Sim2OS.h" |
---|
2 | |
---|
3 | namespace environment { |
---|
4 | namespace sim2os { |
---|
5 | |
---|
6 | void * Sim2OS::execute (service_t num) |
---|
7 | { |
---|
8 | num_service = num; |
---|
9 | |
---|
10 | return execute(); |
---|
11 | } |
---|
12 | |
---|
13 | /* |
---|
14 | * execute the service with all |
---|
15 | * the list of arg must be finish by "NULL" |
---|
16 | * also the list can't have a NULL as param |
---|
17 | */ |
---|
18 | void * Sim2OS::execute (service_t num, void * arg, ...) |
---|
19 | { |
---|
20 | num_service = num; |
---|
21 | |
---|
22 | va_list ap; |
---|
23 | va_start (ap,arg); |
---|
24 | uint32_t it = 1; |
---|
25 | while (arg != NULL) |
---|
26 | { |
---|
27 | arguments[it] = arg; |
---|
28 | it ++; |
---|
29 | arg = va_arg(ap,void *); |
---|
30 | } |
---|
31 | |
---|
32 | va_end(ap); |
---|
33 | return execute(); |
---|
34 | } |
---|
35 | |
---|
36 | /* |
---|
37 | * execute the service without argument |
---|
38 | */ |
---|
39 | void * Sim2OS::execute () |
---|
40 | { |
---|
41 | result = NULL; |
---|
42 | |
---|
43 | switch (num_service) |
---|
44 | { |
---|
45 | case SERVICE_OPEN : {result = service_open (); break;} |
---|
46 | case SERVICE_CLOSE : {result = service_close (); break;} |
---|
47 | case SERVICE_READ : {result = service_read (); break;} |
---|
48 | case SERVICE_WRITE : {result = service_write (); break;} |
---|
49 | case SERVICE_TIME : {result = service_time (); break;} |
---|
50 | case SERVICE_CLOCK : {result = service_clock (); break;} |
---|
51 | case SERVICE_LSEEK : {result = service_lseek (); break;} |
---|
52 | case SERVICE_UNIMPLEMENTED : |
---|
53 | { |
---|
54 | std::cerr << "<" << name << "> service Unimplemented : " << num_service << std::endl; |
---|
55 | break; |
---|
56 | } |
---|
57 | |
---|
58 | case SERVICE_UNDEFINED : |
---|
59 | default : |
---|
60 | { |
---|
61 | std::cerr << "<" << name << "> service Undefine : " << num_service << std::endl; |
---|
62 | break; |
---|
63 | } |
---|
64 | }//end switch |
---|
65 | |
---|
66 | // Erase all elt; |
---|
67 | num_service = SERVICE_UNDEFINED; |
---|
68 | arguments.erase(arguments.begin(),arguments.end()); |
---|
69 | return result; |
---|
70 | }; |
---|
71 | }; |
---|
72 | }; |
---|
Note: See
TracBrowser
for help on using the repository browser.