Functions | Variables

syntax_highlight/php/HFile/HFile_conv.php File Reference

Go to the source code of this file.

Functions

 HFile_print_php_file ($tofile=1)
 get_categories ()
 dump_linkscripts ($cats)
 dump_colours ($cats)
 dump_var ($variable, $name)
 dump_array ($array, $name)
 dump_hash ($hash, $name)
 convert ($file)

Variables

 $BEAUT_PATH = "/syntax_highlight/php"

Function Documentation

convert ( file  ) 

Definition at line 137 of file HFile_conv.php.

References $file, and HFile_print_php_file().

                       {
  $file = str_replace("./", "", $file);
  global $LANGNAME;
  $LANGNAME = $file;
  $LANGNAME = str_replace(".txt", "", $LANGNAME);
  
  $fileout = '../object/'.$LANGNAME . '.php';

  print "Writing $file to $fileout\n";
  
        HFile_parse_file($file);

        ob_start();
        ob_implicit_flush(0);

        HFile_print_php_file(isset($fileout));
        $out = ob_get_contents();               
        ob_end_clean(); 
  
        if (isset($fileout))
        {
                $fd = fopen($fileout, "w");
                fputs($fd, $out);
                fclose($fd);
        }
  



  


}

Here is the call graph for this function:

dump_array ( array,
name 
)

Definition at line 112 of file HFile_conv.php.

Referenced by dump_colours(), and HFile_print_php_file().

{
        $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:

dump_colours ( cats  ) 

Definition at line 95 of file HFile_conv.php.

References dump_array().

Referenced by HFile_print_php_file().

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

Here is the call graph for this function:

Here is the caller graph for this function:

dump_hash ( hash,
name 
)

Definition at line 124 of file HFile_conv.php.

Referenced by dump_linkscripts(), and HFile_print_php_file().

{
        $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:

dump_linkscripts ( cats  ) 

Definition at line 75 of file HFile_conv.php.

References dump_hash().

Referenced by HFile_print_php_file().

{
        print "
// Each category can specify a PHP function that returns an altered
// version of the keyword.
        # This link is then placed in a <a href=\"...\">foo</a>; structure around keyword 'foo' - which is
        \n\n";
        
        $linkhash = array();
        
        foreach($cats as $c)
        {
                $linkhash{$c} = "donothing";
        }
        
        dump_hash($linkhash, "\$this->linkscripts    ");
        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:

dump_var ( variable,
name 
)

Definition at line 107 of file HFile_conv.php.

Referenced by HFile_print_php_file().

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

Here is the caller graph for this function:

get_categories (  ) 

Definition at line 62 of file HFile_conv.php.

References $keywords.

Referenced by HFile_print_php_file().

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

Here is the caller graph for this function:

HFile_print_php_file ( tofile = 1  ) 

Definition at line 14 of file HFile_conv.php.

References $config, $keywords, dump_array(), dump_colours(), dump_hash(), dump_linkscripts(), dump_var(), and get_categories().

Referenced by convert().

{

global $LANGNAME;
        global $indent, $unindent, $stringchars, $config, $keywords, $delimiters, $lang_name;
        global $linecommenton, $blockcommenton, $blockcommentoff;
        global $perl, $nocase, $notrim;
        if ($tofile) print "<?php\n"; else print "&lt;?\n";
        
        print 'require_once(\'HFile.php\');'."\n";
        print '  class HFile_'.$LANGNAME.' extends HFile{'."\n";
        print '   function HFile_'.$LANGNAME.'(){'."\n";
        print '     $this->HFile();     '."\n";

        
        
        print "######################################\n";
        print "# Beautifier Highlighting Configuration File \n";
        print "# $lang_name\n";
        print "######################################\n";
        print "# Flags\n\n";
        dump_var($nocase,                       "\$this->nocase            ");
        dump_var($notrim,                       "\$this->notrim            ");
        dump_var($perl,                         "\$this->perl              ");
        print "\n# Colours\n\n";
        $used_categories = get_categories();
        dump_colours($used_categories);
        dump_var("blue",                        "\$this->quotecolour       ");
        dump_var("green",                       "\$this->blockcommentcolour");
        dump_var("green",                       "\$this->linecommentcolour ");
        print "\n# Indent Strings\n\n";
        dump_array($indent,                     "\$this->indent            ");
        dump_array($unindent,                   "\$this->unindent          ");
        print "\n# String characters and delimiters\n\n";
        dump_array($stringchars,                "\$this->stringchars       ");
        dump_array($delimiters,                 "\$this->delimiters        ");
        dump_var  ($escchar,                    "\$this->escchar           ");
        print "\n# Comment settings\n\n";
        dump_var  ($linecommenton,              "\$this->linecommenton     ");
        dump_var  ($blockcommenton,             "\$this->blockcommenton    ");
        dump_var  ($blockcommentoff,            "\$this->blockcommentoff   ");
        print "\n# Keywords (keyword mapping to colour number)\n\n";
        dump_hash ($keywords,                   "\$this->keywords          ");
        print "\n# Special extensions\n";
        dump_linkscripts($used_categories);
        if ($tofile) print "\n}?>"; else print "}\n?&gt;";
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

$BEAUT_PATH = "/syntax_highlight/php"

Definition at line 6 of file HFile_conv.php.