239 Commits

Author SHA1 Message Date
Zeex
064d35256b
Merge pull request #211 from Daniel-Cortez/emit_op_fixes
Fixes and improvements for emit/__emit
2017-12-30 15:00:52 +06:00
Zeex
0533717bd6
Merge pull request #215 from Daniel-Cortez/lbl_redef_fix
Do not allow to redefine labels
2017-12-17 13:57:33 +06:00
Daniel_Cortez
939c06011d emit/__emit: Another syntax change 2017-12-10 03:51:19 +07:00
Daniel_Cortez
54fd3aee3a emit/__emit: Add fallbacks for the other macro opcodes 2017-12-06 22:39:37 +07:00
Daniel_Cortez
9fbe72ee7a emit/__emit: Implement compatibility fallbacks for 'sysreq.c' and 'sysreq.n' 2017-12-06 21:52:51 +07:00
Daniel_Cortez
d5691209d6 emit/__emit: Move the "anti-optimisation" workaround to 'emit_parse_line()'
Conflicts:
	source/compiler/sc1.c
2017-12-06 21:52:51 +07:00
Daniel_Cortez
59428b0c39 emit/__emit: Code cleanup, misc. adjustments 2017-12-06 17:42:30 +07:00
Daniel_Cortez
c77b0f1bdd emit/__emit: Verify the arguments for 'sysreq.c' and 'sysreq.n' 2017-12-06 17:42:26 +07:00
Daniel_Cortez
bd01c04def emit/__emit: Fix argument type for 'addr.pri/alt' 2017-12-04 22:43:40 +07:00
Daniel_Cortez
5f716b7f62 emit/__emit: Don't allow to use labels as arguments of type 'numeric value', 'data offset', 'local variable' and 'function' 2017-12-04 21:38:09 +07:00
Daniel_Cortez
e922e48aa6 emit/__emit: Fix incorrect code generation 2017-12-04 18:24:32 +07:00
Daniel_Cortez
fab8c53db0 emit/__emit: Allow the use of constant expressions as opcode arguments 2017-12-03 21:27:16 +07:00
Daniel_Cortez
401b29f464 Do not allow to redefine the same label 2017-12-02 20:16:45 +07:00
Daniel_Cortez
873060e7e8 emit/__emit: Do not allow to redefine the same label 2017-12-02 20:12:20 +07:00
Daniel_Cortez
907c4b610e emit/__emit: Syntax change 2017-11-29 21:52:05 +07:00
Daniel_Cortez
afc829977e emit/__emit: Add support for 'lctrl 8/9' and 'sctrl 8/9' 2017-11-23 22:41:14 +07:00
Daniel_Cortez
23ab402763 emit/__emit: Fix argument handling in 'const.s' 2017-11-19 16:17:20 +07:00
Daniel_Cortez
40bf47c6b5 emit/__emit: Allow direct use of opcode 'casetbl' 2017-11-19 02:44:45 +07:00
Daniel_Cortez
b52e32d1bc emit/__emit: Move 'fetchlab()' closer to 'dogoto()' and 'dolabel()' 2017-11-19 02:44:45 +07:00
Daniel_Cortez
7f9be67497 emit/__emit: Change the argument order in 'outinstr()'
Now the function takes the array itself before the array size, as the argument handlers in sc1.c do.
2017-11-18 23:43:32 +07:00
Daniel_Cortez
60ca0009f3 emit/__emit: Also check the arguments of 'lctrl' and 'sctrl' 2017-11-18 01:37:03 +07:00
Daniel_Cortez
15e53272af emit/__emit: Allow named constants with 'lodb.i' and 'strb.i' 2017-11-18 01:37:03 +07:00
Daniel_Cortez
98817bf8f8 emit/__emit: Code cleanup, minor fixes 2017-11-18 01:37:02 +07:00
Daniel_Cortez
5c0d45aab3 emit/__emit: emit_param_data(): make sure the argument is not a function 2017-11-18 01:37:02 +07:00
Daniel_Cortez
5eb18c4eec emit/__emit: Allow for leading '-' to negate symbol values in emit_param_num()
Now it should be possible to do this:
    const SOME_VAL = 1;
    emit const.pri -SOME_VAL

or this:
    static some_array[] = { 0, 1, 2, 3, 4, 5 };
    static some_var;
    emit { const.pri some_var };
    new some_var_offset = emit { add.c -some_array };
