The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

SystemC::Vregs::Language - File processing for various Languages

SYNOPSIS

    use SystemC::Vregs::Language;

    my $fh = SystemC::Vregs::Language->new (filename=>"foo.c",
                                            language=>'C',);
    $fh->comment ("This file is generated automatically\n");
    $fh->define ("TRUE",1, "Set true");
    $fh->print ("void main();\n");

DESCRIPTION

This package creates a file handle with language specific semantics. This allows similar operators to be called, such as comment, for many different file formats.

The output data is stored in an array and dumped when the file is complete. This allows the file to only be written if the data changes, to reduce makefile rebuilding.

FIELDS

These fields may be specified with the new() function.

filename

The filename to write the data to.

keep_timestamp

If true, the file will only be written if the data being written differs from the present file contents.

language

The language for the file. May be C, Perl, Assembler, TCL, or Verilog. A new language Foo may be defined by making a SystemC::Vregs::Language::Foo class which is an @ISA of SystemC::Vregs::Language.

ACCESSORS

language

Returns the type of file, for example 'C'.

OUTPUT FUNCTIONS

comment

Output a string with the appropriate comment delimiters.

comment_pre

Output a comment and Doxygen document before-the-fact.

comment_post

Output a comment and Doxygen document after-the-fact.

include_guard

Output a standard #ifndef around the file to prevent multiple inclusion. Closing the file will automatically add the #endif

sprint_hex_value

Return a string representing the value as a hex number. Second argument is number of bits.

preproc

Output a preprocessor directive.

print

Output plain text. This function is called by all other functions. You will probably want to make a inherited class and override this method.

printf

Output printf text.

DISTRIBUTION

The latest version is available from CPAN and from http://www.veripool.com/.

Copyright 2001-2005 by Wilson Snyder. This package is free software; you can redistribute it and/or modify it under the terms of either the GNU Lesser General Public License or the Perl Artistic License.

AUTHORS

Wilson Snyder <wsnyder@wsnyder.org>

SEE ALSO

SystemC::Vregs, IO::File