Skip to content

Generator: beautify C output for readability and debugging#457

Open
chqrlie wants to merge 1 commit intoc2lang:masterfrom
chqrlie:beautify-c-output
Open

Generator: beautify C output for readability and debugging#457
chqrlie wants to merge 1 commit intoc2lang:masterfrom
chqrlie:beautify-c-output

Conversation

@chqrlie
Copy link
Contributor

@chqrlie chqrlie commented Mar 9, 2026

  • add indent field in Genrerator (only used for initializers for now)
  • fix indentation of initializers
  • improve initializers output, use multi-column when possible
  • try and output integers with same number of digits as source code
  • add string_buffer.Buf.atBOL() to test if at beginning of line
  • add string_buffer.Buf.getColumn() returns the current zero-based column
  • fix crash bug in printBinary(): tmp array length was too small!

@chqrlie chqrlie force-pushed the beautify-c-output branch 3 times, most recently from d82ca96 to 439ca3a Compare March 10, 2026 15:50
* add `indent` field in `Generator` (only used for initializers for now)
* fix indentation of initializers
* improve initializers output, use multi-column when possible
* try and output integers with same number of digits as source code
* add `string_buffer.Buf.atBOL()` to test if at beginning of line
* add `string_buffer.Buf.getColumn()` returns the current zero-based column
* fix crash bug in `printBinary()`: `tmp` array length was too small!
* handle c2i generator too
@chqrlie chqrlie force-pushed the beautify-c-output branch from 439ca3a to 08662dc Compare March 12, 2026 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant