Use TERM_PRIMARY_* and TERM_IMMED* macros, following erl_term.h
Erlang/OTP's erl_term.h defines several macros to encode terms and
distinguishes TAG_PRIMARY_* for the two lowest bits, _TAG_IMMED1* for
the lowest four bits and _TAG_IMMED2* for the lowest six bits.
AtomVM term.h uses TERM_BOXED_* for the first word of boxed items.
It used magic number 0x2 or TERM_BOXED_VALUE_TAG instead of what
erl_term.h calls TAG_PRIMARY_BOXED, which is confusing as it's not related
to the first word of boxed item but to the (lowest two bits of the) term itself.
This change introduces TERM_PRIMARY_* macros following Erlang/OTP erl_term.h's
TAG_PRIMARY_* macros, and replaces all matching magic numbers with these
macros.
It also introduces TERM_IMMED2_* macros and uses them instead of magic
numbers.
TERM_BOXED_VALUE_TAG is marked as deprecated but kept.
No macro called TERM_IMMED1_* is introduced as AtomVM already uses
non-confusing macros TERM_PID_TAG, TERM_PORT_TAG and TERM_INTEGER_TAG.
These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license).
SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later