2017-11-18 01:37:02 +07:00
Daniel_Cortez
912376b658 emit/__emit: Check if the argument of instruction 'call' is a Pawn function 2017-11-17 20:03:50 +07:00
Daniel_Cortez
abe9c965dc emit/__emit: Make type mismatch errors more informative
Example:
    main()
    {
        new x;
        emit load.pri x
    }
Before this commit:
    error 017: undefined symbol "x"
After:
    error 001: expected token: "-data offset-", but found "-local variable-"
2017-11-17 20:03:50 +07:00
Daniel_Cortez
c58fce34cb emit/__emit: New argument type: local variable (name or offset) 2017-11-14 19:36:12 +07:00
Daniel_Cortez
e55f6a213a emit/__emit: Minor adjustments 2017-11-14 19:36:11 +07:00
Daniel_Cortez
c14186a48f emit/__emit: Fix 'need_token' argument being unused in emit_invalid_token() 2017-11-14 19:36:11 +07:00
Daniel_Cortez
cccf0f1674 emit/__emit: Remove check_empty() from sc1.c
It was copied from sc2.c with a check for a trailing '}' added and was too specific to be reused anywhere else.
2017-11-13 22:52:33 +07:00
Daniel_Cortez
d788eeaeb8 emit/__emit: Make 'switch', 'casetbl' and 'case' generate valid code
This changes the way 'switch', 'casetbl' and 'case' are handled; now 'casetbl' can't be used directly and the arguments for the first case table entry (the number of entries and 'default' label) are specified to 'switch'.
Example:
    emit
    {
        load.s.pri my_var
        switch 3 lbl_deafult
        case 0 lbl_0
        case 2 lbl_2
        case 4 lbl_4
    }
2017-11-13 21:09:46 +07:00
Daniel_Cortez
b726f44a02 emit/__emit: Simplify the code in emit_parm1_lbl() and emit_do_case() 2017-11-12 22:54:21 +07:00
Daniel_Cortez
f5cbeb010b emit/__emit: Remove excess sc_tokens declarations, fix cell*/ucell* argument type mismatch 2017-11-12 22:54:21 +07:00
Daniel_Cortez
69b552c90d emit/__emit: Simplify the code in emit_parm2_gvar_num() 2017-11-12 20:42:19 +07:00
Daniel_Cortez
35fb9e8393 emit/__emit: Remove excess instruction name passing to emit_param_num() & emit_param_data() 2017-11-12 20:42:19 +07:00
Daniel_Cortez
d4af23b5de emit/__emit: Allow local constants to be used as data addresses in emit_param_data() 2017-11-12 19:44:52 +07:00
Daniel_Cortez
f921451c8a emit/__emit: Fix multiple occurences of NULL pointer dereference 2017-11-12 19:44:51 +07:00
VVWVV
7440670150 fix params for data seg.
Conflicts:
	source/compiler/sc1.c
2017-11-12 19:44:51 +07:00
Daniel_Cortez
eb5ee448e5 emit/__emit: Use case-sensitive search in emit_findopcode()
The instruction name is copied in lower case anyway (see emit_parse_line()).
2017-11-11 20:50:08 +07:00
Daniel_Cortez
af31143ec3 emit/__emit: Avoid excess instruction name copying in emit_findopcode() 2017-11-11 20:50:07 +07:00
Daniel_Cortez
06feab9224 emit/__emit: Code cleanup 2017-11-11 20:50:07 +07:00
Daniel_Cortez
2492d4793b emit/__emit: Set the sign bit properly on non-32-bit cells 2017-11-11 20:50:06 +07:00
Daniel_Cortez
4fc7ef863a emit/__emit: Use 'tFIRST' instead of hardcoded '256' 2017-11-11 20:50:06 +07:00
Y_Less
f71d55d380 Allow #pragma option -c####. 2017-10-28 14:53:59 +02:00
Y_Less
0f86097c99 Was actually ignoring #pragma option options. 2017-10-28 14:48:26 +02:00
Y_Less
6060ce0ac8 Merge branch 'master' of github.com:Zeex/pawn 2017-10-28 14:40:58 +02:00
Zeex
735291fd64 Merge branch 'performance' 2017-10-28 05:18:36 +06:00
Y_Less
b7692fda79 #pragma option 2017-10-26 11:41:33 +02:00
Y_Less
f1da832ae9 -E warnings as errors. 2017-10-24 21:18:07 +02:00