#preprocessor

The Last Psion | Alexthelastpsion@oldbytes.space
2025-10-31

If you were writing a #compiler (or, in my case, a #preprocessor) and you had to think of a variable name for a "class" struct, but you can't use the keyword class... what would you call that variable?

Plot twist: The compiler/preprocessor is written in #ObjectPascal. (So it's actually a record, not a struct. Same difference.)

I'm currently using the variable name class_item which is a very un-Pascal identifier for many reasons. I'm thinking of using PClass or PsiClass just to get around it.

#Pascal #FreePascal

2025-10-19

Cdefer: Preprocessor mới cho C/C++ với an toàn bộ nhớ hiện đại. Cấu hình tự động, dễ sử dụng. #Cdefer #C++ #AnToànBộNhớ #Preprocessor #TINTIỆNSÁCH

reddit.com/r/programming/comme

How about a static website generator tool that is decades older than the web itself?

Tom Mason generates his blog with ... the C preprocessor. Genius:

wheybags.com/blog/macroblog.ht

#static #generator #site #preprocessor #web #website #WebsiteGenerator #Jekyll #Hugo

2025-09-17

When you've had enough of the #gcc preprocessors shtexpansion to 37000 lines, write your own good enough #preprocessor in #awk, 10 lines!! Is it all inclusive? NO, does it keep the number of lines, to, well, the number of lines and work well enough not to chew through your disk!? Absolutely!

Tired of gcc preprocessor sometimes generating 37000 lines? write your own in 10 lines of awk
2025-07-04

