• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
3  * Description: Definition of header file for generating bytecode.
4  * Create: 2020/09/07
5  */
6 
7 #ifndef GENERATE_BYTECODE_H
8 #define GENERATE_BYTECODE_H
9 
10 #ifdef __cplusplus
11 extern "C"
12 {
13 #endif /* __cplusplus */
14 
15 #ifdef JERRY_FOR_IAR_CONFIG
16 
17 #include "jerryscript.h"
18 #include "jerry-snapshot.h"
19 
20 typedef enum {
21   EXCE_ACE_JERRY_EXEC_OK = 0, // program function OK
22   EXCE_ACE_JERRY_NULL_PATH, // null path for generateing snapshot
23   EXCE_ACE_JERRY_MALLOC_ERROR, // error when malloc
24   EXCE_ACE_JERRY_INPUT_PATH_ERROR, // passed input path is NULL OR open failed
25   EXCE_ACE_JERRY_INPUT_PATH_NOT_DIR, // passed input path is not a directory
26   EXCE_ACE_JERRY_OPEN_DIR_FAILED, // open directory failed
27   EXCE_ACE_JERRY_GENERATE_SNAPSHOT_FAILED, // jerry_generate_snapshot failed
28   EXCE_ACE_JERRY_OPEN_FILE_FAILED, // open file failed
29   EXCE_ACE_JERRY_WRITE_SNAPSHOT_FILE_FAILED, // write into snapshot file failed
30   EXCE_ACE_JERRY_READ_FILE_FAILED, // read .js file or snapshot file process failed
31   EXCE_ACE_JERRY_FILE_TOO_LARGE, // bytes of js or snapshot file out of psRAM buffer size for them
32   EXCE_ACE_JERRY_SPLICE_PATH_ERROR, // error when splice path
33   EXCE_ACE_JERRY_SPLICE_OUTPUT_PATH_ERROR, // error when splice output file abs name
34   EXCE_ACE_JERRY_SPRINTFS_VERSION_ERROR, // error when sprintf_s for jerry_version
35   EXCE_ACE_JERRY_GET_FILE_STAT_ERROR, // error when getting file stat
36   EXCE_ACE_JERRY_LINKLIST_ERROR, // error when malloc for list node
37   EXCE_ACE_JERRY_UNLINKFILE_ERROR, // error when unlink bytecode file
38   EXCE_ACE_JERRY_SNAPSHOT_VERSION_ERROR, // snapshot file version wrong
39 } EXECRES;
40 
41 typedef struct
42 {
43   jerry_context_t *context_p;
44 } ContextRecord;
45 
46 char* get_jerry_version_no();
47 EXECRES walk_directory(char* filefolder);
48 EXECRES walk_del_bytecode(char* filefolder);
49 
50 void bms_task_context_init (void);
51 void js_task_context_init (void);
52 void jerry_port_default_remove_current_context_record ();
53 
54 void jerry_external_context_init(uint32_t heap_size, jerry_context_alloc_t alloc, void *cb_data_p);
55 
56 void RefreshAllServiceTimeStamp(void);
57 #endif  // JERRY_FOR_IAR_CONFIG
58 
59 #ifdef __cplusplus
60 }
61 #endif /* __cplusplus */
62 #endif  // GENERATE_BYTECODE_H
63