Public Member Functions

HFile Class Reference

Inheritance diagram for HFile:

Public Member Functions

 HFile ()
 parse_file ($file)
 to_perl ($stub, $tofile=1)
 to_php ($stub, $tofile=1)
 _get_categories ()
 _dump_linkscripts ()
 _dump_perl_linkscripts ()
 _dump_perl_defaultscripts ()
 _dump_colours ()
 _dump_var ($variable, $name)
 _dump_array ($array, $name)
 _dump_perl_array ($array, $name)
 _dump_hash ($hash, $name)
 _dump_perl_hash ($hash, $name)

Detailed Description

Definition at line 21 of file HFile.php.


Member Function Documentation

HFile::_dump_array ( array,
name 
)

Definition at line 232 of file HFile.php.

Referenced by _dump_colours(), and to_php().

        {
                $first = 1;
                print $name."   = array(";
                foreach($array as $a)
                {
                        if (!$first) print ", "; else $first = 0;
                        print "\"".addslashes($a)."\"";
                }
                print ");\n";
        }

Here is the caller graph for this function:

HFile::_dump_colours (  ) 

Definition at line 217 of file HFile.php.

References _dump_array().

Referenced by to_php().

        {
                $usedcols = array();
                foreach($this->used_categories as $c)
                {
                        array_push($usedcols, $this->colours[$c-1]);
                }
                $this->_dump_array($usedcols, "\$this->colours        ");
        }

Here is the call graph for this function:

Here is the caller graph for this function:

HFile::_dump_hash ( hash,
name 
)

Definition at line 256 of file HFile.php.

Referenced by _dump_linkscripts(), and to_php().

        {
                $first = 1;
                print $name."   = array(";
                foreach(array_keys($hash) as $k)
                {
                        if (!$first) print ", "; else $first = 0;
                        print "\n                       \"".addslashes($k)."\"";
                        print " => \"".addslashes($hash[$k])."\"";
                }
                print ");\n";
        }

Here is the caller graph for this function:

HFile::_dump_linkscripts (  ) 

Definition at line 177 of file HFile.php.

References _dump_hash().

Referenced by to_php().

        {
                print "
# Each category can specify a PHP function that takes in the function name, and returns a string
# to put in its place. This can be used to generate links, images, etc.\n\n";
                
                $linkhash = array();
                
                foreach($this->used_categories as $c)
                {
                        $linkhash{$c} = "donothing";
                }
                
                $this->_dump_hash($linkhash, "\$this->linkscripts    ");
                print "}\n";
                print "\n# DoNothing link function\n\n";
                print "function donothing(\$keywordin)\n{\n     return \$keywordin;\n}\n";
        }

Here is the call graph for this function:

Here is the caller graph for this function:

HFile::_dump_perl_array ( array,
name 
)

Definition at line 244 of file HFile.php.

Referenced by to_perl().

        {
                $first = 1;
                print $name."   = [";
                foreach($array as $a)
                {
                        if (!$first) print ", "; else $first = 0;
                        print "\"".addslashes($a)."\"";
                }
                print "];\n";
        }

Here is the caller graph for this function:

HFile::_dump_perl_defaultscripts (  ) 

Definition at line 211 of file HFile.php.

Referenced by to_perl().

        {
                print "\n# DoNothing link function\n\n";
                print "sub donothing\n{\nmy ( \$self ) = @_;\nreturn;\n}\n";
        }

Here is the caller graph for this function:

HFile::_dump_perl_hash ( hash,
name 
)

Definition at line 269 of file HFile.php.

Referenced by _dump_perl_linkscripts(), and to_perl().

        {
                $first = 1;
                print $name."   = {";
                foreach(array_keys($hash) as $k)
                {
                        if (!$first) print ", "; else $first = 0;
                        print "\n                       \"".addslashes($k)."\"";
                        print " => \"".addslashes($hash[$k])."\"";
                }
                print "};\n";
        }

Here is the caller graph for this function:

HFile::_dump_perl_linkscripts (  ) 

Definition at line 196 of file HFile.php.

References _dump_perl_hash().

Referenced by to_perl().

        {
                print "
# Each category can specify a Perl function that takes in the function name, and returns a string
# to put in its place. This can be used to generate links, images, etc.\n\n";

                $linkhash = array();
                foreach($this->used_categories as $c)
                {
                        $linkhash{$c} = "donothing";
                }

                $this->_dump_perl_hash($linkhash, "\$self->{linkscripts}        ");
        }

Here is the call graph for this function:

Here is the caller graph for this function:

