|
1 /* |
|
2 * Copyright (c) 1999 - 2001 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 $Workfile: scr_fcns.h $ |
|
20 |
|
21 Purpose: |
|
22 This file is used by the scr_fcns.c. It defines both the function structure |
|
23 and the function pool structure as well as the function prototype used by |
|
24 the function pool. |
|
25 |
|
26 */ |
|
27 |
|
28 #ifndef SCR_FUNCTIONS_H |
|
29 #define SCR_FUNCTIONS_H |
|
30 |
|
31 #include "scr_defs.h" |
|
32 |
|
33 typedef struct { |
|
34 NW_Byte nbr_of_args; /* no of args */ |
|
35 NW_Byte nbr_of_local_vars; /* no of total local vars, including args !!! */ |
|
36 NW_Uint16 code_size; |
|
37 NW_Byte *code; |
|
38 } function_t; |
|
39 |
|
40 |
|
41 typedef struct { |
|
42 function_t **funcs; |
|
43 NW_Int32 capacity; |
|
44 NW_Int32 size; |
|
45 } funcpool_t; |
|
46 |
|
47 typedef struct { |
|
48 NW_Byte index; |
|
49 NW_Ucs2 *name; |
|
50 } fname_t; |
|
51 |
|
52 typedef struct { |
|
53 fname_t *names; |
|
54 NW_Int32 capacity; |
|
55 NW_Int32 size; |
|
56 } fname_table_t; |
|
57 |
|
58 void add_fname(NW_Byte index, NW_Ucs2 *name); |
|
59 void add_func_fp(function_t *f); |
|
60 NW_Bool create_func_pool(NW_Int32 c) ; |
|
61 NW_Bool create_fname_table(NW_Int32 c); |
|
62 |
|
63 NW_Byte no_of_args(function_t *f); |
|
64 NW_Byte no_of_local_vars(function_t *f); |
|
65 NW_Uint16 get_code_size(function_t *f); |
|
66 |
|
67 |
|
68 NW_Bool fu_get_opcode(NW_Byte func_index, NW_Uint16 offset, NW_Byte *b); |
|
69 function_t *get_func(NW_Int32 funcIndex); |
|
70 |
|
71 NW_Bool fname_find_function_index(fname_table_t *fn_table, NW_Ucs2 *fname, NW_Byte *index); |
|
72 |
|
73 void free_funcpool(funcpool_t *fp); |
|
74 void free_fname_table(fname_table_t *fn_table); |
|
75 |
|
76 NW_Bool valid_func_index(NW_Int32 index); |
|
77 |
|
78 #endif /*SCR_FUNCTIONS_H*/ |