ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
HFile Class Reference
+ Inheritance diagram for HFile:
+ Collaboration 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

◆ _dump_array()

HFile::_dump_array (   $array,
  $name 
)

Definition at line 232 of file HFile.php.

Referenced by _dump_colours(), and to_php().

233  {
234  $first = 1;
235  print $name." = array(";
236  foreach($array as $a)
237  {
238  if (!$first) print ", "; else $first = 0;
239  print "\"".addslashes($a)."\"";
240  }
241  print ");\n";
242  }
+ Here is the caller graph for this function:

◆ _dump_colours()

HFile::_dump_colours ( )

Definition at line 217 of file HFile.php.

References _dump_array().

Referenced by to_php().

218  {
219  $usedcols = array();
220  foreach($this->used_categories as $c)
221  {
222  array_push($usedcols, $this->colours[$c-1]);
223  }
224  $this->_dump_array($usedcols, "\$this->colours ");
225  }
_dump_array($array, $name)
Definition: HFile.php:232
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _dump_hash()

HFile::_dump_hash (   $hash,
  $name 
)

Definition at line 256 of file HFile.php.

Referenced by _dump_linkscripts(), and to_php().

257  {
258  $first = 1;
259  print $name." = array(";
260  foreach(array_keys($hash) as $k)
261  {
262  if (!$first) print ", "; else $first = 0;
263  print "\n \"".addslashes($k)."\"";
264  print " => \"".addslashes($hash[$k])."\"";
265  }
266  print ");\n";
267  }
+ Here is the caller graph for this function:

◆ _dump_linkscripts()

HFile::_dump_linkscripts ( )

Definition at line 177 of file HFile.php.

References _dump_hash().

Referenced by to_php().

178  {
179  print "
180 # Each category can specify a PHP function that takes in the function name, and returns a string
181 # to put in its place. This can be used to generate links, images, etc.\n\n";
182 
183  $linkhash = array();
184 
185  foreach($this->used_categories as $c)
186  {
187  $linkhash{$c} = "donothing";
188  }
189 
190  $this->_dump_hash($linkhash, "\$this->linkscripts ");
191  print "}\n";
192  print "\n# DoNothing link function\n\n";
193  print "function donothing(\$keywordin)\n{\n return \$keywordin;\n}\n";
194  }
_dump_hash($hash, $name)
Definition: HFile.php:256
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _dump_perl_array()

HFile::_dump_perl_array (   $array,
  $name 
)

Definition at line 244 of file HFile.php.

Referenced by to_perl().

245  {
246  $first = 1;
247  print $name." = [";
248  foreach($array as $a)
249  {
250  if (!$first) print ", "; else $first = 0;
251  print "\"".addslashes($a)."\"";
252  }
253  print "];\n";
254  }
+ Here is the caller graph for this function:

◆ _dump_perl_defaultscripts()

HFile::_dump_perl_defaultscripts ( )

Definition at line 211 of file HFile.php.

Referenced by to_perl().

212  {
213  print "\n# DoNothing link function\n\n";
214  print "sub donothing\n{\nmy ( \$self ) = @_;\nreturn;\n}\n";
215  }
+ Here is the caller graph for this function:

◆ _dump_perl_hash()

HFile::_dump_perl_hash (   $hash,
  $name 
)

Definition at line 269 of file HFile.php.

Referenced by _dump_perl_linkscripts(), and to_perl().

270  {
271  $first = 1;
272  print $name." = {";
273  foreach(array_keys($hash) as $k)
274  {
275  if (!$first) print ", "; else $first = 0;
276  print "\n \"".addslashes($k)."\"";
277  print " => \"".addslashes($hash[$k])."\"";
278  }
279  print "};\n";
280  }
+ Here is the caller graph for this function:

◆ _dump_perl_linkscripts()

HFile::_dump_perl_linkscripts ( )

Definition at line 196 of file HFile.php.

References _dump_perl_hash().

Referenced by to_perl().

197  {
198  print "
199 # Each category can specify a Perl function that takes in the function name, and returns a string
200 # to put in its place. This can be used to generate links, images, etc.\n\n";
201 
202  $linkhash = array();
203  foreach($this->used_categories as $c)
204  {
205  $linkhash{$c} = "donothing";
206  }
207 
208  $this->_dump_perl_hash($linkhash, "\$self->{linkscripts} ");
209  }
_dump_perl_hash($hash, $name)
Definition: HFile.php:269
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _dump_var()

HFile::_dump_var (   $variable,
  $name 
)

Definition at line 227 of file HFile.php.

Referenced by to_perl(), and to_php().

228  {
229  print $name." = \"".addslashes($variable)."\";\n";
230  }
+ Here is the caller graph for this function:

◆ _get_categories()

HFile::_get_categories ( )

Definition at line 165 of file HFile.php.

Referenced by to_perl(), and to_php().

166  {
167  $usedcats = array();
168 
169  foreach(array_keys($this->keywords) as $k)
170  {
171  $cat = $this->keywords[$k];
172  if (!in_array($cat, $usedcats)) array_push($usedcats, $cat);
173  }
174  return $usedcats;
175  }
+ Here is the caller graph for this function:

◆ HFile()

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().