HFile::_dump_var ( variable,
name 
)

Definition at line 227 of file HFile.php.

Referenced by to_perl(), and to_php().

        {
                print $name."   = \"".addslashes($variable)."\";\n";
        }

Here is the caller graph for this function:

HFile::_get_categories (  ) 

Definition at line 165 of file HFile.php.

Referenced by to_perl(), and to_php().

        {
                $usedcats = array();
                
                foreach(array_keys($this->keywords) as $k)
                {
                        $cat = $this->keywords[$k];
                        if (!in_array($cat, $usedcats)) array_push($usedcats, $cat);
                }
                return $usedcats;
        }

Here is the caller graph for this function:

HFile::HFile (  ) 

Definition at line 24 of file HFile.php.

Referenced by HFile_4dos4nt::HFile_4dos4nt(), HFile_4gl::HFile_4gl(), HFile_6502::HFile_6502(), HFile_6809::HFile_6809(), HFile_abb::HFile_abb(), HFile_acl::HFile_acl(), HFile_acpi::HFile_acpi(), HFile_ada95::HFile_ada95(), HFile_adsp2181::HFile_adsp2181(), HFile_ahdl::HFile_ahdl(), HFile_alphascript::HFile_alphascript(), HFile_aml::HFile_aml(), HFile_ampl::HFile_ampl(), HFile_amtrix::HFile_amtrix(), HFile_ansys::HFile_ansys(), HFile_apdl::HFile_apdl(), HFile_arm::HFile_arm(), HFile_asm167::HFile_asm167(), HFile_asm2106::HFile_asm2106(), HFile_asm21xx::HFile_asm21xx(), HFile_asm515c::HFile_asm515c(), HFile_asm6502::HFile_asm6502(), HFile_asm68hc11::HFile_asm68hc11(), HFile_asm68Hc908::HFile_asm68Hc908(), HFile_asm75::HFile_asm75(), HFile_asm8051::HFile_asm8051(), HFile_asm_x86::HFile_asm_x86(), HFile_asmavr::HFile_asmavr(), HFile_asmdsp56k::HFile_asmdsp56k(), HFile_asmf240::HFile_asmf240(), HFile_asmh8s::HFile_asmh8s(), HFile_asmmpc860::HFile_asmmpc860(), HFile_asmrds500::HFile_asmrds500(), HFile_asms370::HFile_asms370(), HFile_asmz80::HFile_asmz80(), HFile_aspjscript::HFile_aspjscript(), HFile_aspvb::HFile_aspvb(), HFile_aspvbhtml::HFile_aspvbhtml(), HFile_aspvbscript::HFile_aspvbscript(), HFile_autolisp::HFile_autolisp(), HFile_avenue::HFile_avenue(), HFile_awk::HFile_awk(), HFile_baan3::HFile_baan3(), HFile_baanc::HFile_baanc(), HFile_baanerp::HFile_baanerp(), HFile_bash::HFile_bash(), HFile_batch::HFile_batch(), HFile_bibtex::HFile_bibtex(), HFile_bkm::HFile_bkm(), HFile_bkshell::HFile_bkshell(), HFile_bm::HFile_bm(), HFile_c::HFile_c(), HFile_c167complink::HFile_c167complink(), HFile_c_winapi::HFile_c_winapi(), HFile_caopenroad401::HFile_caopenroad401(), HFile_carealizer20::HFile_carealizer20(), HFile_cf45::HFile_cf45(), HFile_cfm45::HFile_cfm45(), HFile_clarion::HFile_clarion(), HFile_clariontemplate::HFile_clariontemplate(), HFile_clearbasic::HFile_clearbasic(), HFile_clipper::HFile_clipper(), HFile_clips::HFile_clips(), HFile_cobol::HFile_cobol(), HFile_coldfusion431::HFile_coldfusion431(), HFile_config::HFile_config(), HFile_corba::HFile_corba(), HFile_cpp::HFile_cpp(), HFile_cppheader::HFile_cppheader(), HFile_cppsource::HFile_cppsource(), HFile_csharp::HFile_csharp(), HFile_css::HFile_css(), HFile_cuesheet::HFile_cuesheet(), HFile_dataflex::HFile_dataflex(), HFile_db4web::HFile_db4web(), HFile_dbc::HFile_dbc(), HFile_dcal::HFile_dcal(), HFile_delphi::HFile_delphi(), HFile_dibol::HFile_dibol(), HFile_directives::HFile_directives(), HFile_dosbatch::HFile_dosbatch(), HFile_dsp5600::HFile_dsp5600(), HFile_dtd::HFile_dtd(), HFile_dxl::HFile_dxl(), HFile_eiffel::HFile_eiffel(), HFile_epld::HFile_epld(), HFile_escript::HFile_escript(), HFile_esprit::HFile_esprit(), HFile_euphoria::HFile_euphoria(), HFile_express::HFile_express(), HFile_fame::HFile_fame(), HFile_fas::HFile_fas(), HFile_flagship::HFile_flagship(), HFile_flisp::HFile_flisp(), HFile_focus::HFile_focus(), HFile_fortran90::HFile_fortran90(), HFile_foxpro::HFile_foxpro(), HFile_foxpro26::HFile_foxpro26(), HFile_foxpro6::HFile_foxpro6(), HFile_framescript::HFile_framescript(), HFile_gdl::HFile_gdl(), HFile_ged2html::HFile_ged2html(), HFile_gedcom::HFile_gedcom(), HFile_hamster::HFile_hamster(), HFile_hartddl::HFile_hartddl(), HFile_haskell::HFile_haskell(), HFile_html::HFile_html(), HFile_htmlphpsql::HFile_htmlphpsql(), HFile_hugo::HFile_hugo(), HFile_i4gl::HFile_i4gl(), HFile_ib_sql::HFile_ib_sql(), HFile_ibis::HFile_ibis(), HFile_ibmnetdata::HFile_ibmnetdata(), HFile_idl::HFile_idl(), HFile_inform::HFile_inform(), HFile_inform6::HFile_inform6(), HFile_ini::HFile_ini(), HFile_installshield::HFile_installshield(), HFile_jasmin::HFile_jasmin(), HFile_java122::HFile_java122(), HFile_javascript::HFile_javascript(), HFile_javascript_wmls::HFile_javascript_wmls(), HFile_javaswing::HFile_javaswing(), HFile_javatimeiq::HFile_javatimeiq(), HFile_jg_mac::HFile_jg_mac(), HFile_jhtml::HFile_jhtml(), HFile_jscript::HFile_jscript(), HFile_jsp::HFile_jsp(), HFile_kixtart::HFile_kixtart(), HFile_latex::HFile_latex(), HFile_ldap::HFile_ldap(), HFile_ldif::HFile_ldif(), HFile_lingo::HFile_lingo(), HFile_linker::HFile_linker(), HFile_lisp::HFile_lisp(), HFile_logic::HFile_logic(), HFile_lotusscript::HFile_lotusscript(), HFile_lpc::HFile_lpc(), HFile_lumonics::HFile_lumonics(), HFile_makefile::HFile_makefile(), HFile_map::HFile_map(), HFile_mapbasic::HFile_mapbasic(), HFile_masm::HFile_masm(), HFile_mason::HFile_mason(), HFile_mathml::HFile_mathml(), HFile_matlab5::HFile_matlab5(), HFile_maxscript::HFile_maxscript(), HFile_maya::HFile_maya(), HFile_me10macro::HFile_me10macro(), HFile_MFL::HFile_MFL(), HFile_microchp::HFile_microchp(), HFile_millg::HFile_millg(), HFile_mincdsl::HFile_mincdsl(), HFile_miva::HFile_miva(), HFile_modula::HFile_modula(), HFile_modula2::HFile_modula2(), HFile_motivemaps::HFile_motivemaps(), HFile_msgbuilder::HFile_msgbuilder(), HFile_mssql7::HFile_mssql7(), HFile_mudmaster::HFile_mudmaster(), HFile_mumps::HFile_mumps(), HFile_mysql::HFile_mysql(), HFile_nc::HFile_nc(), HFile_netcdf::HFile_netcdf(), HFile_neuronc::HFile_neuronc(), HFile_nfl::HFile_nfl(), HFile_nt_cmd::HFile_nt_cmd(), HFile_ocaml::HFile_ocaml(), HFile_oemsetup::HFile_oemsetup(), HFile_omnimark::HFile_omnimark(), HFile_openroad::HFile_openroad(), HFile_opl::HFile_opl(), HFile_palmrsc::HFile_palmrsc(), HFile_paradox::HFile_paradox(), HFile_pascal::HFile_pascal(), HFile_passport::HFile_passport(), HFile_patrol::HFile_patrol(), HFile_pbasic::HFile_pbasic(), HFile_pearl::HFile_pearl(), HFile_peoplesoftsqr::HFile_peoplesoftsqr(), HFile_perl::HFile_perl(), HFile_php3::HFile_php3(), HFile_phphtml::HFile_phphtml(), HFile_pl1::HFile_pl1(), HFile_plain::HFile_plain(), HFile_pli::HFile_pli(), HFile_plm::HFile_plm(), HFile_plsql::HFile_plsql(), HFile_postscript::HFile_postscript(), HFile_powerbuilder7::HFile_powerbuilder7(), HFile_progress83::HFile_progress83(), HFile_providex::HFile_providex(), HFile_python::HFile_python(), HFile_qbasic::HFile_qbasic(), HFile_quake::HFile_quake(), HFile_realpix::HFile_realpix(), HFile_realtext::HFile_realtext(), HFile_rebol::HFile_rebol(), HFile_rexx::HFile_rexx(), HFile_rmanint::HFile_rmanint(), HFile_rmanshader::HFile_rmanshader(), HFile_rtf::HFile_rtf(), HFile_s::HFile_s(), HFile_sacs4::HFile_sacs4(), HFile_sap::HFile_sap(), HFile_sas::HFile_sas(), HFile_scenix::HFile_scenix(), HFile_schema::HFile_schema(), HFile_scheme::HFile_scheme(), HFile_SearchScript::HFile_SearchScript(), HFile_sgml::HFile_sgml(), HFile_smil::HFile_smil(), HFile_spin::HFile_spin(), HFile_sqlnew::HFile_sqlnew(), HFile_sqr::HFile_sqr(), HFile_sybase11x::HFile_sybase11x(), HFile_sysedge::HFile_sysedge(), HFile_systempolicies::HFile_systempolicies(), HFile_tcltk::HFile_tcltk(), HFile_teradatasql::HFile_teradatasql(), HFile_tsql::HFile_tsql(), HFile_turboc::HFile_turboc(), HFile_turbopascal::HFile_turbopascal(), HFile_uemacro::HFile_uemacro(), HFile_ugapt::HFile_ugapt(), HFile_uniface6::HFile_uniface6(), HFile_uniface71::HFile_uniface71(), HFile_uniface72::HFile_uniface72(), HFile_ustnbasic::HFile_ustnbasic(), HFile_vb::HFile_vb(), HFile_vbdotnet::HFile_vbdotnet(), HFile_vbscript::HFile_vbscript(), HFile_verify::HFile_verify(), HFile_verilog::HFile_verilog(), HFile_VerityStyle::HFile_VerityStyle(), HFile_VerityTopics::HFile_VerityTopics(), HFile_vhdl::HFile_vhdl(), HFile_visdialog::HFile_visdialog(), HFile_vospl1::HFile_vospl1(), HFile_vrml::HFile_vrml(), HFile_vtml::HFile_vtml(), HFile_wap::HFile_wap(), HFile_wapscript::HFile_wapscript(), HFile_wdl::HFile_wdl(), HFile_wil::HFile_wil(), HFile_winbatch::HFile_winbatch(), HFile_winrex::HFile_winrex(), HFile_wml::HFile_wml(), HFile_xhtml10::HFile_xhtml10(), HFile_xhtml11::HFile_xhtml11(), HFile_xhtmlbasic::HFile_xhtmlbasic(), HFile_xml::HFile_xml(), HFile_xsl::HFile_xsl(), and HFile_zmud::HFile_zmud().

        {
                # Language name.
                $this->lang_name                        = "";
                # Language configuration hashtable.
                $this->indent_depth                     = 8;
                 
                $this->config                           = array();
                $color                                  = 0;
                $parsing                                = "";
                $this->validkeys                        = array();
                
                $this->indent                           = array();
                $this->unindent                         = array();
                $this->blockcommenton                   = array();
                $this->blockcommentoff                  = array();
                $this->linecommenton                    = array();
                $this->preprocessors                    = array();
                
                # Zoning
                $this->zones                            = array();
                
                # Hashtable of keywords - maps from keyword to colour.
                $this->keywords                         = array();
                
                # Used for conversion from keyword -> regexp.
                $this->keypats                          = array();
                
                # Which colours to use for each 'level'.
                $this->colours                          = array("blue", "purple", "gray", "brown", "blue", "purple", "gray", "brown");
                $this->quotecolour                      = "blue";
                $this->blockcommentcolour               = "green";
                $this->linecommentcolour                = "green";
                $this->stringchars                      = array();
                $this->delimiters                       = array();
                $this->escchar                          = "\\";
                
                # Caches for the harvesters.
                $this->comcache                         = "";
                $this->stringcache                      = "";
                
                # Toggles
                $this->perl                             = 0;
                $this->notrim                           = 0;
                $this->nocase                           = 0;
        }

