3v4l.org

run code in 300+ PHP versions simultaneously
<?php sleep(10); ?> <?php /** * LaTeX Rendering Class * Copyright (C) 2003 Benjamin Zeiss <zeiss@math.uni-goettingen.de> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * -------------------------------------------------------------------- * @author Benjamin Zeiss <zeiss@math.uni-goettingen.de> * @version v0.8 * @package latexrender */ class LatexRender { // ==================================================================================== // Variable Definitions // ==================================================================================== var $_picture_path = ""; var $_picture_path_httpd = ""; var $_tmp_dir = ""; // i was too lazy to write mutator functions for every single program used // just access it outside the class or change it here if nescessary /** * INICIO AGREGADAS ¿CAMBIAR TRAYECTORIA? * var $_latex_path = "/usr/local/teTeX/bin/i686-pc-linux-gnu/share/texmf-dist/tex/latex/base/article.cls"; * var $_latex_path = "/usr/local/teTeX/bin/i686-pc-linux-gnu/share/texmf-dist/tex/latex/base/size10.clo"; * var $_latex_path = "/usr/local/teTeX/bin/i686-pc-linux-gnu/share/texmf-dist/tex/latex/base/inputenc.sty"; * var $_latex_path = "/usr/local/teTeX/bin/i686-pc-linux-gnu/share/texmf-dist/tex/latex/base/latin1.def"; * var $_latex_path = "/usr/local/teTeX/share/texmf-dist/tex/latex/amsmath/amsmath.sty"; * var $_latex_path = "/usr/local/teTeX/share/texmf-dist/tex/latex/amsmath/amstext.sty"; * var $_latex_path = "/usr/local/teTeX/share/texmf-dist/tex/latex/amsmath/amsgen.sty"; * var $_latex_path = "/usr/local/teTeX/share/texmf-dist/tex/latex/amsmath/amsbsy.sty"; * var $_latex_path = "/usr/local/teTeX/share/texmf-dist/tex/latex/amsmath/amsopn.sty"; * var $_latex_path = "/usr/local/teTeX/share/texmf-dist/tex/latex/base/latexsym.sty"; * var $_latex_path = "/usr/local/teTeX/share/texmf-dist/tex/generic/babel/babel.sty"; * var $_latex_path = "/usr/local/teTeX/share/texmf-dist/tex/generic/babel/spanish.ldf"; * var $_latex_path = "/usr/local/teTeX/share/texmf-dist/tex/generic/babel/babel.def"; * var $_latex_path = "/usr/local/teTeX/share/texmf-dist/tex/latex/amsfonts/amsfonts.sty"; * var $_latex_path = "/usr/local/teTeX/share/texmf-dist/tex/latex/amsfonts/amssymb.sty"; * var $_latex_path = "/usr/local/teTeX/share/texmf-dist/tex/latex/graphics/epsfig.sty"; * var $_latex_path = "/usr/local/teTeX/share/texmf-dist/tex/latex/graphics/graphicx.sty"; * var $_latex_path = "/usr/local/teTeX/share/texmf-dist/tex/latex/graphics/keyval.sty"; * var $_latex_path = "/usr/local/teTeX/share/texmf-dist/tex/latex/graphics/graphics.sty"; * var $_latex_path = "/usr/local/teTeX/share/texmf-dist/tex/latex/graphics/trig.sty"; * var $_latex_path = "/usr/local/teTeX/share/texmf-dist/tex/latex/graphics/graphics.cfg"; * var $_latex_path = "/usr/local/teTeX/share/texmf-dist/tex/latex/graphics/dvips.def"; * var $_latex_path = "/usr/local/teTeX/share/texmf-dist/tex/latex/graphics/color.sty"; * var $_latex_path = "/usr/local/teTeX/share/texmf-dist/tex/latex/graphics/color.cfg"; * var $_latex_path = "/usr/local/teTeX/share/texmf-dist/tex/latex/graphics/dvipsnam.def"; * var $_latex_path = "/usr/local/teTeX/share/texmf-dist/tex/latex/tools/longtable.sty"; * var $_latex_path = "/usr/local/teTeX/share/texmf-dist/tex/latex/base/ulasy.fd"; * var $_latex_path = "/usr/local/teTeX/share/texmf-dist/tex/latex/amsfonts/umsa.fd"; * var $_latex_path = "/usr/local/teTeX/share/texmf-dist/tex/latex/amsfonts/umsb.fd"; * FIN AGREGADAS */ /** var $_latex_path = "/usr/local/teTeX/bin/i686-pc-linux-gnu/latex/amsfonts/amsfonts.sty"; * LA SIGUIENTE NO SE SI VA * var $_latex_path = "/usr/local/teTeX/share/texmf-dist/tex/latex/graphics/color.cfg"; */ /* var $_latex_path = "/usr/local/teTeX/bin/i686-pc-linux-gnu/latex"; var $_dvips_path = "/usr/local/teTeX/bin/i686-pc-linux-gnu/dvips"; */ var $_latex_path = "/usr/share/texmf/bin/latex"; var $_dvips_path = "/usr/share/texmf/bin/dvips"; var $_convert_path = "/usr/local/bin/convert"; var $_identify_path= "/usr/local/bin/identify"; /* var $_latex_path = "/usr/bin/latex"; var $_dvips_path = "/usr/bin/dvips"; var $_convert_path = "/usr/bin/convert"; var $_identify_path= "/usr/bin/identify"; */ var $_formula_density = 95; var $_xsize_limit = 1500; var $_ysize_limit = 1000; var $_string_length_limit = 1500; var $_font_size = 12; var $_latexclass = "article"; //install extarticle class if you wish to have smaller font sizes var $_tmp_filename; var $_image_format = "png"; //change to png if you prefer // this most certainly needs to be extended. in the long term it is planned to use // a positive list for more security. this is hopefully enough for now. i'd be glad // to receive more bad tags ! var $_latex_tags_blacklist = array( "include","def","command","loop","repeat","open","toks","output","input", "catcode","name","^^","\\every","\\errhelp","\\errorstopmode","\\scrollmode","\\nonstopmode","\\batchmode", "\\read","\\write","csname","\\newhelp","\\uppercase", "\\lowercase","\\relax","\\aftergroup", "\\afterassignment","\\expandafter","\\noexpand","\\special" ); var $_errorcode = 0; var $_errorextra = ""; // ==================================================================================== // constructor // ==================================================================================== /** * Initializes the class * * @param string path where the rendered pictures should be stored * @param string same path, but from the httpd chroot */ function LatexRender($picture_path,$picture_path_httpd,$tmp_dir) { $this->_picture_path = $picture_path; $this->_picture_path_httpd = $picture_path_httpd; $this->_tmp_dir = $tmp_dir; $this->_tmp_filename = md5(rand()); } // ==================================================================================== // public functions // ==================================================================================== /** * Picture path Mutator function * * @param string sets the current picture path to a new location */ function setPicturePath($name) { $this->_picture_path = $name; } /** * Picture path Mutator function * * @returns the current picture path */ function getPicturePath() { return $this->_picture_path; } /** * Picture path HTTPD Mutator function * * @param string sets the current httpd picture path to a new location */ function setPicturePathHTTPD($name) { $this->_picture_path_httpd = $name; } /** * Picture path HTTPD Mutator function * * @returns the current picture path */ function getPicturePathHTTPD() { return $this->_picture_path_httpd; } /** * Tries to match the LaTeX Formula given as argument against the * formula cache. If the picture has not been rendered before, it'll * try to render the formula and drop it in the picture cache directory. * * @param string formula in LaTeX format * @returns the webserver based URL to a picture which contains the * requested LaTeX formula. If anything fails, the resultvalue is false. */ function getFormulaURL($latex_formula) { // circumvent certain security functions of web-software which // is pretty pointless right here $latex_formula = preg_replace("/&gt;/i", ">", $latex_formula); $latex_formula = preg_replace("/&lt;/i", "<", $latex_formula); $formula_hash = md5($latex_formula); $filename = $formula_hash.".".$this->_image_format; $full_path_filename = $this->getPicturePath()."/".$filename; if (is_file($full_path_filename)) { return $this->getPicturePathHTTPD()."/".$filename; } else { // security filter: reject too long formulas if (strlen($latex_formula) > $this->_string_length_limit) { $this->_errorcode = 1; return false; } // security filter: try to match against LaTeX-Tags Blacklist for ($i=0;$i<sizeof($this->_latex_tags_blacklist);$i++) { if (stristr($latex_formula,$this->_latex_tags_blacklist[$i])) { $this->_errorcode = 2; return false; } } // security checks assume correct formula, let's render it if ($this->renderLatex($latex_formula)) { return $this->getPicturePathHTTPD()."/".$filename; } else { // uncomment if required // $this->_errorcode = 3; // $this->_errorcode = 3; return false; } } } // ==================================================================================== // private functions // ==================================================================================== /** * wraps a minimalistic LaTeX document around the formula and returns a string * containing the whole document as string. Customize if you want other fonts for * example. * * @param string formula in LaTeX format * @returns minimalistic LaTeX document containing the given formula */ function wrap_formula($latex_formula) { $string = "\documentclass[".$this->_font_size."pt]{".$this->_latexclass."}\n"; $string .= "\usepackage{amsmath}\n"; $string .= "\usepackage{amsfonts}\n"; $string .= "\usepackage[latin1]{inputenc}\n"; // $string .= "\usepackage[spanish]{babel}\n"; $string .= "\usepackage[activeacute,spanish]{babel}\n"; $string .= "\usepackage{multirow}\n"; $string .= "\usepackage{multicol}\n"; $string .= "\usepackage{colortbl}\n"; $string .= "\usepackage{eurosym}\n"; $string .= "\usepackage{euscript}\n"; $string .= "\usepackage{amssymb}\n"; $string .= "\usepackage[all]{xy}\n"; $string .= "\usepackage{pst-all}\n"; $string .= "\usepackage{epsfig}\n"; $string .= "\usepackage{xspace}\n"; $string .= "\usepackage{latexsym}\n"; $string .= "\usepackage{cancel}\n"; $string .= "\usepackage{stmaryrd}\n"; $string .= "\usepackage{longtable}\n"; $string .= "\pagestyle{empty}\n"; $string .= "\usepackage[T1]{fontenc}\usepackage{ae,aecompl}\n"; $string .= "\usepackage[T1]{fontenc}\usepackage{pslatex}\n"; //ESTOY ELIMINANDO ESTO POR UN RATO 13 enero 08 //$string .= "\usepackage[dvips]{color}\n"; //elimino 15 enero 11:55 //$string .= "\usepackage[dvips,usenames]{color}\n"; // ACTIVO 15 ENERO 11 55 $string .= "\usepackage[pdftex,usenames,dvipsnames]{color}\n"; //$string .= "\usepackage{graphicx}\n"; //$string .= "\usepackage[pdftex]{graphicx}\n"; //$string .= "\usepackage{txfonts/pxfonts}\n"; //$string .= "\usepackage{amsthm}\n"; //$string .= "\usepackage[T1]{fontenc}\n"; //$string .= "\begin{eqnarray*}" .$latex_formula."\end{eqnarray*}\n"; /**agregada para entender las funciones sen (y no sin), cosec, cotan; */ //$string .= "\\newcommand{\sgn}{\operatorname{sgn}}\n"; $string .= "\\newcommand{\Nu}{\operatorname{Nu}}\n"; $string .= "\\newcommand{\im}{\operatorname{Im}}\n"; /** Observar linea inferior es re newcommand*/ $string .= "\\renewcommand{\Re}{\operatorname{Re}}\n"; $string .= "\\newcommand{\arccot}{\operatorname{arccot}}\n"; /*aca estaba $string .= "\begin{document}*/ $string .= "\begin{document}\n"; $string .= "$".$latex_formula."$\n"; $string .= "\end{document}\n"; return $string; } /** * returns the dimensions of a picture file using 'identify' of the * imagemagick tools. The resulting array can be adressed with either * $dim[0] / $dim[1] or $dim["x"] / $dim["y"] * * @param string path to a picture * @returns array containing the picture dimensions */ function getDimensions($filename) { $output = exec($this->_identify_path." ".$filename); $result = explode(" ",$output); $dim = explode("x",$result[2]); $dim["x"] = $dim[0]; $dim["y"] = $dim[1]; return $dim; } /** * Renders a LaTeX formula by the using the following method: * - write the formula into a wrapped tex-file in a temporary directory * and change to it * - Create a DVI file using latex (tetex) * - Convert DVI file to Postscript (PS) using dvips (tetex) * - convert, trim and add transparancy by using 'convert' from the * imagemagick package. * - Save the resulting image to the picture cache directory using an * md5 hash as filename. Already rendered formulas can be found directly * this way. * * @param string LaTeX formula * @returns true if the picture has been successfully saved to the picture * cache directory */ function renderLatex($latex_formula) { $latex_document = $this->wrap_formula($latex_formula); $current_dir = getcwd(); chdir($this->_tmp_dir); // create temporary latex file $fp = fopen($this->_tmp_dir."/".$this->_tmp_filename.".tex","a+"); fputs($fp,$latex_document); fclose($fp); // create temporary dvi file $command = $this->_latex_path." --interaction=nonstopmode ".$this->_tmp_filename.".tex"; $status_code = exec($command); if (!$status_code) { $this->cleanTemporaryDirectory(); chdir($current_dir); $this->_errorcode = 4; return false; } // convert dvi file to postscript using dvips $command = $this->_dvips_path." -E ".$this->_tmp_filename.".dvi"." -o ".$this->_tmp_filename.".ps"; $status_code = exec($command); // imagemagick convert ps to image and trim picture $command = $this->_convert_path." -density ".$this->_formula_density. " -trim -transparent \"#FFFFFF\" ".$this->_tmp_filename.".ps ". $this->_tmp_filename.".".$this->_image_format; $status_code = exec($command); // test picture for correct dimensions $dim = $this->getDimensions($this->_tmp_filename.".".$this->_image_format); if ( ($dim["x"] > $this->_xsize_limit) or ($dim["y"] > $this->_ysize_limit)) { $this->cleanTemporaryDirectory(); chdir($current_dir); $this->_errorcode = 5; $this->_errorextra = ": " . $dim["x"] . "x" . number_format($dim["y"],0,"",""); return false; } // copy temporary formula file to cahed formula directory $latex_hash = md5($latex_formula); $filename = $this->getPicturePath()."/".$latex_hash.".".$this->_image_format; $status_code = copy($this->_tmp_filename.".".$this->_image_format,$filename); $this->cleanTemporaryDirectory(); if (!$status_code) { chdir($current_dir); $this->_errorcode = 6; $this->_errorextra = ": Cannot copy image to pictures directory";return false; } chdir($current_dir); return true; } /** * Cleans the temporary directory */ function cleanTemporaryDirectory() { $current_dir = getcwd(); chdir($this->_tmp_dir); unlink($this->_tmp_dir."/".$this->_tmp_filename.".tex"); unlink($this->_tmp_dir."/".$this->_tmp_filename.".aux"); unlink($this->_tmp_dir."/".$this->_tmp_filename.".log"); unlink($this->_tmp_dir."/".$this->_tmp_filename.".dvi"); unlink($this->_tmp_dir."/".$this->_tmp_filename.".ps"); unlink($this->_tmp_dir."/".$this->_tmp_filename.".".$this->_image_format); chdir($current_dir); } } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PsUuv
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'sleep'
          1        SEND_VAL                                                 10
          2        DO_ICALL                                                 
    4     3        ECHO                                                     '%0A'
  361     4      > RETURN                                                   1

Class LatexRender:
Function latexrender:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PsUuv
function name:  LatexRender
number of ops:  17
compiled vars:  !0 = $picture_path, !1 = $picture_path_httpd, !2 = $tmp_dir
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  122     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
  123     3        ASSIGN_OBJ                                               '_picture_path'
          4        OP_DATA                                                  !0
  124     5        ASSIGN_OBJ                                               '_picture_path_httpd'
          6        OP_DATA                                                  !1
  125     7        ASSIGN_OBJ                                               '_tmp_dir'
          8        OP_DATA                                                  !2
  126     9        INIT_FCALL                                               'md5'
         10        INIT_FCALL                                               'rand'
         11        DO_ICALL                                         $7      
         12        SEND_VAR                                                 $7
         13        DO_ICALL                                         $8      
         14        ASSIGN_OBJ                                               '_tmp_filename'
         15        OP_DATA                                                  $8
  127    16      > RETURN                                                   null

End of function latexrender

Function setpicturepath:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PsUuv
function name:  setPicturePath
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  136     0  E >   RECV                                             !0      
  137     1        ASSIGN_OBJ                                               '_picture_path'
          2        OP_DATA                                                  !0
  138     3      > RETURN                                                   null

End of function setpicturepath

Function getpicturepath:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PsUuv
function name:  getPicturePath
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  145     0  E >   FETCH_OBJ_R                                      ~0      '_picture_path'
          1      > RETURN                                                   ~0
  146     2*     > RETURN                                                   null

End of function getpicturepath

Function setpicturepathhttpd:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PsUuv
function name:  setPicturePathHTTPD
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  152     0  E >   RECV                                             !0      
  153     1        ASSIGN_OBJ                                               '_picture_path_httpd'
          2        OP_DATA                                                  !0
  154     3      > RETURN                                                   null

End of function setpicturepathhttpd

Function getpicturepathhttpd:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PsUuv
function name:  getPicturePathHTTPD
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  161     0  E >   FETCH_OBJ_R                                      ~0      '_picture_path_httpd'
          1      > RETURN                                                   ~0
  162     2*     > RETURN                                                   null

End of function getpicturepathhttpd

Function getformulaurl:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 36
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 43
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
2 jumps found. (Code = 44) Position 1 = 60, Position 2 = 45
Branch analysis from position: 60
2 jumps found. (Code = 43) Position 1 = 64, Position 2 = 70
Branch analysis from position: 64
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 70
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 45
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 55
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 55
2 jumps found. (Code = 44) Position 1 = 60, Position 2 = 45
Branch analysis from position: 60
Branch analysis from position: 45
filename:       /in/PsUuv
function name:  getFormulaURL
number of ops:  72
compiled vars:  !0 = $latex_formula, !1 = $formula_hash, !2 = $filename, !3 = $full_path_filename, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  172     0  E >   RECV                                             !0      
  175     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%2F%26gt%3B%2Fi'
          3        SEND_VAL                                                 '%3E'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !0, $5
  176     7        INIT_FCALL                                               'preg_replace'
          8        SEND_VAL                                                 '%2F%26lt%3B%2Fi'
          9        SEND_VAL                                                 '%3C'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $7      
         12        ASSIGN                                                   !0, $7
  177    13        INIT_FCALL                                               'md5'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                         $9      
         16        ASSIGN                                                   !1, $9
  178    17        CONCAT                                           ~11     !1, '.'
         18        FETCH_OBJ_R                                      ~12     '_image_format'
         19        CONCAT                                           ~13     ~11, ~12
         20        ASSIGN                                                   !2, ~13
  179    21        INIT_METHOD_CALL                                         'getPicturePath'
         22        DO_FCALL                                      0  $15     
         23        CONCAT                                           ~16     $15, '%2F'
         24        CONCAT                                           ~17     ~16, !2
         25        ASSIGN                                                   !3, ~17
  180    26        INIT_FCALL                                               'is_file'
         27        SEND_VAR                                                 !3
         28        DO_ICALL                                         $19     
         29      > JMPZ                                                     $19, ->36
  181    30    >   INIT_METHOD_CALL                                         'getPicturePathHTTPD'
         31        DO_FCALL                                      0  $20     
         32        CONCAT                                           ~21     $20, '%2F'
         33        CONCAT                                           ~22     ~21, !2
         34      > RETURN                                                   ~22
         35*       JMP                                                      ->71
  184    36    >   STRLEN                                           ~23     !0
         37        FETCH_OBJ_R                                      ~24     '_string_length_limit'
         38        IS_SMALLER                                               ~24, ~23
         39      > JMPZ                                                     ~25, ->43
  185    40    >   ASSIGN_OBJ                                               '_errorcode'
         41        OP_DATA                                                  1
  186    42      > RETURN                                                   <false>
  189    43    >   ASSIGN                                                   !4, 0
         44      > JMP                                                      ->56
  190    45    >   INIT_FCALL                                               'stristr'
         46        SEND_VAR                                                 !0
         47        FETCH_OBJ_R                                      ~28     '_latex_tags_blacklist'
         48        FETCH_DIM_R                                      ~29     ~28, !4
         49        SEND_VAL                                                 ~29
         50        DO_ICALL                                         $30     
         51      > JMPZ                                                     $30, ->55
  191    52    >   ASSIGN_OBJ                                               '_errorcode'
         53        OP_DATA                                                  2
  192    54      > RETURN                                                   <false>
  189    55    >   PRE_INC                                                  !4
         56    >   FETCH_OBJ_R                                      ~33     '_latex_tags_blacklist'
         57        COUNT                                            ~34     ~33
         58        IS_SMALLER                                               !4, ~34
         59      > JMPNZ                                                    ~35, ->45
  196    60    >   INIT_METHOD_CALL                                         'renderLatex'
         61        SEND_VAR_EX                                              !0
         62        DO_FCALL                                      0  $36     
         63      > JMPZ                                                     $36, ->70
  197    64    >   INIT_METHOD_CALL                                         'getPicturePathHTTPD'
         65        DO_FCALL                                      0  $37     
         66        CONCAT                                           ~38     $37, '%2F'
         67        CONCAT                                           ~39     ~38, !2
         68      > RETURN                                                   ~39
         69*       JMP                                                      ->71
  202    70    > > RETURN                                                   <false>
  205    71*     > RETURN                                                   null

End of function getformulaurl

Function wrap_formula:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PsUuv
function name:  wrap_formula
number of ops:  41
compiled vars:  !0 = $latex_formula, !1 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  218     0  E >   RECV                                             !0      
  219     1        FETCH_OBJ_R                                      ~2      '_font_size'
          2        CONCAT                                           ~3      '%5Cdocumentclass%5B', ~2
          3        CONCAT                                           ~4      ~3, 'pt%5D%7B'
          4        FETCH_OBJ_R                                      ~5      '_latexclass'
          5        CONCAT                                           ~6      ~4, ~5
          6        CONCAT                                           ~7      ~6, '%7D%0A'
          7        ASSIGN                                                   !1, ~7
  220     8        ASSIGN_OP                                     8          !1, '%5Cusepackage%7Bamsmath%7D%0A'
  221     9        ASSIGN_OP                                     8          !1, '%5Cusepackage%7Bamsfonts%7D%0A'
  222    10        ASSIGN_OP                                     8          !1, '%5Cusepackage%5Blatin1%5D%7Binputenc%7D%0A'
  225    11        ASSIGN_OP                                     8          !1, '%5Cusepackage%5Bactiveacute%2Cspanish%5D%7Bbabel%7D%0A'
  226    12        ASSIGN_OP                                     8          !1, '%5Cusepackage%7Bmultirow%7D%0A'
  227    13        ASSIGN_OP                                     8          !1, '%5Cusepackage%7Bmulticol%7D%0A'
  228    14        ASSIGN_OP                                     8          !1, '%5Cusepackage%7Bcolortbl%7D%0A'
  229    15        ASSIGN_OP                                     8          !1, '%5Cusepackage%7Beurosym%7D%0A'
  230    16        ASSIGN_OP                                     8          !1, '%5Cusepackage%7Beuscript%7D%0A'
  231    17        ASSIGN_OP                                     8          !1, '%5Cusepackage%7Bamssymb%7D%0A'
  232    18        ASSIGN_OP                                     8          !1, '%5Cusepackage%5Ball%5D%7Bxy%7D%0A'
  233    19        ASSIGN_OP                                     8          !1, '%5Cusepackage%7Bpst-all%7D%0A'
  234    20        ASSIGN_OP                                     8          !1, '%5Cusepackage%7Bepsfig%7D%0A'
  235    21        ASSIGN_OP                                     8          !1, '%5Cusepackage%7Bxspace%7D%0A'
  236    22        ASSIGN_OP                                     8          !1, '%5Cusepackage%7Blatexsym%7D%0A'
  237    23        ASSIGN_OP                                     8          !1, '%5Cusepackage%7Bcancel%7D%0A'
  238    24        ASSIGN_OP                                     8          !1, '%5Cusepackage%7Bstmaryrd%7D%0A'
  239    25        ASSIGN_OP                                     8          !1, '%5Cusepackage%7Blongtable%7D%0A'
  240    26        ASSIGN_OP                                     8          !1, '%5Cpagestyle%7Bempty%7D%0A'
  242    27        ASSIGN_OP                                     8          !1, '%5Cusepackage%5BT1%5D%7Bfontenc%7D%5Cusepackage%7Bae%2Caecompl%7D%0A'
  243    28        ASSIGN_OP                                     8          !1, '%5Cusepackage%5BT1%5D%7Bfontenc%7D%5Cusepackage%7Bpslatex%7D%0A'
  253    29        ASSIGN_OP                                     8          !1, '%5Cusepackage%5Bpdftex%2Cusenames%2Cdvipsnames%5D%7Bcolor%7D%0A'
  264    30        ASSIGN_OP                                     8          !1, '%5Cnewcommand%7B%5CNu%7D%7B%5Coperatorname%7BNu%7D%7D%0A'
  265    31        ASSIGN_OP                                     8          !1, '%5Cnewcommand%7B%5Cim%7D%7B%5Coperatorname%7BIm%7D%7D%0A'
  267    32        ASSIGN_OP                                     8          !1, '%5Crenewcommand%7B%5CRe%7D%7B%5Coperatorname%7BRe%7D%7D%0A'
  268    33        ASSIGN_OP                                     8          !1, '%5Cnewcommand%7B%5Carccot%7D%7B%5Coperatorname%7Barccot%7D%7D%0A'
  270    34        ASSIGN_OP                                     8          !1, '%5Cbegin%7Bdocument%7D%0A'
  271    35        CONCAT                                           ~36     '%24', !0
         36        CONCAT                                           ~37     ~36, '%24%0A'
         37        ASSIGN_OP                                     8          !1, ~37
  272    38        ASSIGN_OP                                     8          !1, '%1Bnd%7Bdocument%7D%0A'
  273    39      > RETURN                                                   !1
  274    40*     > RETURN                                                   null

End of function wrap_formula

Function getdimensions:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PsUuv
function name:  getDimensions
number of ops:  27
compiled vars:  !0 = $filename, !1 = $output, !2 = $result, !3 = $dim
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  284     0  E >   RECV                                             !0      
  285     1        INIT_FCALL                                               'exec'
          2        FETCH_OBJ_R                                      ~4      '_identify_path'
          3        CONCAT                                           ~5      ~4, '+'
          4        CONCAT                                           ~6      ~5, !0
          5        SEND_VAL                                                 ~6
          6        DO_ICALL                                         $7      
          7        ASSIGN                                                   !1, $7
  286     8        INIT_FCALL                                               'explode'
          9        SEND_VAL                                                 '+'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $9      
         12        ASSIGN                                                   !2, $9
  287    13        INIT_FCALL                                               'explode'
         14        SEND_VAL                                                 'x'
         15        FETCH_DIM_R                                      ~11     !2, 2
         16        SEND_VAL                                                 ~11
         17        DO_ICALL                                         $12     
         18        ASSIGN                                                   !3, $12
  288    19        FETCH_DIM_R                                      ~15     !3, 0
         20        ASSIGN_DIM                                               !3, 'x'
         21        OP_DATA                                                  ~15
  289    22        FETCH_DIM_R                                      ~17     !3, 1
         23        ASSIGN_DIM                                               !3, 'y'
         24        OP_DATA                                                  ~17
  290    25      > RETURN                                                   !3
  291    26*     > RETURN                                                   null

End of function getdimensions

Function renderlatex:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 49
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 49
2 jumps found. (Code = 47) Position 1 = 93, Position 2 = 97
Branch analysis from position: 93
2 jumps found. (Code = 43) Position 1 = 98, Position 2 = 119
Branch analysis from position: 98
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 119
2 jumps found. (Code = 43) Position 1 = 144, Position 2 = 152
Branch analysis from position: 144
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 152
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 97
filename:       /in/PsUuv
function name:  renderLatex
number of ops:  157
compiled vars:  !0 = $latex_formula, !1 = $latex_document, !2 = $current_dir, !3 = $fp, !4 = $command, !5 = $status_code, !6 = $dim, !7 = $latex_hash, !8 = $filename
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  308     0  E >   RECV                                             !0      
  309     1        INIT_METHOD_CALL                                         'wrap_formula'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $9      
          4        ASSIGN                                                   !1, $9
  310     5        INIT_FCALL                                               'getcwd'
          6        DO_ICALL                                         $11     
          7        ASSIGN                                                   !2, $11
  311     8        INIT_FCALL                                               'chdir'
          9        FETCH_OBJ_R                                      ~13     '_tmp_dir'
         10        SEND_VAL                                                 ~13
         11        DO_ICALL                                                 
  313    12        INIT_FCALL                                               'fopen'
         13        FETCH_OBJ_R                                      ~15     '_tmp_dir'
         14        CONCAT                                           ~16     ~15, '%2F'
         15        FETCH_OBJ_R                                      ~17     '_tmp_filename'
         16        CONCAT                                           ~18     ~16, ~17
         17        CONCAT                                           ~19     ~18, '.tex'
         18        SEND_VAL                                                 ~19
         19        SEND_VAL                                                 'a%2B'
         20        DO_ICALL                                         $20     
         21        ASSIGN                                                   !3, $20
  314    22        INIT_FCALL                                               'fputs'
         23        SEND_VAR                                                 !3
         24        SEND_VAR                                                 !1
         25        DO_ICALL                                                 
  315    26        INIT_FCALL                                               'fclose'
         27        SEND_VAR                                                 !3
         28        DO_ICALL                                                 
  317    29        FETCH_OBJ_R                                      ~24     '_latex_path'
         30        CONCAT                                           ~25     ~24, '+--interaction%3Dnonstopmode+'
         31        FETCH_OBJ_R                                      ~26     '_tmp_filename'
         32        CONCAT                                           ~27     ~25, ~26
         33        CONCAT                                           ~28     ~27, '.tex'
         34        ASSIGN                                                   !4, ~28
  318    35        INIT_FCALL                                               'exec'
         36        SEND_VAR                                                 !4
         37        DO_ICALL                                         $30     
         38        ASSIGN                                                   !5, $30
  319    39        BOOL_NOT                                         ~32     !5
         40      > JMPZ                                                     ~32, ->49
         41    >   INIT_METHOD_CALL                                         'cleanTemporaryDirectory'
         42        DO_FCALL                                      0          
         43        INIT_FCALL                                               'chdir'
         44        SEND_VAR                                                 !2
         45        DO_ICALL                                                 
         46        ASSIGN_OBJ                                               '_errorcode'
         47        OP_DATA                                                  4
         48      > RETURN                                                   <false>
  321    49    >   FETCH_OBJ_R                                      ~36     '_dvips_path'
         50        CONCAT                                           ~37     ~36, '+-E+'
         51        FETCH_OBJ_R                                      ~38     '_tmp_filename'
         52        CONCAT                                           ~39     ~37, ~38
         53        CONCAT                                           ~40     ~39, '.dvi'
         54        CONCAT                                           ~41     ~40, '+-o+'
         55        FETCH_OBJ_R                                      ~42     '_tmp_filename'
         56        CONCAT                                           ~43     ~41, ~42
         57        CONCAT                                           ~44     ~43, '.ps'
         58        ASSIGN                                                   !4, ~44
  322    59        INIT_FCALL                                               'exec'
         60        SEND_VAR                                                 !4
         61        DO_ICALL                                         $46     
         62        ASSIGN                                                   !5, $46
  324    63        FETCH_OBJ_R                                      ~48     '_convert_path'
         64        CONCAT                                           ~49     ~48, '+-density+'
         65        FETCH_OBJ_R                                      ~50     '_formula_density'
         66        CONCAT                                           ~51     ~49, ~50
  325    67        CONCAT                                           ~52     ~51, '+-trim+-transparent+%22%23FFFFFF%22+'
         68        FETCH_OBJ_R                                      ~53     '_tmp_filename'
         69        CONCAT                                           ~54     ~52, ~53
         70        CONCAT                                           ~55     ~54, '.ps+'
  326    71        FETCH_OBJ_R                                      ~56     '_tmp_filename'
         72        CONCAT                                           ~57     ~55, ~56
         73        CONCAT                                           ~58     ~57, '.'
         74        FETCH_OBJ_R                                      ~59     '_image_format'
         75        CONCAT                                           ~60     ~58, ~59
  324    76        ASSIGN                                                   !4, ~60
  327    77        INIT_FCALL                                               'exec'
         78        SEND_VAR                                                 !4
         79        DO_ICALL                                         $62     
         80        ASSIGN                                                   !5, $62
  329    81        INIT_METHOD_CALL                                         'getDimensions'
         82        FETCH_OBJ_R                                      ~64     '_tmp_filename'
         83        CONCAT                                           ~65     ~64, '.'
         84        FETCH_OBJ_R                                      ~66     '_image_format'
         85        CONCAT                                           ~67     ~65, ~66
         86        SEND_VAL_EX                                              ~67
         87        DO_FCALL                                      0  $68     
         88        ASSIGN                                                   !6, $68
  330    89        FETCH_DIM_R                                      ~70     !6, 'x'
         90        FETCH_OBJ_R                                      ~71     '_xsize_limit'
         91        IS_SMALLER                                       ~72     ~71, ~70
         92      > JMPNZ_EX                                         ~72     ~72, ->97
         93    >   FETCH_DIM_R                                      ~73     !6, 'y'
         94        FETCH_OBJ_R                                      ~74     '_ysize_limit'
         95        IS_SMALLER                                       ~75     ~74, ~73
         96        BOOL                                             ~72     ~75
         97    > > JMPZ                                                     ~72, ->119
  331    98    >   INIT_METHOD_CALL                                         'cleanTemporaryDirectory'
         99        DO_FCALL                                      0          
  332   100        INIT_FCALL                                               'chdir'
        101        SEND_VAR                                                 !2
        102        DO_ICALL                                                 
  333   103        ASSIGN_OBJ                                               '_errorcode'
        104        OP_DATA                                                  5
  334   105        FETCH_DIM_R                                      ~80     !6, 'x'
        106        CONCAT                                           ~81     '%3A+', ~80
        107        CONCAT                                           ~82     ~81, 'x'
        108        INIT_FCALL                                               'number_format'
        109        FETCH_DIM_R                                      ~83     !6, 'y'
        110        SEND_VAL                                                 ~83
        111        SEND_VAL                                                 0
        112        SEND_VAL                                                 ''
        113        SEND_VAL                                                 ''
        114        DO_ICALL                                         $84     
        115        CONCAT                                           ~85     ~82, $84
        116        ASSIGN_OBJ                                               '_errorextra'
        117        OP_DATA                                                  ~85
  335   118      > RETURN                                                   <false>
  338   119    >   INIT_FCALL                                               'md5'
        120        SEND_VAR                                                 !0
        121        DO_ICALL                                         $86     
        122        ASSIGN                                                   !7, $86
  339   123        INIT_METHOD_CALL                                         'getPicturePath'
        124        DO_FCALL                                      0  $88     
        125        CONCAT                                           ~89     $88, '%2F'
        126        CONCAT                                           ~90     ~89, !7
        127        CONCAT                                           ~91     ~90, '.'
        128    

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.71 ms | 1432 KiB | 41 Q