25  {
26  # Language name.
27  $this->lang_name = "";
28  # Language configuration hashtable.
29  $this->indent_depth = 8;
30 
31  $this->config = array();
32  $color = 0;
33  $parsing = "";
34  $this->validkeys = array();
35 
36  $this->indent = array();
37  $this->unindent = array();
38  $this->blockcommenton = array();
39  $this->blockcommentoff = array();
40  $this->linecommenton = array();
41  $this->preprocessors = array();
42 
43  # Zoning
44  $this->zones = array();
45 
46  # Hashtable of keywords - maps from keyword to colour.
47  $this->keywords = array();
48 
49  # Used for conversion from keyword -> regexp.
50  $this->keypats = array();
51 
52  # Which colours to use for each 'level'.
53  $this->colours = array("blue", "purple", "gray", "brown", "blue", "purple", "gray", "brown");
54  $this->quotecolour = "blue";
55  $this->blockcommentcolour = "green";
56  $this->linecommentcolour = "green";
57  $this->stringchars = array();
58  $this->delimiters = array();
59  $this->escchar = "\\";
60 
61  # Caches for the harvesters.
62  $this->comcache = "";
63  $this->stringcache = "";
64 
65  # Toggles
66  $this->perl = 0;
67  $this->notrim = 0;
68  $this->nocase = 0;
69  }
+ Here is the caller graph for this function:

◆ parse_file()

HFile::parse_file (   $file)

Definition at line 71 of file HFile.php.

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

◆ to_perl()

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().

77  {
78  $this->used_categories = $this->_get_categories();
79  print "
80 package HFile::$stub;
81 
82 ###############################
83 #
84 # Beautifier Perl HFile
85 # Language: $stub
86 #
87 ###############################
88 
89 use Beautifier::HFile;
90 @ISA = qw(HFile);
91 sub new
92 {
93  my( \$class ) = @_;
94  my \$self = {};
95  bless \$self, \$class;
96 
97  # Flags:
98 ";
99  $this->_dump_var($this->nocase, " \$self->{nocase} ");
100  $this->_dump_var($this->notrim, " \$self->{notrim} ");
101  $this->_dump_var($this->perl, " \$self->{perl} ");
102  $this->_dump_perl_array($this->indent, " \$self->{indent} ");
103  $this->_dump_perl_array($this->unindent, " \$self->{unindent} ");
104  $this->_dump_perl_array($this->stringchars, " \$self->{stringchars} ");
105  $this->_dump_perl_array($this->delimiters, " \$self->{delimiters} ");
106  $this->_dump_var($this->escchar, " \$self->{escchar} ");
107  $this->_dump_perl_array($this->linecommenton, " \$self->{linecommenton} ");
108  $this->_dump_perl_array($this->blockcommenton, " \$self->{blockcommenton} ");
109  $this->_dump_perl_array($this->blockcommentoff, " \$self->{blockcommentoff}");
110  $this->_dump_perl_hash($this->keywords, " \$self->{keywords} ");
111  $this->_dump_perl_linkscripts();
112 print "
113  return \$self;
114 }
115 
116 ";
117 
118  $this->_dump_perl_defaultscripts();
119 print "1;\n";
120  }
_dump_var($variable, $name)
Definition: HFile.php:227
_dump_perl_defaultscripts()
Definition: HFile.php:211
_get_categories()
Definition: HFile.php:165
_dump_perl_linkscripts()
Definition: HFile.php:196
_dump_perl_array($array, $name)
Definition: HFile.php:244
_dump_perl_hash($hash, $name)
Definition: HFile.php:269
+ Here is the call graph for this function:

◆ to_php()

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().

123  {
124 
125 
126  $this->used_categories = $this->_get_categories();
127 
128  if ($tofile) print "<?php\n"; else print "&lt;?\n";
129  print "require_once('psh.php');\n";
130  print "class psh_$stub extends psh\n{\n";
131  print "function psh_$stub(){\n";
132  print "\$this->psh();\n";
133  print "######################################\n";
134  print "# Beautifier Highlighting Configuration File \n";
135  print "# $this->lang_name\n";
136  print "######################################\n";
137  print "# Flags\n\n";
138  $this->_dump_var($this->nocase, "\$this->nocase ");
139  $this->_dump_var($this->notrim, "\$this->notrim ");
140  $this->_dump_var($this->perl, "\$this->perl ");
141  print "\n# Colours\n\n";
142  $this->_dump_colours();
143  $this->_dump_var("blue", "\$this->quotecolour ");
144  $this->_dump_var("green", "\$this->blockcommentcolour");
145  $this->_dump_var("green", "\$this->linecommentcolour ");
146  print "\n# Indent Strings\n\n";
147  $this->_dump_array($this->indent, "\$this->indent ");
148  $this->_dump_array($this->unindent, "\$this->unindent ");
149  print "\n# String characters and delimiters\n\n";
150  $this->_dump_array($this->stringchars, "\$this->stringchars ");
151  $this->_dump_array($this->delimiters, "\$this->delimiters ");
152  $this->_dump_var ($this->escchar, "\$this->escchar ");
153  print "\n# Comment settings\n\n";
154  $this->_dump_array($this->linecommenton, "\$this->linecommenton ");
155  $this->_dump_var ($this->blockcommenton, "\$this->blockcommenton ");
156  $this->_dump_var ($this->blockcommentoff, "\$this->blockcommentoff ");
157  print "\n# Keywords (keyword mapping to colour number)\n\n";
158  $this->_dump_hash ($this->keywords, "\$this->keywords ");
159  print "\n# Special extensions\n";
160  $this->_dump_linkscripts();
161  print "}\n";
162  if ($tofile) print "\n?>"; else print "\n?&gt;";
163  }
_dump_array($array, $name)
Definition: HFile.php:232
_dump_var($variable, $name)
Definition: HFile.php:227
_dump_hash($hash, $name)
Definition: HFile.php:256
_get_categories()
Definition: HFile.php:165
_dump_colours()
Definition: HFile.php:217
_dump_linkscripts()
Definition: HFile.php:177
+ Here is the call graph for this function:

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