Here is the caller graph for this function:

HFile::parse_file ( file  ) 

Definition at line 71 of file HFile.php.

        {
                print "This method should not be called from here, but from an extending configuration class.<br>";
        }

HFile::to_perl ( stub,
tofile = 1 
)

Definition at line 76 of file HFile.php.

References _dump_perl_array(), _dump_perl_defaultscripts(), _dump_perl_hash(), _dump_perl_linkscripts(), _dump_var(), and _get_categories().

        {
                $this->used_categories = $this->_get_categories();
                print "
package HFile::$stub;

###############################
#
# Beautifier Perl HFile
# Language: $stub
#
###############################

use Beautifier::HFile;
@ISA = qw(HFile);
sub new
{
        my( \$class ) = @_;
        my \$self = {};
        bless \$self, \$class;

        # Flags:
";
                $this->_dump_var($this->nocase,                         "       \$self->{nocase}         ");
                $this->_dump_var($this->notrim,                         "       \$self->{notrim}         ");
                $this->_dump_var($this->perl,                           "       \$self->{perl}           ");
                $this->_dump_perl_array($this->indent,                  "       \$self->{indent}         ");
                $this->_dump_perl_array($this->unindent,                "       \$self->{unindent}       ");
                $this->_dump_perl_array($this->stringchars,             "       \$self->{stringchars}    ");
                $this->_dump_perl_array($this->delimiters,              "       \$self->{delimiters}     ");
                $this->_dump_var($this->escchar,                        "       \$self->{escchar}        ");
                $this->_dump_perl_array($this->linecommenton,           "       \$self->{linecommenton}  ");
                $this->_dump_perl_array($this->blockcommenton,          "       \$self->{blockcommenton} ");
                $this->_dump_perl_array($this->blockcommentoff,         "       \$self->{blockcommentoff}");
                $this->_dump_perl_hash($this->keywords,                 "       \$self->{keywords}       ");                    
                $this->_dump_perl_linkscripts();        
print "
        return \$self;
}

";

                $this->_dump_perl_defaultscripts();
print "1;\n";
        }

