#!/usr/bin/env python
# encoding: utf-8

"""
This module of native functions is implemented for
compatability with 010 editor functions. Some of these functions
are nops, some are fully implemented.
"""

import six
import sys

from pfp.native import native
import pfp.fields
import pfp.errors as errors
import pfp.bitwrap as bitwrap

# http://www.sweetscape.com/010editor/manual/FuncIO.htm

#void BigEndian()
@native(name="BigEndian", ret=pfp.fields.Void)
def BigEndian(params, ctxt, scope, stream, coord):
	if len(params) > 0:
		raise errors.InvalidArguments(coord, "0 arguments", "{} args".format(len(params)))
	pfp.fields.NumberBase.endian = pfp.fields.BIG_ENDIAN

#void BitfieldDisablePadding()
@native(name="BitfieldDisablePadding", ret=pfp.fields.Void, send_interp=True)
def BitfieldDisablePadding(params, ctxt, scope, stream, coord, interp):
	if len(params) > 0:
		raise errors.InvalidArguments(coord, "0 arguments", "{} args".format(len(params)))
	interp.set_bitfield_padded(False)

#void BitfieldEnablePadding()
@native(name="BitfieldEnablePadding", ret=pfp.fields.Void, send_interp=True)
def BitfieldEnablePadding(params, ctxt, scope, stream, coord, interp):