Skip to content

Commit

Permalink
all: Rename UMODULE to MODULE in preprocessor/Makefile vars.
Browse files Browse the repository at this point in the history
This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <[email protected]>
  • Loading branch information
jimmo committed Jun 8, 2023
1 parent 7f5d5c7 commit f5f9edf
Show file tree
Hide file tree
Showing 126 changed files with 563 additions and 563 deletions.
4 changes: 2 additions & 2 deletions docs/library/random.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ This module implements a pseudo-random number generator (PRNG).
.. note::

The :func:`randrange`, :func:`randint` and :func:`choice` functions are only
available if the ``MICROPY_PY_URANDOM_EXTRA_FUNCS`` configuration option is
available if the ``MICROPY_PY_RANDOM_EXTRA_FUNCS`` configuration option is
enabled.


Expand Down Expand Up @@ -73,7 +73,7 @@ Other Functions
supported by the port) initialise the PRNG with a true random number
(usually a hardware generated random number).

The ``None`` case only works if ``MICROPY_PY_URANDOM_SEED_INIT_FUNC`` is
The ``None`` case only works if ``MICROPY_PY_RANDOM_SEED_INIT_FUNC`` is
enabled by the port, otherwise it raises ``ValueError``.

.. function:: choice(sequence)
Expand Down
2 changes: 1 addition & 1 deletion examples/natmod/uheapq/uheapq.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define MICROPY_PY_UHEAPQ (1)
#define MICROPY_PY_HEAPQ (1)

#include "py/dynruntime.h"

Expand Down
6 changes: 3 additions & 3 deletions examples/natmod/urandom/urandom.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define MICROPY_PY_URANDOM (1)
#define MICROPY_PY_URANDOM_EXTRA_FUNCS (1)
#define MICROPY_PY_RANDOM (1)
#define MICROPY_PY_RANDOM_EXTRA_FUNCS (1)

#include "py/dynruntime.h"

Expand All @@ -19,7 +19,7 @@ mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *a
mp_store_global(MP_QSTR___name__, MP_OBJ_NEW_QSTR(MP_QSTR_random));
mp_store_global(MP_QSTR_getrandbits, MP_OBJ_FROM_PTR(&mod_random_getrandbits_obj));
mp_store_global(MP_QSTR_seed, MP_OBJ_FROM_PTR(&mod_random_seed_obj));
#if MICROPY_PY_URANDOM_EXTRA_FUNCS
#if MICROPY_PY_RANDOM_EXTRA_FUNCS
mp_store_global(MP_QSTR_randrange, MP_OBJ_FROM_PTR(&mod_random_randrange_obj));
mp_store_global(MP_QSTR_randint, MP_OBJ_FROM_PTR(&mod_random_randint_obj));
mp_store_global(MP_QSTR_choice, MP_OBJ_FROM_PTR(&mod_random_choice_obj));
Expand Down
8 changes: 4 additions & 4 deletions examples/natmod/ure/ure.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#define MICROPY_STACK_CHECK (1)
#define MICROPY_PY_URE (1)
#define MICROPY_PY_URE_MATCH_GROUPS (1)
#define MICROPY_PY_URE_MATCH_SPAN_START_END (1)
#define MICROPY_PY_URE_SUB (0) // requires vstr interface
#define MICROPY_PY_RE (1)
#define MICROPY_PY_RE_MATCH_GROUPS (1)
#define MICROPY_PY_RE_MATCH_SPAN_START_END (1)
#define MICROPY_PY_RE_SUB (0) // requires vstr interface

#include <alloca.h>
#include "py/dynruntime.h"
Expand Down
2 changes: 1 addition & 1 deletion examples/natmod/uzlib/uzlib.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define MICROPY_PY_UZLIB (1)
#define MICROPY_PY_ZLIB (1)

#include "py/dynruntime.h"

Expand Down
4 changes: 2 additions & 2 deletions extmod/extmod.mk
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ endif
################################################################################
# ussl