Here is the call graph for this function:

HFile::to_php ( stub,
tofile = 1 
)

Definition at line 122 of file HFile.php.

References _dump_array(), _dump_colours(), _dump_hash(), _dump_linkscripts(), _dump_var(), and _get_categories().

        {
        
                
                $this->used_categories = $this->_get_categories();
                
                if ($tofile) print "<?php\n"; else print "&lt;?\n";
                print "require_once('psh.php');\n";
                print "class psh_$stub extends psh\n{\n";
                print "function psh_$stub(){\n";
                print "\$this->psh();\n";
                print "######################################\n";
                print "# Beautifier Highlighting Configuration File \n";
                print "# $this->lang_name\n";
                print "######################################\n";
                print "# Flags\n\n";
                $this->_dump_var($this->nocase,                         "\$this->nocase            ");
                $this->_dump_var($this->notrim,                         "\$this->notrim            ");
                $this->_dump_var($this->perl,                           "\$this->perl              ");
                print "\n# Colours\n\n";
                $this->_dump_colours(); 
                $this->_dump_var("blue",                                "\$this->quotecolour       ");
                $this->_dump_var("green",                               "\$this->blockcommentcolour");
                $this->_dump_var("green",                               "\$this->linecommentcolour ");
                print "\n# Indent Strings\n\n"; 
                $this->_dump_array($this->indent,                       "\$this->indent            ");
                $this->_dump_array($this->unindent,                     "\$this->unindent          ");
                print "\n# String characters and delimiters\n\n";
                $this->_dump_array($this->stringchars,                  "\$this->stringchars       ");
                $this->_dump_array($this->delimiters,                   "\$this->delimiters        ");
                $this->_dump_var  ($this->escchar,                      "\$this->escchar           ");
                print "\n# Comment settings\n\n";
                $this->_dump_array($this->linecommenton,                "\$this->linecommenton     ");
                $this->_dump_var  ($this->blockcommenton,               "\$this->blockcommenton    ");
                $this->_dump_var  ($this->blockcommentoff,              "\$this->blockcommentoff   ");
                print "\n# Keywords (keyword mapping to colour number)\n\n";
                $this->_dump_hash ($this->keywords,                     "\$this->keywords          ");
                print "\n# Special extensions\n";
                $this->_dump_linkscripts();
                print "}\n";
                if ($tofile) print "\n?>"; else print "\n?&gt;";
        }

Here is the call graph for this function:


The documentation for this class was generated from the following file: