We substitute H_GCC_ATTRIBUTE to any occurence of __attribute__ and
disable its function with non gcc, non clang compilers.
We use a H_ macro so as to not pollute users' namespaces.
On windows build without c4201 so as to allow anonymous struct. This
shows hammer is not C99 compliant but rather C11.
In order to guarantee that Hammer can build on Windows, an appveyor.yml
and associated build scripts will build hammer and its examples. The idea
is that as soon as the appveyor.yml exists in the repository, pull
requests that would impede Windows portability would be immediately
detected.
The scripts expect CL.EXE to be in the path, and will produce their
results in build/
The highest level of warning is enabled on CL.EXE, minus warnings that
bring CL.EXE to a level that ressembles C99. The only notable warning
that was disabled is the one that tells you about implicit truncating
conversions.
Hammer's source code has quite a few implicit conversions say from a 64bit
unsigned integer to a integer of a lesser size (signed or otherwise)
The pretty printing format chosen is USER:<token name>
We use the registry function `h_get_token_type_name` which returns 0
when no name has been defined. This will print (null) as a token name.
Now we can do things like:
# copy-paste from output
ring.<t,L,tie,Cn,M,Ln,I,D,J,Rn,A,K,F,G> = QQ[]
ID = ring.ideal(L - (1*Cn*t),tie - (1*Ln*t),Cn - (1*I + 1*J),M - (1*t^2),Ln - (1*D + 1*L + 1*M),I - (1*Rn*t),D - (1*Rn*t),J - (1*Ln*t),Rn - (1*F + 1*G + 1*K),A - (1*tie),K - (1*t^2),F - (1*Ln*t),G - (1*Cn*t))
# we are interested in tie in terms of t; so we want to remove anything not these two:
ID.elimination_ideal([L,Cn,M,Ln,I,D,J,Rn,A,K,F,G])
# output from this SageMath command is
# Ideal (t^3 + 2*t^2*tie + t*tie - tie) of Multivariate Polynomial Ring in t, L, tie, Cn, M, Ln, I, D, J, Rn, A, K, F, G over Rational Field
# which we can solve for tie to get tie = t^3/(1-t-2*t^2) just as expected
NEWS:
* Switching endianness mid-byte no longer potentially re-reads bytes.
* bit_offset now consistently refers to the number of bits already
read.
* HParsedTokens now have a bit_length field; this is a size_t. This
may be removed for memory reasons.
The bit writer has not yet been updated to match; the result of
switching bit writer endianness in the middle of a byte remains
undefined.
I've found this especially useful in combination with my own
_attr_uint_const for things like flags and type specifiers.
It's possible that its usefulness might be diminished significantly if
there were a built-in bitfield constant parser -- that certainly would
eliminate all of my current uses of it -- but it still seems nicely
symmetric with H_ACT_APPLY.