@CyReVolt do while(0) loop is usual trick in case of macro to be able to add semicolon after macro without complaints (and yes most people want semicolon there for *various* reason (external linters etc.)

#preprocessor sux

Brian Swetlandswetland@chaos.social
2025-07-01
#define TESTxLI(name, v) \
	name: ;\
	jal x31, @2 ;\
	.word v ;\
	ldw x20, (x31) ;\
	li x21, v ;\
	beq x20, x21, @2 ;\
	j fail

	TESTxLI(li00, 0);
	TESTxLI(li01, 42);
	TESTxLI(li02, 0x80000000)
	TESTxLI(li03, 0xa7a5a3a1)
	TESTxLI(li04, 0x00008000)
	TESTxLI(li05, 0x12340000)
	TESTxLI(li06, 0x87654321)
	TESTxLI(li07, 0xffffffff)
	TESTxLI(li08, 0xfcffffff)
2025-02-22

A lot of blog engineering today, mostly doing smart #ed hacks and dealing with the consequences.

But! I came up with a way to include arbitrary files with #ed, so it's almost as powerful as #C #Preprocessor for my purposes! (Taking file name from buffer, modifying it into a reading command and then running another ed instance over this same file with this command. And using E command to read it back from modified file.)

Next: moving all the stuff I churned out to my HTML-ish format (that I should write about someday) and then to Server Side Includes (en.m.wikipedia.org/wiki/Server) for the sake of portability?

#theWorkshop

2025-01-26

I wrote a #ML1 macro to build my #homepage, then to present the macro I wrote a #sed command, now I also include the sed script in this cursed page

ldbeth.sdf.org/mcs.html

#preprocessor #html

David Llewellyn-Jonesflypig
2024-11-13

A blog post I've been meaning to write for nearly 20 years: simple Templating in C.

I talk about how to create a simple C++ style template, but using only C code and C pre-processor macros.

Nothing groundbreaking, but a fun exercise that I found helpful in understanding templates more generally.

flypig.co.uk/blog?&list_id=120

++

Console output with two panes showing the result of executing the code in the left pane and the code from cvector.h in the right pane. The execution ends with 30 calls to the destructor of the Example class when the vector is deleted.
The Last Psion | Alexthelastpsion@oldbytes.space
2024-10-28

REPOST (JAN 2024): My first thoughts on #Psion's dialect of Object Oriented C for the Series 3 and related portable computers.

Includes the JPI/Clarion #TopSpeed #compiler, a proprietary preprocessor, the Eiffel programming language, and a handful of calling conventions.

Also, did somebody say Objective-C?

This is an old blog post from the beginning of the year. If you've been following my journey in recreating #CTRAN, this was written a week before I decided to take the plunge.

hackaday.io/project/161291-the

(Yes, I did say in the article that I definitely wouldn't be writing a compiler. I did say that.)

#RetroComputing #EPOC16 #CDECL #Clarion #TopSpeed #TopSpeedC #RetroProgramming #RetroDev #Smalltalk #ObjectPascal #preprocessor #Eiffel #OOP #ObjectiveC #compilers #ObjectOriented

Ana Tudor 🐯anatudor
2024-09-26

As someone hearted ❤️ a 2015 demo of mine, I decided that since got better (and hopefully I did too), I should go for a quick 2024 remake.

Here it is on @codepen
codepen.io/thebabydino/pen/wKo

It's mindblowing 🤯 how much I could reduce the (esp. compiled) code - check it out!

HTML by 73%!
CSS by 70%!

I repeat: I shaved off at least 70% from each! ‼️

<!-- 🚨 2015 code: HAML
.grid
	- 16.times do
		.cube
			.squisher
				- 3.times do
					.cube__face
-->
<!-- Generated HTML -->
<div class='grid'>
  <div class='cube'>
    <div class='squisher'>
      <div class='cube__face'></div>
      <div class='cube__face'></div>
      <div class='cube__face'></div>
    </div>
  </div>
  <!-- and so on, 16 times the cube block -->
</div><!-- 😍 2024 code: Pug
 - let n = 4, m = Math.pow(n, 2);

style
	- for(let i = 0; i < n; i++)
		| .cube:nth-child(#{n}n + #{i + 1}) { --i: #{i} }
		| .cube:nth-child(n + #{n*i + 1}) { --j: #{i} }
.grid(style=`--n: ${n}`)
	while m--
		.cube
-->
<!-- Generated HTML -->
<style>
  .cube:nth-child(4n + 1) { --i: 0 }
  .cube:nth-child(n + 1) { --j: 0 }
  /* and so on, for each of the 4 rows and columns */
</style>
<div class="grid" style="--n: 4">
  <div class="cube"></div>
  <!-- and so on, 16 cube elements in total -->
</div>
2024-08-23

Python’s Preprocessor

Every now and then you hear outrageous claims such as “Python has no preprocessor”.

Curly braces for blocks, increment and decrement, and C-like preprocessor directives. The most arcane Python hacks!

#python, #preprocessor

Some Bits: Nelson's Linkblogsomebitslinks@tech.lgbt
2024-08-20

Python magic codecs: Some really bonkers Python hacking using a preprocessing facility to add syntax
github.com/Tsche/magic_codec
#metaprogramming #preprocessor #python #coding #hacks #+

:gnu:Hacker :vf:Fedihacker@masto.es
2024-06-13

finally. #embed thephd.dev/finally-embed-in-c2

A story of the process of introducing a new preprocessor directive in ISO C preceded by an explanation of the directive itself.

#c23 #preprocessor

2024-03-06

I wonder if anyone has seriously thought about adding some kind of namespacing to the C preprocessor.

for example, it would be nice if you could say

FOO
"foo.h"

and then all the preprocessor defines from foo.h are brought into your file with names like FOO##

The Last Psion | Alexthelastpsion@bitbang.social
2024-03-01

I keep coming back to #ObjectiveC, but I feel that parts of the way an #ObjC #preprocessor (as it was) builds classes is similar to how #ctran worked/works for #Psion OO C.

I wonder if looking at ObjC #compiler internals would help me? Something like this:

alwaysprocessing.blog/2023/01/

Or, as I keep saying with this project, is it much simpler than I'm trying to make it?

The Last Psion | Alexthelastpsion@bitbang.social
2024-03-01

Class-building time for #ctran.

The compiler tutorials I've read don't talk about how to deal with classes and inheritance. I assume that a metaclass has to be built for each class. But should I then store those metaclasses for later use, or do I regenerate them when needed? I assume the former.

Also, my parser doesn't currently check for duplicate classes or methods (inside classes). Should it be in the parser, or should it be part of the thing that builds the output?

#compiler #preprocessor

2024-02-12

STM32. Процесс компиляции и сборки прошивки

Многие из начинающих разработчиков софта для микроконтроллеров реализуют свои проекты исключительно в средствах разработки, которые предоставляются производителем. Многое скрыто от пользователя и очень хорошо скрыто, из-за чего некоторые воспринимают эти процессы сродни настоящей магии. Я, в свою очередь, как человек в пытливым умом и природной любознательностью, решил попробовать собрать проект без использования IDE и различного рода автоматизаций. Так родилась идея для этой статьи: не используя ничего, кроме текстового редактора и командной строки, собрать проект мигания светодиодом на отладочной плате STM32F0-Discovery. Поскольку я не до конца понимал, как происходит процесс компиляции и сборки проекта, мне пришлось восполнять пробелы в знаниях. Разобравшись с этим вопросом, я подумал — а почему бы не рассказать другим об этом? Всем кому интересно — добро пожаловать под кат! 🙂

habr.com/ru/companies/timeweb/

#timeweb_статьи #STM32 #linux #ubuntu #openocd #stlink #stflash #debug #preprocessor #linker #gnuarm #gnugcc #armnoneeabi

Client Info

Server: https://mastodon.social
Version: 2025.07
Repository: https://github.com/cyevgeniy/lmst