|
|
(13 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
− | <?php | + | {{legacy}} |
− | /*************************************************************************************
| + | <PHP> |
− | * r.php
| + | <? |
− | * ----------
| + | # |
− | * Author: Jon Raphaelson (jonraphaelson@gmail.com)
| + | # [[[[http://en.wikipedia.org/wiki/R_(programming_language)|R]]]] compiler for [[[[XmlWiki]]]] Environment |
− | * Copyright: (c) 2005 Jon Raphaelson, Nigel McNie (http://qbnz.com/highlighter)
| + | # Licensed under [[[[http://www.gnu.org/copyleft/lesser.html|LGPL]]]] |
− | * Release Version: 1.0.7.4
| + | if ($GLOBALS['xwIsAdmin']) { |
− | * CVS Revision Version: $Revision: 1.3 $
| + | xwSetProperty($properties,'language','TEXT'); |
− | * Date Started: 2004/08/30
| + | $server = $_SERVER['HTTP_HOST']; |
− | * Last Modified: $Date: 2005/10/22 07:52:59 $
| + | $htdocs = $_SERVER['DOCUMENT_ROOT']; |
− | *
| + | if (!ereg( "\\/$", $htdocs)) $htdocs .= '/'; |
− | * Scheme language file for GeSHi.
| + | |
− | *
| + | $src = $htdocs.'wiki/source.R'; |
− | * CHANGES
| + | $R = '/usr/local/bin/R --slave'; |
− | * -------
| + | $out = $htdocs.'wiki/a.out'; |
− | * 2005/09/22 (1.0.0)
| + | |
− | * - First Release
| + | // Write the source to tmp file source |
− | *
| + | if ($handle = fopen($src, 'w+')) { |
− | * TODO (updated 2005/09/22)
| + | fwrite($handle, "$article\n"); |
− | * -------------------------
| + | fclose($handle); |
− | *
| + | } |
− | *************************************************************************************
| + | |
− | *
| + | // Excecute |
− | * This file is part of GeSHi.
| + | $article = "Executing using $R\n\n"; |
− | *
| + | shell_exec("$R < $src > $out"); |
− | * GeSHi is free software; you can redistribute it and/or modify^M
| + | $article .= file_get_contents($out); |
− | * it under the terms of the GNU General Public License as published by^M
| + | } |
− | * the Free Software Foundation; either version 2 of the License, or^M
| + | else xwMessage('Permission denied: Only admin can compile and execute R articles', 'red'); |
− | * (at your option) any later version.^M
| + | ?> |
− | *^M
| + | </PHP> |
− | * GeSHi is distributed in the hope that it will be useful,^M
| |
− | * but WITHOUT ANY WARRANTY; without even the implied warranty of^M
| |
− | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the^M
| |
− | * GNU General Public License for more details.^M
| |
− | *^M
| |
− | * You should have received a copy of the GNU General Public License^M
| |
− | * along with GeSHi; if not, write to the Free Software^M
| |
− | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA^M
| |
− | *^M
| |
− | ************************************************************************************/^M
| |
− | ^M
| |
− | $language_data = array (^M
| |
− | 'LANG_NAME' => 'R',^M
| |
− | 'COMMENT_SINGLE' => array(1 => '#'),^M
| |
− | 'COMMENT_MULTI' => array(';|' => '|;'),^M
| |
− | 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,^M
| |
− | 'QUOTEMARKS' => array('"'),^M
| |
− | 'ESCAPE_CHAR' => '\\',^M
| |
− | 'KEYWORDS' => array(^M
| |
− | 1 => array(^M
| |
− | 'abs', 'acos', 'and', 'angle', 'append', 'appply', 'approximate',^M
| |
− | 'asin', 'assoc', 'assq', 'assv', 'atan',^M
| |
− | ^M
| |
− | 'begin', 'boolean?', 'bound-identifier=?', ^M
| |
− | ^M
| |
− | 'caar', 'caddr', 'cadr', 'call-with-current-continuation', ^M
| |
− | 'call-with-input-file', 'call-with-output-file', 'call/cc', 'car',^M
| |
− | 'case', 'catch', 'cdddar', 'cddddr', 'cdr', 'ceiling', 'char->integer',^M
| |
− | 'char-alphabetic?', 'char-ci<=?', 'char-ci<?', 'char-ci?', 'char-ci>=?',^M
| |
− | 'char-ci>?', 'char-ci=?', 'char-downcase', 'char-lower-case?', ^M
| |
− | 'char-numeric', 'char-ready', 'char-ready?', 'char-upcase', ^M
| |
− | 'char-upper-case?', 'char-whitespace?', 'char<=?', 'char<?', 'char=?',^M
| |
− | 'char>=?', 'char>?', 'char?', 'close-input-port', 'close-output-port',^M
| |
− | 'complex?', 'cond', 'cons', 'construct-identifier', 'cos', ^M
| |
− | 'current-input-port', 'current-output-port',^M
| |
− | ^M
| |
− | 'd', 'define', 'define-syntax', 'delay', 'denominator', 'display', 'do',^M
| |
− | ^M
| |
− | 'e', 'eof-object?', 'eq?', 'equal?', 'eqv?', 'even?', 'exact->inexact',^M
| |
− | 'exact?', 'exp', 'expt', 'else',^M
| |
− | ^M
| |
− | 'f', 'floor', 'for-each', 'force', 'free-identifer=?', ^M
| |
− | ^M
| |
− | 'gcd', 'gen-counter', 'gen-loser', 'generate-identifier',^M
| |
− | ^M
| |
− | 'identifier->symbol', 'identifier', 'if', 'imag-part', 'inexact->exact',^M
| |
− | 'inexact?', 'input-port?', 'integer->char', 'integer?', 'integrate-system',^M
| |
− | ^M
| |
− | 'l', 'lambda', 'last-pair', 'lcm', 'length', 'let', 'let*', 'letrec', ^M
| |
− | 'list', 'list->string', 'list->vector', 'list-ref', 'list-tail', 'list?',^M
| |
− | 'load', 'log',^M
| |
− | ^M
| |
− | 'magnitude', 'make-polar', 'make-promise', 'make-rectangular', ^M
| |
− | 'make-string', 'make-vector', 'map', 'map-streams', 'max', 'member', ^M
| |
− | 'memq', 'memv', 'min', 'modulo',^M
| |
− | ^M
| |
− | 'negative', 'newline', 'nil', 'not', 'null?', 'number->string', 'number?',^M
| |
− | 'numerator',^M
| |
− | ^M
| |
− | 'odd?', 'open-input-file', 'open-output-file', 'or', 'output-port', ^M
| |
− | ^M
| |
− | 'pair?', 'peek-char', 'positive?', 'procedure?',^M
| |
− | ^M
| |
− | 'quasiquote', 'quote', 'quotient', ^M
| |
− | ^M
| |
− | 'rational', 'rationalize', 'read', 'read-char', 'real-part', 'real?',^M
| |
− | 'remainder', 'return', 'reverse',^M
| |
− | ^M
| |
− | 's', 'sequence', 'set!', 'set-char!', 'set-cdr!', 'sin', 'sqrt', 'string',^M
| |
− | 'string->list', 'string->number', 'string->symbol', 'string-append', ^M
| |
− | 'string-ci<=?', 'string-ci<?', 'string-ci=?', 'string-ci>=?', ^M
| |
− | 'string-ci>?', 'string-copy', 'string-fill!', 'string-length', ^M
| |
− | 'string-ref', 'string-set!', 'string<=?', 'string<?', 'string=?', ^M
| |
− | 'string>=?', 'string>?', 'string?', 'substring', 'symbol->string', ^M
| |
− | 'symbol?', 'syntax', 'syntax-rules',^M
| |
− | ^M
| |
− | 't', 'tan', 'template', 'transcript-off', 'transcript-on', 'truncate',^M
| |
− | ^M
| |
− | 'unquote', 'unquote-splicing', 'unwrap-syntax', ^M
| |
− | ^M
| |
− | 'vector', 'vector->list', 'vector-fill!', 'vector-length', 'vector-ref', ^M
| |
− | 'vector-set!', 'vector?', ^M
| |
− | ^M
| |
− | 'with-input-from-file', 'with-output-to-file', 'write', 'write-char',^M
| |
− | ^M
| |
− | 'zero?'^M
| |
− | ^M
| |
− | )^M
| |
− | ),^M
| |
− | 'SYMBOLS' => array(^M
| |
− | '(', ')', '{', '}', '[', ']', '!', '%', '^', '&', '/','+','-','*','=','<','>',';','|'^M
| |
− | ),^M
| |
− | 'CASE_SENSITIVE' => array(^M
| |
− | GESHI_COMMENTS => true,^M
| |
− | 1 => false^M
| |
− | ),^M
| |
− | 'STYLES' => array(^M
| |
− | 'KEYWORDS' => array(^M
| |
− | 1 => 'color: #b1b100;'^M
| |
− | ),^M
| |
− | 'COMMENTS' => array(^M
| |
− | 1 => 'color: #808080; font-style: italic;',^M
| |
− | 'MULTI' => 'color: #808080; font-style: italic;'^M
| |
− | ),^M
| |
− | 'ESCAPE_CHAR' => array(^M
| |
− | 0 => 'color: #000099; font-weight: bold;'^M
| |
− | ),^M
| |
− | 'BRACKETS' => array(^M
| |
− | 0 => 'color: #66cc66;'^M
| |
− | ),^M
| |
− | 'STRINGS' => array(^M
| |
− | 0 => 'color: #ff0000;'^M
| |
− | ),^M
| |
− | 'NUMBERS' => array(^M
| |
− | 0 => 'color: #cc66cc;'^M
| |
− | ),^M
| |
− | 'METHODS' => array(^M
| |
− | 0 => 'color: #202020;'^M
| |
− | ),^M
| |
− | 'SYMBOLS' => array(^M
| |
− | 0 => 'color: #66cc66;'^M
| |
− | ),^M
| |
− | 'REGEXPS' => array(^M
| |
− | ),^M
| |
− | 'SCRIPT' => array(^M
| |
− | )^M
| |
− | ),^M
| |
− | 'URLS' => array(^M
| |
− | ),^M
| |
− | 'OOLANG' => false,^M
| |
− | 'OBJECT_SPLITTERS' => array(^M
| |
− | ),^M
| |
− | 'REGEXPS' => array(^M
| |
− | ),^M
| |
− | 'STRICT_MODE_APPLIES' => GESHI_NEVER,^M
| |
− | 'SCRIPT_DELIMITERS' => array(^M
| |
− | ),^M
| |
− | 'HIGHLIGHT_STRICT_BLOCK' => array(^M
| |
− | )^M
| |
− | );^M
| |
− | ^M
| |
− | ?>^M
| |