ifeq ($(MICROPY_PY_USSL),1)
CFLAGS_EXTMOD += -DMICROPY_PY_USSL=1
ifeq ($(MICROPY_PY_SSL),1)
CFLAGS_EXTMOD += -DMICROPY_PY_SSL=1
ifeq ($(MICROPY_SSL_AXTLS),1)
AXTLS_DIR = lib/axtls
GIT_SUBMODULES += $(AXTLS_DIR)
Expand Down
2 changes: 1 addition & 1 deletion extmod/modlwip.c
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(lwip_socket_bind_obj, lwip_socket_bind);
STATIC mp_obj_t lwip_socket_listen(size_t n_args, const mp_obj_t *args) {
lwip_socket_obj_t *socket = MP_OBJ_TO_PTR(args[0]);

mp_int_t backlog = MICROPY_PY_USOCKET_LISTEN_BACKLOG_DEFAULT;
mp_int_t backlog = MICROPY_PY_SOCKET_LISTEN_BACKLOG_DEFAULT;
if (n_args > 1) {
backlog = mp_obj_get_int(args[1]);
backlog = (backlog < 0) ? 0 : backlog;
Expand Down
2 changes: 1 addition & 1 deletion extmod/modnetwork.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ typedef struct _mod_network_socket_obj_t {
int32_t timeout;
mp_obj_t callback;
int32_t state : 8;
#if MICROPY_PY_USOCKET_EXTENDED_STATE
#if MICROPY_PY_SOCKET_EXTENDED_STATE
// Extended socket state for NICs/ports that need it.
void *_private;
#endif
Expand Down
6 changes: 3 additions & 3 deletions extmod/moduasyncio.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ STATIC mp_obj_t task_queue_make_new(const mp_obj_type_t *type, size_t n_args, si
// Ticks for task ordering in pairing heap

STATIC mp_obj_t ticks(void) {
return MP_OBJ_NEW_SMALL_INT(mp_hal_ticks_ms() & (MICROPY_PY_UTIME_TICKS_PERIOD - 1));
return MP_OBJ_NEW_SMALL_INT(mp_hal_ticks_ms() & (MICROPY_PY_TIME_TICKS_PERIOD - 1));
}

STATIC mp_int_t ticks_diff(mp_obj_t t1_in, mp_obj_t t0_in) {
mp_uint_t t0 = MP_OBJ_SMALL_INT_VALUE(t0_in);
mp_uint_t t1 = MP_OBJ_SMALL_INT_VALUE(t1_in);
mp_int_t diff = ((t1 - t0 + MICROPY_PY_UTIME_TICKS_PERIOD / 2) & (MICROPY_PY_UTIME_TICKS_PERIOD - 1))
- MICROPY_PY_UTIME_TICKS_PERIOD / 2;
mp_int_t diff = ((t1 - t0 + MICROPY_PY_TIME_TICKS_PERIOD / 2) & (MICROPY_PY_TIME_TICKS_PERIOD - 1))
- MICROPY_PY_TIME_TICKS_PERIOD / 2;
return diff;
}

Expand Down
8 changes: 4 additions & 4 deletions extmod/modubinascii.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "py/binary.h"
#include "py/objstr.h"

#if MICROPY_PY_UBINASCII
#if MICROPY_PY_BINASCII

#if MICROPY_PY_BUILTINS_BYTES_HEX
STATIC mp_obj_t bytes_hex_as_bytes(size_t n_args, const mp_obj_t *args) {
Expand Down Expand Up @@ -170,7 +170,7 @@ STATIC mp_obj_t mod_binascii_b2a_base64(size_t n_args, const mp_obj_t *pos_args,
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(mod_binascii_b2a_base64_obj, 1, mod_binascii_b2a_base64);

#if MICROPY_PY_UBINASCII_CRC32
#if MICROPY_PY_BINASCII_CRC32
#include "lib/uzlib/tinf.h"

STATIC mp_obj_t mod_binascii_crc32(size_t n_args, const mp_obj_t *args) {
Expand All @@ -191,7 +191,7 @@ STATIC const mp_rom_map_elem_t mp_module_binascii_globals_table[] = {
#endif
{ MP_ROM_QSTR(MP_QSTR_a2b_base64), MP_ROM_PTR(&mod_binascii_a2b_base64_obj) },
{ MP_ROM_QSTR(MP_QSTR_b2a_base64), MP_ROM_PTR(&mod_binascii_b2a_base64_obj) },
#if MICROPY_PY_UBINASCII_CRC32
#if MICROPY_PY_BINASCII_CRC32
{ MP_ROM_QSTR(MP_QSTR_crc32), MP_ROM_PTR(&mod_binascii_crc32_obj) },
#endif
};
Expand All @@ -205,4 +205,4 @@ const mp_obj_module_t mp_module_binascii = {

MP_REGISTER_MODULE(MP_QSTR_binascii, mp_module_binascii);

#endif // MICROPY_PY_UBINASCII
#endif // MICROPY_PY_BINASCII
18 changes: 9 additions & 9 deletions extmod/moducryptolib.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#include "py/mpconfig.h"

#if MICROPY_PY_UCRYPTOLIB
#if MICROPY_PY_CRYPTOLIB

#include <assert.h>
#include <string.h>
Expand Down Expand Up @@ -90,7 +90,7 @@ typedef struct _mp_obj_aes_t {
} mp_obj_aes_t;

static inline bool is_ctr_mode(int block_mode) {
#if MICROPY_PY_UCRYPTOLIB_CTR
#if MICROPY_PY_CRYPTOLIB_CTR
return block_mode == UCRYPTOLIB_MODE_CTR;
#else
return false;
Expand Down Expand Up @@ -140,7 +140,7 @@ STATIC void aes_process_cbc_impl(AES_CTX_IMPL *ctx, const uint8_t *in, uint8_t *
}
}

#if MICROPY_PY_UCRYPTOLIB_CTR
#if MICROPY_PY_CRYPTOLIB_CTR
// axTLS doesn't have CTR support out of the box. This implements the counter part using the ECB primitive.
STATIC void aes_process_ctr_impl(AES_CTX_IMPL *ctx, const uint8_t *in, uint8_t *out, size_t in_len, struct ctr_params *ctr_params) {
size_t n = ctr_params->offset;
Expand Down Expand Up @@ -203,7 +203,7 @@ STATIC void aes_process_cbc_impl(AES_CTX_IMPL *ctx, const uint8_t *in, uint8_t *
mbedtls_aes_crypt_cbc(&ctx->u.mbedtls_ctx, encrypt ? MBEDTLS_AES_ENCRYPT : MBEDTLS_AES_DECRYPT, in_len, ctx->iv, in, out);
}

#if MICROPY_PY_UCRYPTOLIB_CTR
#if MICROPY_PY_CRYPTOLIB_CTR
STATIC void aes_process_ctr_impl(AES_CTX_IMPL *ctx, const uint8_t *in, uint8_t *out, size_t in_len, struct ctr_params *ctr_params) {
mbedtls_aes_crypt_ctr(&ctx->u.mbedtls_ctx, in_len, &ctr_params->offset, ctx->iv, ctr_params->encrypted_counter, in, out);
}
Expand All @@ -219,7 +219,7 @@ STATIC mp_obj_t cryptolib_aes_make_new(const mp_obj_type_t *type, size_t n_args,
switch (block_mode) {
case UCRYPTOLIB_MODE_ECB:
case UCRYPTOLIB_MODE_CBC:
#if MICROPY_PY_UCRYPTOLIB_CTR
#if MICROPY_PY_CRYPTOLIB_CTR
case UCRYPTOLIB_MODE_CTR:
#endif
break;
Expand Down Expand Up @@ -318,7 +318,7 @@ STATIC mp_obj_t aes_process(size_t n_args, const mp_obj_t *args, bool encrypt) {
aes_process_cbc_impl(&self->ctx, in_bufinfo.buf, out_buf_ptr, in_bufinfo.len, encrypt);
break;

#if MICROPY_PY_UCRYPTOLIB_CTR
#if MICROPY_PY_CRYPTOLIB_CTR
case UCRYPTOLIB_MODE_CTR:
aes_process_ctr_impl(&self->ctx, in_bufinfo.buf, out_buf_ptr, in_bufinfo.len,
ctr_params_from_aes(self));
Expand Down Expand Up @@ -359,10 +359,10 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
STATIC const mp_rom_map_elem_t mp_module_cryptolib_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_cryptolib) },
{ MP_ROM_QSTR(MP_QSTR_aes), MP_ROM_PTR(&cryptolib_aes_type) },
#if MICROPY_PY_UCRYPTOLIB_CONSTS
#if MICROPY_PY_CRYPTOLIB_CONSTS
{ MP_ROM_QSTR(MP_QSTR_MODE_ECB), MP_ROM_INT(UCRYPTOLIB_MODE_ECB) },
{ MP_ROM_QSTR(MP_QSTR_MODE_CBC), MP_ROM_INT(UCRYPTOLIB_MODE_CBC) },
#if MICROPY_PY_UCRYPTOLIB_CTR
#if MICROPY_PY_CRYPTOLIB_CTR
{ MP_ROM_QSTR(MP_QSTR_MODE_CTR), MP_ROM_INT(UCRYPTOLIB_MODE_CTR) },
#endif
#endif
Expand All @@ -377,4 +377,4 @@ const mp_obj_module_t mp_module_cryptolib = {

MP_REGISTER_MODULE(MP_QSTR_cryptolib, mp_module_cryptolib);

#endif // MICROPY_PY_UCRYPTOLIB
#endif // MICROPY_PY_CRYPTOLIB
24 changes: 12 additions & 12 deletions extmod/moduhashlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@

#include "py/runtime.h"

#if MICROPY_PY_UHASHLIB
#if MICROPY_PY_HASHLIB

#if MICROPY_SSL_MBEDTLS
#include "mbedtls/version.h"
#endif

#if MICROPY_PY_UHASHLIB_SHA256
#if MICROPY_PY_HASHLIB_SHA256

#if MICROPY_SSL_MBEDTLS
#include "mbedtls/sha256.h"
Expand All @@ -45,7 +45,7 @@

#endif

#if MICROPY_PY_UHASHLIB_SHA1 || MICROPY_PY_UHASHLIB_MD5
#if MICROPY_PY_HASHLIB_SHA1 || MICROPY_PY_HASHLIB_MD5

#if MICROPY_SSL_AXTLS
#include "lib/axtls/crypto/crypto.h"
Expand All @@ -70,7 +70,7 @@ static void hashlib_ensure_not_final(mp_obj_hash_t *self) {
}
}

#if MICROPY_PY_UHASHLIB_SHA256
#if MICROPY_PY_HASHLIB_SHA256
STATIC mp_obj_t hashlib_sha256_update(mp_obj_t self_in, mp_obj_t arg);

#if MICROPY_SSL_MBEDTLS
Expand Down Expand Up @@ -161,12 +161,12 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
hashlib_sha256_type,
MP_QSTR_sha256,
MP_TYPE_FLAG_NONE,
make_new, uhashlib_sha256_make_new,
make_new, hashlib_sha256_make_new,
locals_dict, &hashlib_sha256_locals_dict
);
#endif

#if MICROPY_PY_UHASHLIB_SHA1
#if MICROPY_PY_HASHLIB_SHA1
STATIC mp_obj_t hashlib_sha1_update(mp_obj_t self_in, mp_obj_t arg);

#if MICROPY_SSL_AXTLS
Expand Down Expand Up @@ -260,7 +260,7 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
);
#endif

#if MICROPY_PY_UHASHLIB_MD5
#if MICROPY_PY_HASHLIB_MD5
STATIC mp_obj_t hashlib_md5_update(mp_obj_t self_in, mp_obj_t arg);

#if MICROPY_SSL_AXTLS
Expand Down Expand Up @@ -352,17 +352,17 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
make_new, hashlib_md5_make_new,
locals_dict, &hashlib_md5_locals_dict
);
#endif // MICROPY_PY_UHASHLIB_MD5
#endif // MICROPY_PY_HASHLIB_MD5

STATIC const mp_rom_map_elem_t mp_module_hashlib_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_hashlib) },
#if MICROPY_PY_UHASHLIB_SHA256
#if MICROPY_PY_HASHLIB_SHA256
{ MP_ROM_QSTR(MP_QSTR_sha256), MP_ROM_PTR(&hashlib_sha256_type) },
#endif
#if MICROPY_PY_UHASHLIB_SHA1
#if MICROPY_PY_HASHLIB_SHA1
{ MP_ROM_QSTR(MP_QSTR_sha1), MP_ROM_PTR(&hashlib_sha1_type) },
#endif
#if MICROPY_PY_UHASHLIB_MD5
#if MICROPY_PY_HASHLIB_MD5
{ MP_ROM_QSTR(MP_QSTR_md5), MP_ROM_PTR(&hashlib_md5_type) },
#endif
};
Expand All @@ -376,4 +376,4 @@ const mp_obj_module_t mp_module_hashlib = {

MP_REGISTER_MODULE(MP_QSTR_hashlib, mp_module_hashlib);

#endif // MICROPY_PY_UHASHLIB
#endif // MICROPY_PY_HASHLIB
4 changes: 2 additions & 2 deletions extmod/moduheapq.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "py/objlist.h"
#include "py/runtime.h"

#if MICROPY_PY_UHEAPQ
#if MICROPY_PY_HEAPQ

// the algorithm here is modelled on CPython's heapq.py

Expand Down Expand Up @@ -121,4 +121,4 @@ const mp_obj_module_t mp_module_heapq = {
MP_REGISTER_MODULE(MP_QSTR_heapq, mp_module_heapq);
#endif

#endif // MICROPY_PY_UHEAPQ
#endif // MICROPY_PY_HEAPQ
6 changes: 3 additions & 3 deletions extmod/modujson.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
#include "py/runtime.h"
#include "py/stream.h"

#if MICROPY_PY_UJSON
#if MICROPY_PY_JSON

#if MICROPY_PY_UJSON_SEPARATORS
#if MICROPY_PY_JSON_SEPARATORS

enum {
DUMP_MODE_TO_STRING = 1,
Expand Down Expand Up @@ -383,4 +383,4 @@ const mp_obj_module_t mp_module_json = {

MP_REGISTER_MODULE(MP_QSTR_json, mp_module_json);

#endif // MICROPY_PY_UJSON
#endif // MICROPY_PY_JSON
Loading

0 comments on commit f5f9edf

Please sign in to comment.