<commit_before>/* Copyright (C) 2001-2009, Parrot Foundation. */

/*

=head1 NAME

pbc_disassemble - parrot bytecode disassembler

=head1 SYNOPSIS

pbc_disassemble [-bh?] [--bare|--header-only] [-o outfile] [file.pbc]

=head1 DESCRIPTION

C<pbc_disassemble> translates Parrot bytecode (C<PBC>) into Parrot assembly
language (C<PASM>).

C<file.pbc> is the bytecode file to disassemble. If a file is not specified, the
bytecode will be read from C<stdin>. Additionally, if the C<-o> switch is not
given, the output is displayed to C<stdout>.

=head1 OPTIONS

=over 4

=item B<-?>, B<--help>

Displays usage and help information.

=item B<-b>, B<--bare>

Displays bare PASM without the header and left column.

=item B<-h>, B<--header-only>

Displays only the constants table header.

=item B<-o> filename, B<--output> filename

Writes output to C<filename>.

=back

=head1 STATIC FUNCTIONS

=over 4

=cut

*/

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

#include "parrot/parrot.h"
#include "parrot/api.h"
#include "parrot/longopt.h"

#define PFOPT_UTILS 1

/* NOTE:
 * C<pbc_disassemble> uses the C<Parrot_disassemble()> function from F<src/embed.c>,
 * which in turn uses the C<PDB_disassemble()> function from F<src/debug.c>.
 */

/* Flags indicating the presence of the -b and -h command-line switches */
typedef enum {
    enum_DIS_BARE      = 1,    /* -b switch */
    enum_DIS_HEADER    = 2     /* -h switch */
} Parrot_disassemble_options;

/* Longopts option table */
static struct longopt_opt_decl options[] = {
    { '?', '?', OPTION_optional_FLAG, { "--help"        } },
    { 'b', 'b', OPTION_optional_FLAG, { "--bare"        } },
    { 'h', 'h', OPTION_optional_FLAG, { "--header-only" } },
    { 'o', 'o', OPTION_required_FLAG, { "--output"      } },
    {  0 ,  0,  OPTION_optional_FLAG, { NULL            } }
};

static void help(void);
static void show_last_error_and_exit(Parrot_PMC interp);
<commit_msg>Removed ctype.h from pbc_disassemble because it didn't rely on anything in it<commit_after>/* Copyright (C) 2001-2009, Parrot Foundation. */

/*

=head1 NAME

pbc_disassemble - parrot bytecode disassembler

=head1 SYNOPSIS

pbc_disassemble [-bh?] [--bare|--header-only] [-o outfile] [file.pbc]

=head1 DESCRIPTION

C<pbc_disassemble> translates Parrot bytecode (C<PBC>) into Parrot assembly
language (C<PASM>).

C<file.pbc> is the bytecode file to disassemble. If a file is not specified, the
bytecode will be read from C<stdin>. Additionally, if the C<-o> switch is not
given, the output is displayed to C<stdout>.

=head1 OPTIONS

=over 4

=item B<-?>, B<--help>

Displays usage and help information.

=item B<-b>, B<--bare>

Displays bare PASM without the header and left column.

=item B<-h>, B<--header-only>

Displays only the constants table header.

=item B<-o> filename, B<--output> filename

Writes output to C<filename>.

=back

=head1 STATIC FUNCTIONS

=over 4

=cut

*/

#include <stdio.h>
#include <stdlib.h>

#include "parrot/parrot.h"
#include "parrot/api.h"
#include "parrot/longopt.h"

#define PFOPT_UTILS 1

/* NOTE:
 * C<pbc_disassemble> uses the C<Parrot_disassemble()> function from F<src/embed.c>,
 * which in turn uses the C<PDB_disassemble()> function from F<src/debug.c>.
 */

/* Flags indicating the presence of the -b and -h command-line switches */
typedef enum {
    enum_DIS_BARE      = 1,    /* -b switch */
    enum_DIS_HEADER    = 2     /* -h switch */
} Parrot_disassemble_options;

/* Longopts option table */
static struct longopt_opt_decl options[] = {
    { '?', '?', OPTION_optional_FLAG, { "--help"        } },
    { 'b', 'b', OPTION_optional_FLAG, { "--bare"        } },
    { 'h', 'h', OPTION_optional_FLAG, { "--header-only" } },
    { 'o', 'o', OPTION_required_FLAG, { "--output"      } },
    {  0 ,  0,  OPTION_optional_FLAG, { NULL            } }
};

static void help(void);
static void show_last_error_and_exit(Parrot_PMC interp);

{'fraction_non_alphanumeric': 0.14406130268199233, 'fraction_numerical': 0.010217113665389528, 'mean_word_length': 3.480549199084668, 'pattern_counts': {'":': 0, '<': 50, '<?xml version=': 0, '>': 50, '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': '2739255', 'n_tokens_mistral': 1502, 'n_tokens_neox': 1423, 'n_words': 411}