apps/macros.inc: add new macro "format" #538

Merged
Burer merged 3 commits from add_format_macro_1 into main 2026-07-10 11:28:32 +00:00
Owner

A new macro "format" has been added, adding the implementation of MENUET01, MENUET02 and KX formats.
task: #245

A new macro "format" has been added, adding the implementation of MENUET01, MENUET02 and KX formats. task: https://git.kolibrios.org/KolibriOS/kolibrios/issues/245
Doczom requested review from Ghost 2026-06-29 11:08:13 +00:00
Doczom requested review from Ghost 2026-06-29 11:08:14 +00:00
Burer changed title from App/macros.inc: A new macro "format" has been added to apps/macros.inc: add new macro "format" 2026-06-30 06:21:49 +00:00
Burer requested changes 2026-06-30 07:05:49 +00:00
Dismissed
Burer left a comment
Owner

Minor hygiene items for the format macro (none block the design, just polish):

  • Bare err without a message in the stack and main_entry re-declaration branches - give them diagnostics like the others (e.g. err 'ERROR: stack size already set', err 'ERROR: main entry already set').

  • Remove commented-out dead code: ;err 'FORMAT NOT SUPPORTED. This format for gcc toolchain' (in the 02 branch) and ;load __tmp_main dword from meos_header.02.main (in postpone).

  • Unclear message 'data import defined, format supported before one import table' (appears in both the KX and 02 branches) - reads awkwardly; suggest 'import table already defined; only one is supported'.

  • Trailing space in 'ERROR: Re-declaring the entry point '.

  • Inconsistent error-message style - some use an ERROR: prefix, some don't. Better to use unified DBGBOARD prefix E: .

  • section silently ignores its argument (name/attributes) and only aligns to 16 bytes. Fine for a flat format, but add a short comment so callers know the name/flags are dropped.

  • data fixups is accepted but records nothing** (sets the "good" flag and returns), whereas data export errors out. Clarify the intent with a comment (deliberate no-op?).

  • Re-declaration guards bypassable at the default value: entry/stack compare against the default, so setting the entry to entry_ptr's address, or stack 2048, leaves the guard unlocked and allows a second call. Minor edge case.

Minor hygiene items for the `format` macro (none block the design, just polish): - [x] **Bare `err` without a message** in the `stack` and `main_entry` re-declaration branches - give them diagnostics like the others (e.g. `err 'ERROR: stack size already set'`, `err 'ERROR: main entry already set'`). - [x] **Remove commented-out dead code**: `;err 'FORMAT NOT SUPPORTED. This format for gcc toolchain'` (in the `02` branch) and `;load __tmp_main dword from meos_header.02.main` (in `postpone`). - [x] **Unclear message** `'data import defined, format supported before one import table'` (appears in both the KX and 02 branches) - reads awkwardly; suggest `'import table already defined; only one is supported'`. - [x] **Trailing space** in `'ERROR: Re-declaring the entry point '`. - [x] **Inconsistent error-message style** - some use an `ERROR:` prefix, some don't. ~~Better to use unified DBGBOARD prefix `E: `.~~ - [x] **`section` silently ignores its argument** (name/attributes) and only aligns to 16 bytes. Fine for a flat format, but add a short comment so callers know the name/flags are dropped. - [x] ~~`data fixups` is accepted but records nothing** (sets the "good" flag and returns), whereas `data export` errors out. Clarify the intent with a comment (deliberate no-op?).~~ - [x] ~~**Re-declaration guards bypassable at the default value**: `entry`/`stack` compare against the default, so setting the entry to `entry_ptr`'s address, or `stack 2048`, leaves the guard unlocked and allows a second call. Minor edge case.~~
Author
Owner

data fixups / end data используется для многих форматов для автоматической генерации таблицы релокации. В данном случае секция представляет собой заглушку на на случай, если всё же предстоит переход на PE или ELF форматы исполняемых файлов

data fixups / end data используется для многих форматов для автоматической генерации таблицы релокации. В данном случае секция представляет собой заглушку на на случай, если всё же предстоит переход на PE или ELF форматы исполняемых файлов
Doczom requested review from Burer 2026-07-01 13:57:41 +00:00
Burer approved these changes 2026-07-01 17:51:42 +00:00
Owner

Is there any example how to use it?

Is there any example how to use it?
Owner

Is there any example how to use it?

include 'macros.inc'

format  meos KX
entry   start
stack   512


section '.text'
start:
        mcall   -1

section '.import'
data    import
library box_lib         , 'box_lib.obj', \
        proc_lib        , 'proc_lib.obj'

import  proc_lib, \
        OpenDialog_Init     , 'OpenDialog_init',\
        OpenDialog_Start    , 'OpenDialog_start'

import  box_lib,\
        frame_draw      , 'frame_draw'
> Is there any example how to use it? ```asm include 'macros.inc' format meos KX entry start stack 512 section '.text' start: mcall -1 section '.import' data import library box_lib , 'box_lib.obj', \ proc_lib , 'proc_lib.obj' import proc_lib, \ OpenDialog_Init , 'OpenDialog_init',\ OpenDialog_Start , 'OpenDialog_start' import box_lib,\ frame_draw , 'frame_draw' ```
Author
Owner

This macro is an alternative to the current macros MEOS_APP_START, __header and related ones.

This macro is an alternative to the current macros MEOS_APP_START, __header and related ones.
Burer added 3 commits 2026-07-10 09:05:22 +00:00
A new macro "format" has been added, adding the implementation of MENUET01, MENUET02 and KX formats.
App/macros.inc: fix grammar in format macro messages
Test PR / Build (ru_RU) (pull_request) Successful in 4m46s
Test PR / Build (es_ES) (pull_request) Successful in 4m49s
Test PR / Build (en_US) (pull_request) Successful in 4m53s
8019bd0184
Burer force-pushed add_format_macro_1 from 7adc8b5159 to 8019bd0184 2026-07-10 09:05:22 +00:00 Compare
Sweetbread reviewed 2026-07-10 11:13:14 +00:00
@@ -364,0 +376,4 @@
org 0
stack_size = 2048
default_stack_size = stack_size
default_entry = entry_ptr
Owner

Remove extra space

Remove extra space
Sweetbread approved these changes 2026-07-10 11:13:19 +00:00
Burer merged commit 08de8bcceb into main 2026-07-10 11:28:32 +00:00
Burer deleted branch add_format_macro_1 2026-07-10 11:28:32 +00:00
Sign in to join this conversation.
No Reviewers
KolibriOS/Developers
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: KolibriOS/kolibrios#538