X-Git-Url: https://git.alrj.org/?p=bold.git;a=blobdiff_plain;f=Bold%2FBinArray.py;fp=Bold%2FBinArray.py;h=84d57250061049dc057f0661ff89e538c7043486;hp=0000000000000000000000000000000000000000;hb=7eeaa837d3a6f29f9312bf29962214e709663e52;hpb=aa036795cb0ab7f31b9d78cfa562ccb603bc977a diff --git a/Bold/BinArray.py b/Bold/BinArray.py new file mode 100644 index 0000000..84d5725 --- /dev/null +++ b/Bold/BinArray.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- + +# kate: space-indent on; indent-width 2; mixedindent off; indent-mode python; + +# Copyright (C) 2009 Amand 'alrj' Tihon +# +# This file is part of bold, the Byte Optimized Linker. +# +# You can redistribute this file and/or modify it under the terms of the +# GNU Lesser General Public License as published by the Free Software +# Foundation, version 2.1. + +from array import array +import struct + +class BinArray(array): + """A specialized array that contains bytes""" + def __new__(cls, data=None): + if data: + return array.__new__(BinArray, "B", data) + else: + return array.__new__(BinArray, "B")