Code Beautify - ähnlich Emacs VHDL Mode

Gast #2988585
Lesenswert?

Hi,

es gibt ein Perl Modul 
(http://search.cpan.org/~mykl/Hardware-Vhdl-Tidy-0.8/), das habe ich mal 
probiert.
Es sorgt zwar für einigermaßen gutes Indenting, aber eine sauber 
geordnete Port Map oder Entity mit ausgerichteten Elementen (alle bei => 
ausgerichtet) schafft es nicht.
Aber vielleicht kann man es ja dafür aufbohren?


[perl]
#!/usr/bin/perl

# 
http://search.cpan.org/~mykl/Hardware-Vhdl-Tidy-0.8/lib/Hardware/Vhdl/Tidy.pm



#  Retrieve command line argument
#
#use strict;
use IO::File;
use Hardware::Vhdl::Tidy qw/ tidy_vhdl_file /;

my $file = $ARGV[0];

# check to see if the user entered a file name.
die "syntax: [perl] vhdl_tb.pl existing_file.vhd\n" if ($file eq "");

my $old_file = join "_", $file, "old";
my $tempfile = join ".",$old_file,"vhd";
#my $tempfile = IO::File->new_tmpfile;

die "Oops! A file called '$new_file.vhd' already exists.\n" if -e 
$old_file_vhd;


# -----------------------------------------------------
# Tidying original and dumping output into a temp file
# -----------------------------------------------------
    tidy_vhdl_file( {
        source               => $file,
        destination          => $tempfile,
        # the following args are optional, and the values shown are the 
defaults:
        indent_spaces        => 4,
        cont_spaces          => 0,
        tab_spaces           => 4,
        starting_indentation => 0,
        preprocessor_prefix  => '#',
        indent_preprocessor  => 0,
    } );
# -----------------------------------------------------
[/perl]
Gast #2989304
Lesenswert?

Ja Sigasi kann das, aber wenn der Arbeitgeber dafür keine Lizenz 
rausrückt, die freie Lizenz nicht reicht oder einfach eine Installation 
nicht erlaubt dann nützt ihm das auch nichts.

Außerdem das ganze per Script zu machen gibt sehr viel Flexibilität für 
große Entwicklungsprojekten und automatisierten Toolchains.

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren