logicalline

logicalline

part of shnell – a source to source compiler enhancement tool

© Jens Gustedt, 2020

A directive to put all depending code on a logical line, joined by terminating backslashes

Usage:

#pragma CMOD amend logicalline

The primary use case for this is to compose macro definitions for code that just should be preprocessed by shnell, but that should remain readable. Example:

#pragma CMOD amend oneline
#define ARRAY
(double){
#pragma CMOD amend do I = 3
[${I}] = ${I},
#pragma CMOD done
}
#pragma CMOD done

This should be rewritten to something like

#define ARRAY \
(double){      \
[0] = 0,       \
[1] = 1,       \
[2] = 2,       \
}

Line directives that are mingled within are removed.

Just as in normal macro definitions, the subject code must not have C++ style comments.

Coding and configuration

The following code is needed to enable the sh-module framework.

SRC="$_" . "${0%%/${0##*/}}/import.sh"

Imports

The following sh-modules are imported:

Details