Commit graph

56 commits

Author SHA1 Message Date
Peter Johnson
e774242fd1 Finish cleanup made in [1948].
svn path=/trunk/yasm/; revision=1951
2007-09-14 05:19:10 +00:00
Peter Johnson
121de99320 Now that part of the build uses just Python, break apart the Python
and Pyrex (only required for bindings) checks.

svn path=/trunk/yasm/; revision=1948
2007-09-13 02:53:30 +00:00
Peter Johnson
23c19a1d52 Unbreak distcheck when Python is available by pulling in bitvect.h.
svn path=/trunk/yasm/; revision=1927
2007-09-07 21:49:35 +00:00
Peter Johnson
36cdd57be2 Add support for second parameter (fill value) to .org directive in GAS
parser.

Add testcase for both local labels and .org fill.

Noticed by: Jung Lee <moorang@gmail.com>
Testcase from: Xiaoming Mo <xiaoming.mo@skelix.org>

svn path=/trunk/yasm/; revision=1899
2007-07-20 03:40:59 +00:00
Peter Johnson
5b88576b82 Pyxelator generation should depend on HEADERS rather than SOURCES.
svn path=/trunk/yasm/; revision=1747
2007-01-29 03:56:37 +00:00
Peter Johnson
ee2c1b181a Clean up sed usage a tiny bit (don't use cat).
svn path=/trunk/yasm/; revision=1746
2007-01-29 03:44:23 +00:00
Peter Johnson
0c344700a7 Massive Python/Pyrex wrapper cleanup. We now use Pyxelator to generate
the C function and data structure wrappers for Pyrex.  We now require
Pyrex 0.9.5 to build the Python wrappers, as only >=0.9.5 has working
weakref support.  We actually need 0.9.5.1, but it's not yet released
(0.9.5 has a crash bug in enum wrapping that we trigger).

Pyxelator works a lot better with non-anonymous enums/structs, so libyasm
has been scrubbed for this.

Next step: full Yasm data structure inspection.

svn path=/trunk/yasm/; revision=1745
2007-01-29 03:32:37 +00:00
Peter Johnson
b31c63e2e0 Make python module DESTDIR-clean to unbreak distcheck when python module is
enabled.

svn path=/trunk/yasm/; revision=1741
2007-01-26 07:39:01 +00:00
Peter Johnson
a1f4c99e94 Remove yasm_immval, moving remaining unique information (sign flag) into
yasm_value.

svn path=/trunk/yasm/; revision=1740
2007-01-21 22:01:34 +00:00
Peter Johnson
9dd8df8fb6 intnum.c: Better internal error checking on intnum creation input strings.
svn path=/trunk/yasm/; revision=1739
2007-01-20 19:37:02 +00:00
Peter Johnson
83b44f17d1 python-yasm/Makefile.inc: Pull in CPPFLAGS for Python build, which on some
systems can have important include directories that aren't in INCLUDES.

svn path=/trunk/yasm/; revision=1726
2006-12-30 05:44:20 +00:00
Peter Johnson
08310a5886 Pyxelator: Rip out code wrapper generation. Reindent. Add yasm wrapper
generator script.  Still needs additional tweaks before it can be tied
into the build.

svn path=/trunk/yasm/; revision=1711
2006-12-12 07:16:45 +00:00
Peter Johnson
c7b267f9fa Bring Pyxelator-r428 into trunk.
svn path=/trunk/yasm/; revision=1710
2006-12-12 07:11:48 +00:00
Peter Johnson
9ab89fdfe6 Take [1423] to the next logical step by supporting the general case of
(sym in other section)-(sym in this section) rather than just
(sym in other section)-(curpos) (e.g. sym-$).  Unfortunately supporting
this required precbc to be flowed down to the value_finalize functions,
but it's relatively reasonable to do so, as all of the _finalize() routines
have access to precbc.

Reported by: Peter Tanski <peter_tanski@cox.net>

svn path=/trunk/yasm/; revision=1705
2006-12-10 07:05:06 +00:00
Peter Johnson
6a6c9faa20 expr.pxi: Sync with [1702].
svn path=/trunk/yasm/; revision=1703
2006-11-27 03:38:36 +00:00
Peter Johnson
827930b5a4 Have incbin search include paths (long-missing feature).
svn path=/trunk/yasm/; revision=1673
2006-10-28 22:06:01 +00:00
Peter Johnson
fd04b1aef6 Don't mix EQU expansion with other expr leveling; we could get confused
with certain combinations.
(2nd half of #83)

This also hides some internals of yasm_expr_level_tree.

svn path=/trunk/yasm/; revision=1655
2006-10-18 05:36:51 +00:00
Peter Johnson
40816b2caf Include test_bytecode.py and test_expr.py in the distribution, as they're
called out by the python test framework.

svn path=/trunk/yasm/; revision=1601
2006-08-10 04:42:09 +00:00
Peter Johnson
9445734d22 In preparation for further work on optimizing multiple, break multiple apart
from bytecode.len into bytecode.mult_int.  Add new function
yasm_bc_next_offset() to handle the most common use case of bytecode.len,
figuring out the following bytecode's offset.

svn path=/branches/new-optimizer/; revision=1586
2006-06-20 06:23:07 +00:00
Peter Johnson
114cee8b06 Implement first phase of align and org.
svn path=/branches/new-optimizer/; revision=1567
2006-06-11 06:57:03 +00:00
Peter Johnson
ad687bb34a Get rid of origin_prevbc; it's no longer needed due to yasm_value handling
of PC-relative values.

Add new yasm_value_get_intnum(); this is a simplified variant of
yasm_value_output_basic().

svn path=/branches/new-optimizer/; revision=1560
2006-06-10 04:01:12 +00:00
Peter Johnson
a7b6526ea4 Get rid of calc_bc_dist_func, the only times this was used was when
yasm_common_calc_bc_dist was used.  Rename yasm_common_calc_bc_dist to
yasm_calc_bc_dist, call it directly from the expr functions, and change
higher-level callers to boolean flags of whether to calculate bc distance
or not.

svn path=/branches/new-optimizer/; revision=1550
2006-06-07 04:01:33 +00:00
Peter Johnson
fe09480565 Fix major bug related to multiple handling. Unfortunately this slows down
bytecode multiple output significantly, but this way handles generating
relocations correctly (otherwise extern foo; times 5 dd foo doesn't work!).

* bytecode.h (yasm_bc_tobytes): Remove multiple output parameter.
(yasm_bc_get_multiple): New.
* bytecode.c (yasm_bc_tobytes): Update to iterate through multiple here.
(yasm_bc_get_multiple): New.
* xdf-objfmt.c, elf-objfmt.c, bin-objfmt.c, coff-objfmt.c: Don't iterate
through multiple here.
* nasm-listfmt.c: Use yasm_bc_get_multiple() to get multiple instead of
yasm_bc_tobytes().

* bytecode.pxi: Update.

* tests/win32-relocovfl.asm: Tests both this and [1534] but generates too
huge of a file (3MB) to be put into the automated tests.

svn path=/trunk/yasm/; revision=1536
2006-05-11 07:00:33 +00:00
Peter Johnson
83c0ecaaec * coretype.h (yasm_value): Add size field (specified in bits).
(yasm_value_output_func): Remove valsize and shift parameters.
* bytecode.h (yasm_effaddr): Remove disp_len, replacing with
need_nonzero_len.
(yasm_immval): Remove len.
* value.h (yasm_value_initialize): Add size parameter.
(yasm_value_finalize_expr): Likewise.
(yasm_value_output_basic): Remove valsize and shift parameters.

Update all implementations and users for the above.

* intnum.c (yasm_intnum_calc): Fix bug in shift right (was doing a logical
instead of arithmetic shift).

* lc3b-basic.asm, lc3b-basic.errwarn, lc3b-basic.hex: Update based on
fixed warnings.

svn path=/trunk/yasm/; revision=1534
2006-05-10 08:54:52 +00:00
Peter Johnson
ad54f1bf5c * bc-int.h (yasm_bytecode_callback): Add reserve flag to indicate if the
bytecode outputs just space and not data.
* bytecode.pxi: Update to match.
* bytecode.c (yasm_bc_tobytes): Use reserve flag instead of checking
against bytecode_reserve as special case.
* dwarf2-info.c, dwarf2-line.c, dwarf2-dbgfmt.c, cv-symline.c, cv-type.c,
* stabs-dbgfmt.c, lc3bbc.c, x86bc.c: Update to set reserve=0.

* bc-align.c, bc-insn.c, bc-reserve.c, bc-org.c, bc-incbin.c, bc-data.c,
* bytecode.c: Split out bytecodes into separate files.  While we're here,
merge LEB128 into general data bytecode.


svn path=/trunk/yasm/; revision=1532
2006-05-10 04:18:23 +00:00
Michael Urman
c860753386 Add/Use helpers to pass void* as manually type-checked PyCObjects.
svn path=/trunk/yasm/; revision=1528
2006-05-07 18:23:33 +00:00
Michael Urman
486ae1c73a Rework yasm.Expression to accept strings like '+' to indicate operation.
Add tests for yasm.Expression and new yasm.ImmVal.

svn path=/trunk/yasm/; revision=1527
2006-05-07 16:41:16 +00:00
Michael Urman
c4654ab749 Raise SymbolTable redefinition errors in Python.
Fix a double-free problem encountered during this testing.
Redefine symtab.define_special() vis parameter to match symrec.visibility.

svn path=/trunk/yasm/; revision=1526
2006-05-07 03:22:03 +00:00
Michael Urman
46ffab25b2 Raise IntNum division by zero errors in Python.
svn path=/trunk/yasm/; revision=1524
2006-05-06 19:12:05 +00:00
Peter Johnson
4c33af41ec Revamp error/warning handling, using a model similar to Python's internal
exception handling.  There are now two layers an error or warning goes
through before it hits the user: first an error is logged via
yasm_error_set() (or yasm_warn_set() for a warning).  Only one error may
be set, whereas multiple warnings can be set (yasm_warn_set maintains a
linked list).  Then, calling yasm_errwarn_propagate() propagates any error
and/or warning(s) to an errwarns structure and associates the
errors/warnings with a line number at that time; this call also clears the
pending errors/warnings and allows new ones to be set.  The propagate
function can safely be called when there are no pending error/warnings.

In addition, there are some helper errwarn functions that allow clearing of
an error/warning without propagating, getting it separately, etc.

Still yet to be done: changing most/all uses of yasm_internal_error() into
yasm_error_set(YASM_ERROR_ASSERTION).

The main advantage this change has is making libyasm functions feel much
more library like, and separating the user code line numbers from the inner
function error handling (e.g. intnum create functions only needed the line
number to trigger errors; this is no longer required).

The set/propagate/etc functions use global data structures to avoid passing
around a pointer to every function.  This would need to be made thread-local
data in a threaded app.  Errwarns containers (that keep associated line
numbers) are no longer global, so multiple source streams can be processed
separately with no conflict (at least if there's only a single thread of
execution).

svn path=/trunk/yasm/; revision=1521
2006-05-04 07:55:32 +00:00
Peter Johnson
6525aa3c58 * symrec.pxi: Change various things to properties rather than functions.
Visibility is handled via set of strings.
* test_symrec.py: Test.

svn path=/trunk/yasm/; revision=1503
2006-04-17 05:36:47 +00:00
Peter Johnson
96d88ea6e0 * python_test.sh: Set srcdir and PYTHON to reasonable defaults if not already
set, this allows easy manual execution of this script outside of make check.

svn path=/trunk/yasm/; revision=1502
2006-04-17 03:53:04 +00:00
Peter Johnson
e4460d5334 * python_test.sh: Use PYTHON variable to find python executable.
* python-yasm/tests/Makefile.inc: Pass PYTHON setting down through
TESTS_ENVIRONMENT.
* Makefile.am: Initialize TESTS_ENVIRONMENT to empty.

svn path=/trunk/yasm/; revision=1501
2006-04-17 03:21:41 +00:00
Michael Urman
1d65f372c2 Add intnum tests; test_cmp is failing right now and needs a source fix.
svn path=/trunk/yasm/; revision=1499
2006-04-17 02:16:50 +00:00
Peter Johnson
27848fc671 * test_symrec.py: Actually add test, and fix it to work.
svn path=/trunk/yasm/; revision=1498
2006-04-17 02:13:52 +00:00
Peter Johnson
83535bec11 * python-yasm: Add test framework; large portions copied from Quod Libet
framework.

svn path=/trunk/yasm/; revision=1497
2006-04-17 02:04:00 +00:00
Peter Johnson
bba331ea41 * symrec.pxi: Remove duplicate l.appends() in values() and items().
svn path=/trunk/yasm/; revision=1496
2006-04-17 01:00:43 +00:00
Peter Johnson
ba76728ded * symrec.pxi: Implement iterators.
* symrec.h (yasm_symtab_first, yasm_symtab_next, yasm_symtab_iter_value):
Supporting functions.
* symrec.c (yasm_symtab_first, yasm_symtab_next, yasm_symtab_iter_value):
Implement by passing through to...
* hamt.h (HAMT_first, HAMT_next, HAMTEntry_get_data): New.
* hamt.c (HAMT_first, HAMT_next, HAMTEntry_get_data): Implement.

svn path=/trunk/yasm/; revision=1495
2006-04-16 22:46:22 +00:00
Peter Johnson
3c5cabcd47 symrec.pxi: Implement __contains__ so that "'foo' in SymbolTable" works.
svn path=/trunk/yasm/; revision=1494
2006-04-16 20:28:07 +00:00
Peter Johnson
c1069f191a * floatnum.pxi: yasm_floatnum doesn't support any ops other than NEG,
other cleanups along the lines of intnum.

svn path=/trunk/yasm/; revision=1492
2006-04-16 08:48:28 +00:00
Peter Johnson
2534dd4c5a * symrec.pxi: Revamp to more correctly generate Symbol objects, support
most dictionary functions (but not yet iterator protocol).
* yasm.pyx: Add Py_INCREF, Py_DECREF, malloc, free externals.
* coretype.pxi: Rename c_print to print_, add some missing yasm_expr_op
enum values.

svn path=/trunk/yasm/; revision=1491
2006-04-16 08:41:41 +00:00
Peter Johnson
1370082ddf * intnum.pxi: Use correct name for NotImplementedError.
svn path=/trunk/yasm/; revision=1490
2006-04-16 02:56:54 +00:00
Peter Johnson
67eda0506b * intnum.pxi: Implement full set of integer and comparison functions.
svn path=/trunk/yasm/; revision=1489
2006-04-16 02:27:01 +00:00
Peter Johnson
bbf23a557d * intnum.c (yasm_intnum_create_sized): New, reverse function of
yasm_intnum_get_sized().
* intnum.h (yasm_intnum_create_sized): Prototype.

* yasm.pyx: Bring in _PyLong_From/AsByteArray functions.
* intnum.pyx: Use yasm_intnum_create_sized(), etc to implement full 128-bit
number handling.

* intnum.c (yasm_intnum_get_str): Return strings in hex rather than in
decimal.

svn path=/trunk/yasm/; revision=1488
2006-04-15 09:59:17 +00:00
Peter Johnson
8909d99167 * python-yasm/Makefile.inc: .python_build needs to depend on
libyasm_a_SOURCES otherwise the Python bindings don't get updated when
libyasm changes.

svn path=/trunk/yasm/; revision=1487
2006-04-15 08:43:54 +00:00
Peter Johnson
8c82c94d11 * python-yasm/Makefile.inc: Since we aren't using buildtools to call Pyrex,
we shouldn't need to remove the build directory.  Not removing it speeds up
the build considerably (we don't have to rebuild all of the Python bindings
just because the Makefile changed, for example).

svn path=/trunk/yasm/; revision=1486
2006-04-15 08:03:42 +00:00
Peter Johnson
5c36a0551f * setup.py: strip() opts["srcdir"] to unbreak distcheck.
svn path=/trunk/yasm/; revision=1462
2006-04-05 05:36:06 +00:00
Peter Johnson
56496896e0 * setup.py: Incorporate cleanups suggested by Michael Urman.
svn path=/trunk/yasm/; revision=1461
2006-04-05 03:37:46 +00:00
Peter Johnson
a79593f923 Quiet warnings in Pyrex code by adding "-w" if GCC detected.
* configure.ac: Pass GCC value to Makefile
* Makefile.inc: Pass GCC value to python-setup.txt
* setup.py: Check GCC value and append -w if necessary.

svn path=/trunk/yasm/; revision=1460
2006-04-05 02:26:19 +00:00
Peter Johnson
949965d5cb * pyrex.m4: Add a little documentation.
* setup.py, yasm.pyx, *.pxi: Add copyright/license.

svn path=/trunk/yasm/; revision=1458
2006-04-04 08:06:39 +00:00