Skip to content

Conversation

@LukeSerne
Copy link
Contributor

@LukeSerne LukeSerne commented Dec 29, 2025

Fixes #1299

This pull request adds a space after the commas in every function call in the pseudo-C emitted by the decompiler, as well as in the function prototype in the pseudo-C.

This patch is based on a comment by @jonpalmisc in the linked issue. This patch also adds a new OpToken type for the comma token, that is treated like OpToken::binary, but instead of printing spaces both before and after the token, the spaces are only printed after the token.

Before

void move_player(map_s *map,int dx,int dy)

{
  bool bVar1;
  int iVar2;
  int iVar3;
  
  iVar2 = dx + player_x;
  iVar3 = dy + player_y;
  bVar1 = can_move(map,iVar2,iVar3);
  if (bVar1)
  {
    player_x = iVar2;
    player_y = iVar3;
    pick_up_item(map);
  }
  else
  {
    builtin_strncpy(last_message,"Du kan ikke gå derhen!",0x18);
  }
  return;
}

After

void move_player(map_s *map, int dx, int dy)

{
  bool bVar1;
  int iVar2;
  int iVar3;
  
  iVar2 = dx + player_x;
  iVar3 = dy + player_y;
  bVar1 = can_move(map, iVar2, iVar3);
  if (bVar1)
  {
    player_x = iVar2;
    player_y = iVar3;
    pick_up_item(map);
  }
  else
  {
    builtin_strncpy(last_message, "Du kan ikke gå derhen!", 0x18);
  }
  return;
}

@astrelsky
Copy link
Contributor

This is the most important pull request.

Also adds a space after the comma in the function prototype. This patch
adds a new OpToken type for the comma token, that is treated like
"OpToken::binary", but instead of printing spaces both before and after
the token, the spaces are only printed after the token.
@LukeSerne LukeSerne force-pushed the decomp-add-space-after-comma branch from 39b938a to 456db5a Compare December 29, 2025 18:47
@ryanmkurtz ryanmkurtz added Feature: Decompiler Status: Triage Information is being gathered labels Dec 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature: Decompiler Status: Triage Information is being gathered

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add blank spacing between commas and params in function params sequences

4 participants