micropython/py
Alexander Steffen 299bc62586 all: Unify header guard usage.
The code conventions suggest using header guards, but do not define how
those should look like and instead point to existing files. However, not
all existing files follow the same scheme, sometimes omitting header guards
altogether, sometimes using non-standard names, making it easy to
accidentally pick a "wrong" example.

This commit ensures that all header files of the MicroPython project (that
were not simply copied from somewhere else) follow the same pattern, that
was already present in the majority of files, especially in the py folder.

The rules are as follows.

Naming convention:
* start with the words MICROPY_INCLUDED
* contain the full path to the file
* replace special characters with _

In addition, there are no empty lines before #ifndef, between #ifndef and
one empty line before #endif. #endif is followed by a comment containing
the name of the guard macro.

py/grammar.h cannot use header guards by design, since it has to be
included multiple times in a single C file. Several other files also do not
need header guards as they are only used internally and guaranteed to be
included only once:
* MICROPY_MPHALPORT_H
* mpconfigboard.h
* mpconfigport.h
* mpthreadport.h
* pin_defs_*.h
* qstrdefs*.h
2017-07-18 11:57:39 +10:00
..
argcheck.c py: Use mp_raise_TypeError/mp_raise_ValueError helpers where possible. 2017-03-28 22:37:26 +11:00
asmarm.c py/asmarm: Fix assembler's PASS_EMIT constant name. 2017-01-03 15:40:50 +11:00
asmarm.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
asmbase.c
asmbase.h
asmthumb.c various: Spelling fixes 2017-05-29 11:36:05 +03:00
asmthumb.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
asmx64.c
asmx64.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
asmx86.c
asmx86.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
asmxtensa.c
asmxtensa.h py/asmxtensa.h: Explicitly cast args to 32-bits so left-shift is legal. 2017-02-08 10:48:51 +11:00
bc.c py: Provide mp_decode_uint_skip() to help reduce stack usage. 2017-06-09 13:36:33 +10:00
bc.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
bc0.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
binary.c py/binary: Add missing "break" statements. 2017-07-04 02:11:46 +10:00
binary.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
builtin.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
builtinevex.c py: Change mp_uint_t to size_t for mp_obj_str_get_data len arg. 2017-03-29 12:56:45 +11:00
builtinhelp.c py/builtinhelp: Implement help('modules') to list available modules. 2017-01-22 12:12:54 +11:00
builtinimport.c py,extmod: Some casts and minor refactors to quiet compiler warnings. 2017-07-07 11:32:22 +10:00
compile.c py/compile: Fix enum variable declaration. 2017-07-09 13:18:14 +10:00
compile.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
emit.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
emitbc.c py,extmod: Some casts and minor refactors to quiet compiler warnings. 2017-07-07 11:32:22 +10:00
emitcommon.c
emitglue.c py/emitglue: Refactor to remove assert(0), to improve coverage. 2016-12-21 11:52:05 +11:00
emitglue.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
emitinlinethumb.c py: Create str/bytes objects in the parser, not the compiler. 2017-02-24 13:43:43 +11:00
emitinlinextensa.c
emitnative.c py: Add LOAD_SUPER_METHOD bytecode to allow heap-free super meth calls. 2017-04-22 23:39:20 +10:00
formatfloat.c py,extmod: Some casts and minor refactors to quiet compiler warnings. 2017-07-07 11:32:22 +10:00
formatfloat.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
frozenmod.c py/modio: Implement uio.resource_stream(package, resource_path). 2017-05-03 01:47:08 +03:00
frozenmod.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
gc.c py/gc: Refactor assertions in gc_free function. 2017-07-12 12:17:38 +10:00
gc.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
grammar.h py/compile: Combine arith and bit-shift ops into 1 compile routine. 2017-07-05 15:49:00 +10:00
lexer.c py,extmod: Some casts and minor refactors to quiet compiler warnings. 2017-07-07 11:32:22 +10:00
lexer.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
makeqstrdata.py
makeqstrdefs.py py/makeqstrdefs.py: Make script run correctly with Python 2.6. 2017-06-09 13:42:13 +10:00
makeversionhdr.py py/makeversionhdr.py: Update to parse new release line in docs/conf.py. 2017-07-04 22:37:41 +10:00
malloc.c
map.c py/map: Fix bugs with deletion of elements from OrderedDict. 2017-03-03 11:21:19 +11:00
misc.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
mkenv.mk various: Spelling fixes 2017-05-29 11:36:05 +03:00
mkrules.mk py/mkrules.mk: Fix auto-qstr generation when "make -B" is used. 2017-05-26 13:12:42 +10:00
modarray.c
modbuiltins.c py,extmod: Some casts and minor refactors to quiet compiler warnings. 2017-07-07 11:32:22 +10:00
modcmath.c
modcollections.c
modgc.c
modio.c py/modio: resource_stream: Implement "package" param handling. 2017-05-06 18:42:35 +03:00
modmath.c py/modmath: Check for zero division in log with 2 args. 2017-07-04 02:15:11 +10:00
modmicropython.c py/modmicropython: Add micropython.kbd_intr() function. 2017-04-18 17:24:30 +10:00
modstruct.c py/binary: mp_binary_get_size: Raise error on unsupported typecodes. 2017-01-17 22:53:06 +03:00
modsys.c py/modsys: Allow to compile with obj-repr D and PY_ATTRTUPLE disabled. 2017-06-08 00:41:27 +10:00
modthread.c py/modthread: Raise RuntimeError in release() if lock is not acquired. 2017-06-14 14:43:50 +10:00
moduerrno.c py/moduerrno: Make list of errno codes configurable. 2017-02-22 12:58:11 +11:00
mpconfig.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
mperrno.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
mphal.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
mpprint.c py/mpprint: Remove unreachable check for neg return of mp_format_float. 2017-06-30 12:10:50 +10:00
mpprint.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
mpstate.c
mpstate.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
mpthread.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
mpz.c py/mpz: In mpn_sub, use existing function to remove trailing zeros. 2017-04-25 12:22:04 +10:00
mpz.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
nativeglue.c py: Add LOAD_SUPER_METHOD bytecode to allow heap-free super meth calls. 2017-04-22 23:39:20 +10:00
nlr.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
nlrsetjmp.c py/nlrsetjmp: Add check for failed NLR jump. 2017-04-12 13:50:31 +10:00
nlrthumb.c
nlrx64.c py/nlrx64: Fixes to support Mac OS. 2017-03-08 22:36:02 +11:00
nlrx86.c py/nlrx86: Better check for Zephyr (requires 1.7). 2017-03-26 00:33:23 +03:00
nlrxtensa.c py/nlrxtensa: Convert from assembler to C file with inline asm. 2017-03-06 17:13:16 +11:00
obj.c all: Make more use of mp_raise_{msg,TypeError,ValueError} helpers. 2017-06-15 11:54:41 +10:00
obj.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
objarray.c py: Use mp_raise_TypeError/mp_raise_ValueError helpers where possible. 2017-03-28 22:37:26 +11:00
objarray.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
objattrtuple.c py/objtuple: Convert mp_uint_t to size_t where appropriate. 2017-02-16 16:51:16 +11:00
objbool.c
objboundmeth.c
objcell.c
objclosure.c py/objclosure: Convert mp_uint_t to size_t where appropriate. 2017-02-16 16:51:17 +11:00
objcomplex.c all: Make more use of mp_raise_{msg,TypeError,ValueError} helpers. 2017-06-15 11:54:41 +10:00
objdict.c py/objdict: Factorise dict accessor helper to reduce code size. 2017-07-04 23:24:59 +10:00
objenumerate.c py: Add iter_buf to getiter type method. 2017-02-16 18:38:06 +11:00
objexcept.c py: Optimise types for common case where type has a single parent type. 2017-04-12 13:22:21 +10:00
objexcept.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
objfilter.c py: Add iter_buf to getiter type method. 2017-02-16 18:38:06 +11:00
objfloat.c py: Reduce str/repr precision of float numbers when floats are 30-bit. 2017-04-21 16:21:56 +10:00
objfun.c py: Provide mp_decode_uint_skip() to help reduce stack usage. 2017-06-09 13:36:33 +10:00
objfun.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
objgenerator.c py/objgenerator: Allow to hash generators and generator instances. 2017-07-07 11:47:38 +10:00
objgenerator.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
objgetitemiter.c py: Add iter_buf to getiter type method. 2017-02-16 18:38:06 +11:00
objint.c py,extmod: Some casts and minor refactors to quiet compiler warnings. 2017-07-07 11:32:22 +10:00
objint.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
objint_longlong.c all: Make more use of mp_raise_{msg,TypeError,ValueError} helpers. 2017-06-15 11:54:41 +10:00
objint_mpz.c extmod/moductypes: Fix bigint handling for 32-bit ports. 2017-04-21 16:43:21 +03:00
objlist.c py: Convert mp_uint_t to size_t for tuple/list accessors. 2017-03-29 12:56:17 +11:00
objlist.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
objmap.c py/objmap: Convert mp_uint_t to size_t. 2017-03-27 12:19:24 +11:00
objmodule.c py/objmodule: Move module init/deinit code into runtime functions. 2017-01-26 23:30:38 +11:00
objmodule.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
objnamedtuple.c py/objnamedtuple: Simplify and remove use of alloca building namedtuple. 2017-06-29 17:40:25 +10:00
objnone.c
objobject.c py: Use mp_raise_TypeError/mp_raise_ValueError helpers where possible. 2017-03-28 22:37:26 +11:00
objpolyiter.c py: Add iter_buf to getiter type method. 2017-02-16 18:38:06 +11:00
objproperty.c
objrange.c py/objrange: Fix slicing of range when step of slice is negative. 2017-05-18 17:32:42 +10:00
objreversed.c py: Add iter_buf to getiter type method. 2017-02-16 18:38:06 +11:00
objset.c py: De-optimise some uses of mp_getiter, so they don't use the C stack. 2017-02-16 19:11:34 +11:00
objsingleton.c
objslice.c
objstr.c py/objstr: Remove unnecessary "sign" variable in formatting code. 2017-07-04 02:13:27 +10:00
objstr.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
objstringio.c py/objstringio: If created from immutable object, follow copy on write policy. 2017-06-09 17:33:01 +03:00
objstringio.h py/objstringio: If created from immutable object, follow copy on write policy. 2017-06-09 17:33:01 +03:00
objstrunicode.c all: Make more use of mp_raise_{msg,TypeError,ValueError} helpers. 2017-06-15 11:54:41 +10:00
objtuple.c py/objtuple: Add support for inplace add (same as normal add). 2017-04-05 12:38:02 +10:00
objtuple.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
objtype.c py: Add LOAD_SUPER_METHOD bytecode to allow heap-free super meth calls. 2017-04-22 23:39:20 +10:00
objtype.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
objzip.c py/objzip: Convert mp_uint_t to size_t. 2017-03-30 22:58:08 +11:00
opmethods.c
parse.c py/parse: Simplify handling of errors by raising them directly. 2017-02-24 14:56:37 +11:00
parse.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
parsenum.c py: Use mp_raise_TypeError/mp_raise_ValueError helpers where possible. 2017-03-28 22:37:26 +11:00
parsenum.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
parsenumbase.c
parsenumbase.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
persistentcode.c py/persistentcode: Allow to compile with complex numbers disabled. 2017-06-08 00:28:28 +10:00
persistentcode.h
py.mk various: Spelling fixes 2017-05-29 11:36:05 +03:00
qstr.c
qstr.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
qstrdefs.h extmod: Add generic VFS sub-system. 2017-01-27 17:19:06 +11:00
reader.c py: Allow lexer to raise exceptions during construction. 2017-03-14 11:52:05 +11:00
reader.h py: Allow lexer to raise exceptions during construction. 2017-03-14 11:52:05 +11:00
repl.c py/repl: Change mp_uint_t to size_t in repl helpers. 2017-07-04 23:44:54 +10:00
repl.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
ringbuf.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
runtime.c py,extmod: Some casts and minor refactors to quiet compiler warnings. 2017-07-07 11:32:22 +10:00
runtime.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
runtime0.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
runtime_utils.c
scheduler.c py: Add micropython.schedule() function and associated runtime code. 2017-03-20 15:20:26 +11:00
scope.c
scope.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
sequence.c py/sequence: Fix boundary errors when slicing with a negative step. 2017-05-18 17:32:42 +10:00
showbc.c py: Add LOAD_SUPER_METHOD bytecode to allow heap-free super meth calls. 2017-04-22 23:39:20 +10:00
smallint.c
smallint.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
stackctrl.c
stackctrl.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
stream.c all: Make more use of mp_raise_{msg,TypeError,ValueError} helpers. 2017-06-15 11:54:41 +10:00
stream.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
unicode.c py/unicode: Comment-out unused function unichar_isprint. 2016-12-28 17:50:10 +11:00
unicode.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
vm.c py/vm: Make "if" control flow more obvious in YIELD_FROM opcode. 2017-07-04 02:14:25 +10:00
vmentrytable.h py: Add LOAD_SUPER_METHOD bytecode to allow heap-free super meth calls. 2017-04-22 23:39:20 +10:00
vstr.c py,extmod: Some casts and minor refactors to quiet compiler warnings. 2017-07-07 11:32:22 +10:00
warning.c