remove output from lexer, fixes

This commit is contained in:
e.gavrin
2014-07-04 17:11:06 +04:00
parent e4122522ae
commit e3e0167249
7 changed files with 59 additions and 40 deletions
+13 -5
View File
@@ -24,6 +24,15 @@ SOURCES = \
$(wildcard ./src/libecmaobjects/*.c) \
$(wildcard ./src/liballocator/*.c) \
$(wildcard ./src/libcoreint/*.c) )
HEADERS = \
$(sort \
$(wildcard ./src/*.h) \
$(wildcard ./src/libperipherals/*.h) \
$(wildcard ./src/libjsparser/*.h) \
$(wildcard ./src/libecmaobjects/*.h) \
$(wildcard ./src/liballocator/*.h) \
$(wildcard ./src/libcoreint/*.h) )
INCLUDES = \
-I src \
@@ -66,7 +75,7 @@ RELEASE_OPTIONS = -Os -Werror
DEFINES = -DMEM_HEAP_CHUNK_SIZE=256 -DMEM_HEAP_AREA_SIZE=32768
.PHONY: all debug release clean install test
.PHONY: all debug release clean check install
all: debug
@@ -86,12 +95,11 @@ clean:
rm -f $(TARGET).map
rm -f $(TARGET).hex
rm -f $(TARGET).lst
rm -f jerry.error js.files
check:
cppcheck ./src/ --enable=all --std=c99 -v
cppcheck $(HEADERS) $(SOURCES) --enable=all --std=c99
./tools/jerry_test.sh
install:
st-flash write $(TARGET).bin 0x08000000
test:
./tools/jerry_test.sh
+1
View File
@@ -5,6 +5,7 @@
when the body is not a string literal.
- Limit Unicode support
- Cut Number from 64bit to 32bit/16/8bit
- Limit recursion level
- Do not allow addition, deletion or assignment to the properties of built-in
objects.
This limitation is needed to support a more efficient implementation based
+17 -11
View File
@@ -59,7 +59,7 @@ typedef signed int int32_t;
/**
* Variable that must not be referenced.
*
*
* May be used for static assertion checks.
*/
extern uint32_t jerry_UnreferencedExpression;
@@ -87,14 +87,14 @@ extern uint32_t jerry_UnreferencedExpression;
/**
* Aligns @value to @alignment.
*
*
* Returns maximum positive value, that divides @alignment and is less than or equal to @value
*/
#define JERRY_ALIGNDOWN( value, alignment) ( (alignment) * ( (value) / (alignment) ) )
/**
* Aligns @value to @alignment.
*
*
* Returns minimum positive value, that divides @alignment and is more than or equal to @value
*/
#define JERRY_ALIGNUP( value, alignment) ( (alignment) * ( ((value) + (alignment) - 1) / (alignment) ) )
@@ -108,19 +108,23 @@ extern uint32_t jerry_UnreferencedExpression;
/**
* Bit-fields
*/
inline uint32_t jerry_ExtractBitField(uint32_t value, uint32_t lsb, uint32_t width);
inline uint32_t jerry_SetBitFieldValue(uint32_t value, uint32_t bitFieldValue, uint32_t lsb, uint32_t width);
inline uint32_t jerry_ExtractBitField(uint32_t value, uint32_t lsb,
uint32_t width);
inline uint32_t jerry_SetBitFieldValue(uint32_t value, uint32_t bitFieldValue,
uint32_t lsb, uint32_t width);
/**
* Extract a bit-field from the integer.
*
*
* @return bit-field's value
*/
inline uint32_t
jerry_ExtractBitField(uint32_t container, /**< container to extract bit-field from */
jerry_ExtractBitField(uint32_t
container, /**< container to extract bit-field from */
uint32_t lsb, /**< least significant bit of the value
* to be extracted */
uint32_t width) /**< width of the bit-field to be extracted */ {
uint32_t width) /**< width of the bit-field to be extracted */
{
JERRY_ASSERT(lsb < JERRY_BITSINBYTE * sizeof (uint32_t));
JERRY_ASSERT((lsb + width) <= JERRY_BITSINBYTE * sizeof (uint32_t));
@@ -132,15 +136,17 @@ jerry_ExtractBitField(uint32_t container, /**< container to extract bit-field fr
/**
* Extract a bit-field from the integer.
*
*
* @return bit-field's value
*/
inline uint32_t
jerry_SetBitFieldValue(uint32_t container, /**< container to insert bit-field to */
jerry_SetBitFieldValue(uint32_t
container, /**< container to insert bit-field to */
uint32_t newBitFieldValue, /**< value of bit-field to insert */
uint32_t lsb, /**< least significant bit of the value
* to be extracted */
uint32_t width) /**< width of the bit-field to be extracted */ {
uint32_t width) /**< width of the bit-field to be extracted */
{
JERRY_ASSERT(lsb < JERRY_BITSINBYTE * sizeof (uint32_t));
JERRY_ASSERT((lsb + width) <= JERRY_BITSINBYTE * sizeof (uint32_t));
JERRY_ASSERT(newBitFieldValue <= (1u << width));
+18 -18
View File
@@ -32,28 +32,28 @@ gen_bytecode (FILE *src_file)
assert (st);
while (st->type != STMT_EOF)
{
pp_statement (st);
//pp_statement (st);
st = parser_parse_statement ();
assert (st);
}
pp_finish ();
//pp_finish ();
FILE *file = fopen (FILE_NAME, "w+b");
OPCODE op0;
save_op_loop_inf (file, op0, 1);
save_op_call_1 (file, op0, 0, LED_GREEN);
save_op_call_1 (file, op0, 0, LED_BLUE);
save_op_call_1 (file, op0, 0, LED_ORANGE);
save_op_call_1 (file, op0, 0, LED_RED);
save_op_call_1 (file, op0, 0, LED_GREEN);
save_op_call_1 (file, op0, 0, LED_BLUE);
save_op_call_1 (file, op0, 0, LED_ORANGE);
save_op_call_1 (file, op0, 0, LED_RED);
save_op_jmp (file, op0, 0);
fclose (file);
// FILE *file = fopen (FILE_NAME, "w+b");
//
// OPCODE op0;
//
// save_op_loop_inf (file, op0, 1);
// save_op_call_1 (file, op0, 0, LED_GREEN);
// save_op_call_1 (file, op0, 0, LED_BLUE);
// save_op_call_1 (file, op0, 0, LED_ORANGE);
// save_op_call_1 (file, op0, 0, LED_RED);
// save_op_call_1 (file, op0, 0, LED_GREEN);
// save_op_call_1 (file, op0, 0, LED_BLUE);
// save_op_call_1 (file, op0, 0, LED_ORANGE);
// save_op_call_1 (file, op0, 0, LED_RED);
// save_op_jmp (file, op0, 0);
//
// fclose (file);
}
void
+8 -4
View File
@@ -39,9 +39,12 @@ OP_DEF (jmp)
OP_DEF (decl) { };
OP_DEF (named_func_decl) { };
OP_DEF (decl_func_named)
{
OP_TYPE_IDX name_literal_idx;
};
OP_DEF (anon_func_decl) { };
OP_DEF (decl_func_anon) { };
OP_DEF (decl_var_global) { };
@@ -108,10 +111,11 @@ union __opdata
OP (nop);
} data;
OPCODE {
OPCODE{
opfunc opfunc_ptr;
union __opdata data;
} __packed;
}
__packed;
void save_op_jmp (FILE *, OPCODE, int);
void save_op_call_1 (FILE *, OPCODE, int, int);
+1 -1
View File
@@ -793,5 +793,5 @@ lexer_save_token (token tok)
void
lexer_dump_buffer_state ()
{
printf ("%s\n", buffer);
//printf ("%s\n", buffer);
}
+1 -1
View File
@@ -73,7 +73,7 @@ main (int argc, char **argv)
//gen_bytecode (generated_source);
gen_bytecode (file);
run_int ();
//run_int ();
#ifdef __TARGET_MCU
fake_exit ();