<commit_before>/*
 * print.c
 * libpud
 *
 * Copyright (c) 2014 <NAME>
 */

#include "pud_private.h"

/* It is such a heavy function I put it in a single file */

void
pud_print(Pud  *pud,
          FILE *stream)
{
   unsigned int i, j;

   if (!stream) stream = stdout;

   fprintf(stream, "Tag ID...............: 0x%x\n", pud->tag);
   fprintf(stream, "Version..............: %x\n", pud->version);
   fprintf(stream, "Description..........: %s\n", pud->description);
   fprintf(stream, "Era..................: %s\n", pud_era2str(pud->era));
   fprintf(stream, "Dimensions...........: %s\n", dim2str(pud->dims));
   fprintf(stream, "Default ALOW.........: %i\n", pud->default_allow);
   fprintf(stream, "Default UDTA.........: %i\n", pud->default_udta);
   fprintf(stream, "Default UGRD.........: %i\n", pud->default_ugrd);

   /* OWNR Section */
   fprintf(stream, "Owners...............:\n");
   for (i = 0; i < 8; i++)
     fprintf(stream, "   player %i..........: 0x%02x\n", i + 1, pud->owner.players[i]);
   for (i = 0; i < 7; i++)
     fprintf(stream, "   unusable %i........: 0x%02x\n", i + 1, pud->owner.unusable[i]);
   fprintf(stream, "   neutral...........: 0x%02x\n", pud->owner.neutral);

   /* Side Section */
   fprintf(stream, "Sides................:\n");
   for (i = 0; i < 8; i++)
     fprintf(stream, "   player %i..........: 0x%02x\n", i + 1, pud->side.players[i]);
   for (i = 0; i < 7; i++)
     fprintf(stream, "   unusable %i........: 0x%02x\n", i + 1, pud->side.unusable[i]);
   fprintf(stream, "   neutral...........: 0x%02x\n", pud->side.neutral);

   /* SGLD Section */
   fprintf(stream, "Starting Gold........:\n");
   for (i = 0; i < 8; i++)
     fprintf(stream, "   player %i..........: %u\n", i + 1, pud->sgld.players[i]);
   for (i = 0; i < 7; i++)
     fprintf(stream, "   unusable %i........: %u\n", i + 1, pud->sgld.unusable[i]);
   fprintf(stream, "   neutral...........: %u\n", pud->sgld.neutral);

   /* SLBR section */
   fprintf(stream, "Starting Lumber......:\n");
   for (i = 0; i < 8; i++)
     fprintf(stream, "   player %i..........: %u\n", i + 1, pud->slbr.players[i]);
   for (i = 0; i < 7; i++)
     fprintf(stream, "   unusable %i........: %u\n", i + 1, pud->slbr.unusable[i]);
   fprintf(stream, "   neutral...........: %u\n", pud->slbr.neutral);

   /* SOIL section */
   fprintf(stream, "Starting Oil.........:\n");
   for (i = 0; i < 8; i++)
     fprintf(stream, "   player %i..........: %u\n", i + 1, pud->soil.players[i]);
   for (i = 0; i < 7; i++)
     fprintf(stream, "   unusable %i........: %u\n", i + 1, pud->soil.unusable[i]);
   fprintf(stream, "   neutral...........: %u\n", pud->soil.neutral);

   /* AI section */
   fprintf(stream, "AI...................:\n");
   for (i = 0; i < 8; i++)
     fprintf(stream, "   player %i..........: 0x%02x\n", i + 1, pud->ai.players[i]);
   for (i = 0; i < 7; i++)
     fprintf(stream, "   unusable %i........: 0x%02x\n", i + 1, pud->ai.unusable[i]);
   fprintf(stream, "   neutral...........: 0x%02x\n", pud->ai.neutral);

   /* ALOW section - Units & Buildings */
   fprintf(stream, "Allow Units..........:\n");
   for (i = 0; i < 8; i++)
     fprintf(stream, "   player %i..........: %s\n", i + 1, long2bin(pud->unit_alow.players[i]));
   for (i = 0; i < 7; i++)
     fprintf(stream, "   unusable %i........: %s\n", i + 1, long2bin(pud->unit_alow.unusable[i]));
   fprintf(stream, "   neutral...........: %s\n", long2bin(pud->unit_alow.neutral));

   /* ALOW section - Startup Spells */
   fprintf(stream, "Startup Spells.......:\n");
   for (i = 0; i < 8; i++)
     fprintf(stream, "   player %i..........: %s\n", i + 1, long2bin(pud->spell_start.players[i]));
   for (i = 0; i < 7; i++)
     fprintf(stream, "   unusable %i........: %s\n", i + 1, long2bin(pud->spell_start.unusable[i]));
   fprintf(stream, "   neutral...........: %s\n", long2bin(pud->spell_start.neutral));

   /* ALOW section - Spells Allowed */
   fprintf(stream, "Allow Spells.........:\n");
   for (i = 0; i < 8; i++)
     fprintf(stream, "   player %i..........: %s\n", i + 1, long2bin(pud->spell_alow.players[i]));
   for (i = 0; i < 7; i++)
     fprintf(stream, "   unusable %i........: %s\n", i + 1, long2bin(pud->spell_alow.unusable[i]));
   fprintf(stream, "   neutral...........: %s\n", long2bin(pud->spell_alow.neutral));

   /* ALOW section - Spells Researching */
   fprintf(stream, "Searching Spells.....:\n");
   for (i = 0; i < 8; i++)
     fprintf(stream, "   player %i..........: %s\n", i + 1, long2bin(pud->spell_alow.players[i]));
   for (i = 0; i < 7; i++)
     fprintf(stream, "   unusable %i........: %s\n", i + 1, long2bin(pud->spell_alow.unusable[i]));
   fprintf(stream, "   neutral...........: %s\n", long2bin(pud->spell_alow.neutral));

   /* ALOW section - Upgrades allowed */
   fprintf(stream, "Upgrades Allowed.....:\n");
   for (i = 0; i < 8; i++)
     fprintf(stream, "   player %i..........: %s\n", i + 1, long2bin(pud->up_alow.players[i]));
   for (i = 0; i < 7; i++)
     fprintf(stream, "   unusable %i........: %s\n", i + 1, long2bin(pud->up_alow.unusable[i]));
   fprintf(stream, "   neutral...........: %s\n", long2bin(pud->up_alow.neutral));

   /* ALOW section - Upgrades Researching */
   fprintf(stream, "Searching Upgrades...:\n");
   for (i = 0; i < 8; i++)
     fprintf(stream, "   player %i..........: %s\n", i + 1, long2bin(pud->up_acq.players[i]));
   for (i = 0; i < 7; i++)
     fprintf(stream, "   unusable %i........: %s\n", i + 1, long2bin(pud->up_acq.unusable[i]));
   fprintf(stream, "   neutral...........: %s\n", long2bin(pud->up_acq.neutral));

   /* UGRD Section */
   fprintf(stream, "Upgrades.............:\n");
   for (i = 0; i < 52; i++)
     {
        fprintf(stream, "   Upgrade 0x%02x......:\n", i);
        fprintf(stream, "      Time...........: %u\n", pud->upgrade[i].time);
        fprintf(stream, "      Gold...........: %u\n", pud->upgrade[i].gold);
        fprintf(stream, "      Lumber.........: %u\n", pud->upgrade[i].lumber);
        fprintf(stream, "      Oil............: %u\n", pud->upgrade[i].oil);
        fprintf(stream, "      Icon...........: %u\n", pud->upgrade[i].icon);
        fprintf(stream, "      Group..........: 0x%02x\n", pud->upgrade[i].group);
        fprintf(stream, "      Flags..........: %s\n", long2bin(pud->upgrade[i].flags));
     }

   /* Units */
   fprintf(stream, "Units................:\n");
   for (i = 0; i < pud->units_count; i++)
     {
        fprintf(stream, "   Unit %04i.........:\n", i);
        fprintf(stream, "      X,Y............: %i,%i\n", pud->units[i].x, pud->units[i].y);
        fprintf(stream, "      Type...........: %s (0x%x)\n", pud_unit2str(pud->units[i].type, PUD_TRUE), pud->units[i].type);
        fprintf(stream, "      Owner..........: 0x%x\n", pud->units[i].owner);
        fprintf(stream, "      Alter..........: %u\n", pud->units[i].alter);
     }

   /* Unit data */
   fprintf(stream, "Unit Data............:\n");
   for (i = 0; i < 110; i++)
     {
        fprintf(stream, "   Unit %02x...........:\n", i);
        fprintf(stream, "      Overlap........: %x\n", pud->unit_data[i].overlap_frames);<commit_msg>libpud: print exact number of units<commit_after>/*
 * print.c
 * libpud
 *
 * Copyright (c) 2014 <NAME>
 */

#include "pud_private.h"

/* It is such a heavy function I put it in a single file */

void
pud_print(Pud  *pud,
          FILE *stream)
{
   unsigned int i, j;

   if (!stream) stream = stdout;

   fprintf(stream, "Tag ID...............: 0x%x\n", pud->tag);
   fprintf(stream, "Version..............: %x\n", pud->version);
   fprintf(stream, "Description..........: %s\n", pud->description);
   fprintf(stream, "Era..................: %s\n", pud_era2str(pud->era));
   fprintf(stream, "Dimensions...........: %s\n", dim2str(pud->dims));
   fprintf(stream, "Default ALOW.........: %i\n", pud->default_allow);
   fprintf(stream, "Default UDTA.........: %i\n", pud->default_udta);
   fprintf(stream, "Default UGRD.........: %i\n", pud->default_ugrd);

   /* OWNR Section */
   fprintf(stream, "Owners...............:\n");
   for (i = 0; i < 8; i++)
     fprintf(stream, "   player %i..........: 0x%02x\n", i + 1, pud->owner.players[i]);
   for (i = 0; i < 7; i++)
     fprintf(stream, "   unusable %i........: 0x%02x\n", i + 1, pud->owner.unusable[i]);
   fprintf(stream, "   neutral...........: 0x%02x\n", pud->owner.neutral);

   /* Side Section */
   fprintf(stream, "Sides................:\n");
   for (i = 0; i < 8; i++)
     fprintf(stream, "   player %i..........: 0x%02x\n", i + 1, pud->side.players[i]);
   for (i = 0; i < 7; i++)
     fprintf(stream, "   unusable %i........: 0x%02x\n", i + 1, pud->side.unusable[i]);
   fprintf(stream, "   neutral...........: 0x%02x\n", pud->side.neutral);

   /* SGLD Section */
   fprintf(stream, "Starting Gold........:\n");
   for (i = 0; i < 8; i++)
     fprintf(stream, "   player %i..........: %u\n", i + 1, pud->sgld.players[i]);
   for (i = 0; i < 7; i++)
     fprintf(stream, "   unusable %i........: %u\n", i + 1, pud->sgld.unusable[i]);
   fprintf(stream, "   neutral...........: %u\n", pud->sgld.neutral);

   /* SLBR section */
   fprintf(stream, "Starting Lumber......:\n");
   for (i = 0; i < 8; i++)
     fprintf(stream, "   player %i..........: %u\n", i + 1, pud->slbr.players[i]);
   for (i = 0; i < 7; i++)
     fprintf(stream, "   unusable %i........: %u\n", i + 1, pud->slbr.unusable[i]);
   fprintf(stream, "   neutral...........: %u\n", pud->slbr.neutral);

   /* SOIL section */
   fprintf(stream, "Starting Oil.........:\n");
   for (i = 0; i < 8; i++)
     fprintf(stream, "   player %i..........: %u\n", i + 1, pud->soil.players[i]);
   for (i = 0; i < 7; i++)
     fprintf(stream, "   unusable %i........: %u\n", i + 1, pud->soil.unusable[i]);
   fprintf(stream, "   neutral...........: %u\n", pud->soil.neutral);

   /* AI section */
   fprintf(stream, "AI...................:\n");
   for (i = 0; i < 8; i++)
     fprintf(stream, "   player %i..........: 0x%02x\n", i + 1, pud->ai.players[i]);
   for (i = 0; i < 7; i++)
     fprintf(stream, "   unusable %i........: 0x%02x\n", i + 1, pud->ai.unusable[i]);
   fprintf(stream, "   neutral...........: 0x%02x\n", pud->ai.neutral);

   /* ALOW section - Units & Buildings */
   fprintf(stream, "Allow Units..........:\n");
   for (i = 0; i < 8; i++)
     fprintf(stream, "   player %i..........: %s\n", i + 1, long2bin(pud->unit_alow.players[i]));
   for (i = 0; i < 7; i++)
     fprintf(stream, "   unusable %i........: %s\n", i + 1, long2bin(pud->unit_alow.unusable[i]));
   fprintf(stream, "   neutral...........: %s\n", long2bin(pud->unit_alow.neutral));

   /* ALOW section - Startup Spells */
   fprintf(stream, "Startup Spells.......:\n");
   for (i = 0; i < 8; i++)
     fprintf(stream, "   player %i..........: %s\n", i + 1, long2bin(pud->spell_start.players[i]));
   for (i = 0; i < 7; i++)
     fprintf(stream, "   unusable %i........: %s\n", i + 1, long2bin(pud->spell_start.unusable[i]));
   fprintf(stream, "   neutral...........: %s\n", long2bin(pud->spell_start.neutral));

   /* ALOW section - Spells Allowed */
   fprintf(stream, "Allow Spells.........:\n");
   for (i = 0; i < 8; i++)
     fprintf(stream, "   player %i..........: %s\n", i + 1, long2bin(pud->spell_alow.players[i]));
   for (i = 0; i < 7; i++)
     fprintf(stream, "   unusable %i........: %s\n", i + 1, long2bin(pud->spell_alow.unusable[i]));
   fprintf(stream, "   neutral...........: %s\n", long2bin(pud->spell_alow.neutral));

   /* ALOW section - Spells Researching */
   fprintf(stream, "Searching Spells.....:\n");
   for (i = 0; i < 8; i++)
     fprintf(stream, "   player %i..........: %s\n", i + 1, long2bin(pud->spell_alow.players[i]));
   for (i = 0; i < 7; i++)
     fprintf(stream, "   unusable %i........: %s\n", i + 1, long2bin(pud->spell_alow.unusable[i]));
   fprintf(stream, "   neutral...........: %s\n", long2bin(pud->spell_alow.neutral));

   /* ALOW section - Upgrades allowed */
   fprintf(stream, "Upgrades Allowed.....:\n");
   for (i = 0; i < 8; i++)
     fprintf(stream, "   player %i..........: %s\n", i + 1, long2bin(pud->up_alow.players[i]));
   for (i = 0; i < 7; i++)
     fprintf(stream, "   unusable %i........: %s\n", i + 1, long2bin(pud->up_alow.unusable[i]));
   fprintf(stream, "   neutral...........: %s\n", long2bin(pud->up_alow.neutral));

   /* ALOW section - Upgrades Researching */
   fprintf(stream, "Searching Upgrades...:\n");
   for (i = 0; i < 8; i++)
     fprintf(stream, "   player %i..........: %s\n", i + 1, long2bin(pud->up_acq.players[i]));
   for (i = 0; i < 7; i++)
     fprintf(stream, "   unusable %i........: %s\n", i + 1, long2bin(pud->up_acq.unusable[i]));
   fprintf(stream, "   neutral...........: %s\n", long2bin(pud->up_acq.neutral));

   /* UGRD Section */
   fprintf(stream, "Upgrades.............:\n");
   for (i = 0; i < 52; i++)
     {
        fprintf(stream, "   Upgrade 0x%02x......:\n", i);
        fprintf(stream, "      Time...........: %u\n", pud->upgrade[i].time);
        fprintf(stream, "      Gold...........: %u\n", pud->upgrade[i].gold);
        fprintf(stream, "      Lumber.........: %u\n", pud->upgrade[i].lumber);
        fprintf(stream, "      Oil............: %u\n", pud->upgrade[i].oil);
        fprintf(stream, "      Icon...........: %u\n", pud->upgrade[i].icon);
        fprintf(stream, "      Group..........: 0x%02x\n", pud->upgrade[i].group);
        fprintf(stream, "      Flags..........: %s\n", long2bin(pud->upgrade[i].flags));
     }

   /* Units */
   fprintf(stream, "Units................: %u\n", pud->units_count);
   for (i = 0; i < pud->units_count; i++)
     {
        fprintf(stream, "   Unit %04i.........:\n", i);
        fprintf(stream, "      X,Y............: %i,%i\n", pud->units[i].x, pud->units[i].y);
        fprintf(stream, "      Type...........: %s (0x%x)\n", pud_unit2str(pud->units[i].type, PUD_TRUE), pud->units[i].type);
        fprintf(stream, "      Owner..........: 0x%x\n", pud->units[i].owner);
        fprintf(stream, "      Alter..........: %u\n", pud->units[i].alter);
     }

   /* Unit data */
   fprintf(stream, "Unit Data............:\n");
   for (i = 0; i < 110; i++)
     {
        fprintf(stream, "   Unit %02x...........:\n", i);
        fprintf(stream, "      Overlap........: %x\n", pud->unit_data[i].overlap_frames);
{'fraction_non_alphanumeric': 0.3009993710252289, 'fraction_numerical': 0.020406737018659585, 'mean_word_length': 1.9499072356215212, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 124, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '55485', 'n_tokens_mistral': 5614, 'n_tokens_neox': 5366, 'n_words': 1194}