Did y'all know that C has spelled out logical operators (and, or, not) in the iso646.h standard header <https://en.cppreference.com/w/c/header/iso646.html>? I use that in all my projects and add some more on top:
#include <iso646.h>
// For consistency with other bit* operators
#define bitnot ~
#define is ==
#define isnt !=
El resultado de una guerra se define en el campo de batalla; ese mismo lugar al que usted y sus fuerzas no se atreven a acercarse y sobre el que solo pueden hablar en sus tuits."
El resultado de una guerra se define en el campo de batalla;... #el #resultado #de #una #guerra #se #define #en #campo #batalla; #ese #mismo #lugar #al #que #usted #y #sus #fuerzas #no #atreven #a #acercarse #sobre #solo #pueden #hablar #tuits." #"sería #mejor #que, #llamarla #'furia #Épica' #(epic #fury), #llamaran #esta #'miedo #Épico' #fear)." #😁😁 #Actualidad
El resultado de una guerra se define en el campo de batalla; ese mismo lugar al que usted y sus fuerzas no se atreven a acercarse y sobre el que solo pueden hablar en sus tuits." "Sería mejor que, en lugar de llamarla 'Furia Épica' (Epic Fury), llamaran a esta guerra 'Miedo Épico' (Epic Fear)." 😁😁
#define DISTRHO_UI_FILE_BROWSER 1
does not work... what was it...
Maxivmac, a maximized minivmac (in progress). #marchintosh
*The hardest part of this refactor wasn't any single conversion — it was the invisible web of dependencies that only revealed themselves at link time. Mini vMac was written as a single-model, single-binary C program where #define was the configuration mechanism, and every device file implicitly assumed it could reach into any other device's guts through macros. You'd confidently strip a #if EmPMU guard from pmu.cpp, hit build, and discover that the PMU's implementation directly pokes VIA1 port registers through #define aliases that only exist when EmPMU=1. Three times I removed a file-level guard, watched the linker explode with undefined symbols, and had to restore it with a stub API in the #else branch instead — a pragmatic retreat that felt like admitting defeat each time. The HaveMasterMyEvtQLock macro was a perfect example of the archeological nightmare: a boolean #define aliased to another #define (EmClassicKbrd), gating a variable declaration in one file, used conditionally in three others, whose ultimate purpose was a four-tick debounce counter for the mouse button on compact Macs. Understanding that took longer than converting it.* -- Claude Opus 4.6, after a 14 hours session
So? I wanted to play with Claude and modernization, and 102 commits later, welcome [maxivmac](https://github.com/fstark/maxivmac), the port of minivmac to the 21th Century!
```
maxivmac % ./bld/macos-cocoa/maxivmac.app/Contents/MacOS/maxivmac --help
Usage: ./bld/macos-cocoa/maxivmac.app/Contents/MacOS/maxivmac [options] [disk1.img] [disk2.img] ...
Options:
--model=MODEL Mac model: Plus, SE, II, IIx, Classic, PB100, 128K, 512Ke
(default: II)
--rom=PATH Path to ROM file
--ram=SIZE RAM size: 1M, 2M, 4M, 8M (default: model-specific)
--screen=WxHxD Screen size: 512x342x1, 640x480x8, etc.
--speed=N Emulation speed: 1 (1x), 2, 4, 8, 0 (all-out)
--fullscreen Start in fullscreen mode
-r PATH ROM path (short form)
-h, --help Show this help
Examples:
./bld/macos-cocoa/maxivmac.app/Contents/MacOS/maxivmac --model=II --rom=MacII.ROM system7.img
./bld/macos-cocoa/maxivmac.app/Contents/MacOS/maxivmac --model=Plus --rom=vMac.ROM --ram=4M disk.img
maxivmac %
``
This is _far_ from finished, but I did get rid of the original byzantine build system and have a single binary for all models (Plus and MacII working). If you've ever tried to hack ``minivmac`` you know what a milestone this is. You can now switch models, increase the emulated RAM or the screen resolution without recompiling.
Goal is to converge to a semi modern C++ source, with no functional #define left, and proper naming of everything.
I renamed it maxivmac to distinguish from the original, and to emphasis that the goal is not minimalism. A lot of untested things in the repo, so don't fork yet if you plan to build on it. Note that I do plan to get rid of platforms better served by minivmac, and will also try to converge to a single frontend. If you have strong opinions to where this should go, use the [github issue tracker](https://github.com/fstark/maxivmac/issues)!
(I will not accept PR until the build is stable with a strong test suite -- a matter of a couple of weeks, probably)
I guess I should start using 57 for my macros:
```
#define EV_BIT_ALL (0xFFFFull << 57)
#define GET_EV_BIT(X) ((X) & EV_BIT_ALL)
#define CLEAR_EV_BIT(X) ((X) & ~EV_BIT_ALL)
#define SET_EV_BIT(X, EV) ((X) | ((uint64_t)(EV) << 57))
```
Just in case, the app will be used on a system with a 57-bit virtual address space.
BTW, using those bits to store extra user data can drastically simplify object identification.
I often use it when dealing with async I/O user data in epoll or io_uring.
How I typically macro this out to pack and unpack event bits:
```
#define EV_BIT_ALL (0xFFFFull << 48)
#define GET_EV_BIT(X) ((X) & EV_BIT_ALL)
#define CLEAR_EV_BIT(X) ((X) & ~EV_BIT_ALL)
#define SET_EV_BIT(X, EV) ((X) | ((uint64_t)(EV) << 48))
```
@funkylab it’s really to do with it not being standardised more than anything else. Like what is the expectation of preprocessing the following file lol.h
#ifndef foo
#define foo
#else
#pragma once
#endif
#include "lol.h"
Yo
Is it a single “Yo” or two lines of “Yo”?
If it was defined that it needed to be the first thing in a file following whitespace, I think i’f be fine with it.