325 Commits

Author SHA1 Message Date
Southclaws
a47bd9de76
Merge pull request #240 from Daniel-Cortez/ht-patch
New hashtable implementation
2018-01-07 12:45:40 +00:00
Zeex
76507598f8 Refactor #warning and #pragma deprecated 2018-01-07 12:14:58 +06:00
Zeex
3c6be803d7 Fix errline not being reset after it's set to symbol line
Fixes #230.
2018-01-07 12:14:55 +06:00
Daniel_Cortez
d514b99760 Fix a type conversion warning 2018-01-07 04:21:13 +07:00
Daniel_Cortez
acf06a5e40 hashtable.h: Add compatibility with VS10 and MinGW, remove trailing whitespaces 2018-01-07 02:35:50 +07:00
Daniel_Cortez
8b3583e7b5 Replace the hashmap implementation with a hashtable by Mattias Gustavsson 2018-01-07 02:35:08 +07:00
Daniel_Cortez
20226dd566 pawndisasm: Fix 'switch' argument 2018-01-06 18:31:01 +07:00
Zeex
6d65605bb0 Decrease initial size of symbol cache hash table
Using 2^23 allocates 128MB memory for the hash table. Seems like
a waste of memory, especially for small scripts.

For example, I didn't notice a huge difference in time between 1000
and the old number when compiling most of YSI includes and tests.
Hash tables double in size when they need more space, it's pretty
efficient (at least this implementation does so).
2018-01-06 10:18:47 +06:00
Zeex
c4e15a032a Remove /J from MSVC compile flags
https://msdn.microsoft.com/en-us/library/0d294k5z.aspx

It looks like we don't need it. The 'char' type is signed on other
platforms, so why should it be unsigned on Windows? Besides, its
includion in add_definitions() prevented RC from compiling libpawn.rc
with Visual Studio 2017's CMake tools.
2018-01-05 19:48:45 +06:00
Zeex
97586a750e Add test for #220 2018-01-05 05:51:02 +06:00
Zeex
64563ff994
Merge pull request #225 from YashasSamaga/i220-fix
replaces dangling pointers in initarray with indexes
2018-01-05 05:49:34 +06:00
Zeex
12abb0bbf2 Add test *.amx to .gitignore and update .editorconfig for *.pwn 2018-01-04 19:10:59 +06:00
Zeex
c325ca3e02 Implement more straightforward line continuation ('\\') behavior
* Allow line continuation in single line comments

  Other languages allow this:

  // this is totally a single \
  line comment

  For example C++, at least GCC, Visual C++. I don't see why it
  should be forbidden.

* Don't insert \a symbols to mark

  Because we now don't need to check if there are '\\' in comments
  we no longer have to mark their positions with '\a' symbols.

* Don't trim leading space after '\\'

  Again, this is how other languages do it and it seems to be more
  intuitive. If you don't want spaces just don't indent your lines.

  new s[] = "see \
  this?"
2018-01-04 17:38:13 +06:00
Yashas
9a49ac51b2
stop removing '\a (internal multi-line delimiter)
This reverts a part of 693591bdc3 which caused issues as described in #226.
2018-01-03 18:09:54 +05:30
Yashas
19a8bfd1f3
replaces dangling pointers in initarray with indexes
In `initarray`, `prev1` and `prev2` are dangling pointers. When assigned, they point to an address of an item in the literal queue. The compiler checks the literal queue size before adding an element. If the size isn't sufficient to hold another element, it reallocates the literal queue to accommodate more items. When the reallocation happens, the previous references (`prev1` and `prev2`) to the elements of the literal queue are invalidated. De-referencing the broken pointers will cause undefined behavior.

This commit replaces the pointers with indexes. The indexes are invariant to the reallocation.
2017-12-31 18:30:06 +05:30
Zeex
7ea961990c v3.10.6 2017-12-31 18:43:32 +06:00
Zeex
4d1a3a99f7 Revert "Merge pull request #205 from VVWVV/concat_op"
This reverts commit 82dd745f90b9447ac2f196c31642660a7488453f, reversing
changes made to 2a930cedde954831eebee1a221a297e1019cb4df.
2017-12-31 18:27:58 +06:00
Zeex
4db5ecba41 v3.10.5 2017-12-31 01:31:00 +06:00
Zeex
047fdbba3b Fix strlcpy/strlcat error on macOS 2017-12-30 22:14:27 +06:00
Zeex
a90969b6c3 Attempt to fix strlcpy/strlcat error on Travis CI 2017-12-30 19:52:01 +06:00
Zeex
7414a56d7f Fix CMake warning regarding use of @rpath on macOS
CMake Warning (dev):
  Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run "cmake
  --help-policy CMP0042" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  MACOSX_RPATH is not specified for the following targets:

   pawnc

This warning is for project developers.  Use -Wno-dev to suppress it.
2017-12-30 19:37:25 +06:00
Zeex
8847c300f1 Fix compile warnings in pawndisasm 2017-12-30 19:26:48 +06:00
Zeex
8fe5558d7e Remove amx.c from pawndisasm's sources
We don't need the whole AMX in order to compile pawndisasm, only a handful of
alignment functions (amx_AlignXXX) that are used in amxdbg.c. Just copy those
functions to amxdbg.

As a bonus, we don't have to fix compile warnings in amx.c now. (maybe somebody
will fix them some day in a distant future...)
2017-12-30 19:26:06 +06:00
Zeex
11199da210 Fix compile warnings in pawnc 2017-12-30 16:12:33 +06:00
Zeex
4f12093788 Update macOS package name (darwin -> macos) 2017-12-30 15:30:25 +06:00
Zeex
82dd745f90
Merge pull request #205 from VVWVV/concat_op
Tokenisation operator
2017-12-30 15:15:28 +06:00
Zeex
2a930cedde
Merge pull request #201 from Daniel-Cortez/op_dumpn_patch
Slightly improve 'dumpn' write performance
2017-12-30 15:01:31 +06:00
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