/*-------------------------------------------------------------------------
Output:
-------------------------------------------------------------------------
326107
public function appendFormattedElement(XMLElement &$wrapper, $data, $encode = false, $mode = null, $entry_id = null)
    {
        $value = $data['value'];

        if ($encode === true) {
            $value = General::sanitize($value);
        } else {
            if (!General::validateXML($data['value'], $errors, false, new XsltProcess)) {
                $value = html_entity_decode($data['value'], ENT_QUOTES, 'UTF-8');
                $value = $this->__replaceAmpersands($value);

                if (!General::validateXML($value, $errors, false, new XsltProcess)) {
                    $value = General::sanitize($data['value']);
                }
            }
        }

        $wrapper->appendChild(
            new XMLElement($this->get('element_name'), $value, array('handle' => $data['handle']))
        );
    }
1086273
void dump(java.io.PrintStream out) {
        if (fFTable.length == 0) {
            // There is no table. Fail early for testing purposes.
            throw new NullPointerException();
        }
        out.println("RBBI Data Wrapper dump ...");
        out.println();
        out.println("Forward State Table");
        dumpTable(out, fFTable);
        out.println("Reverse State Table");
        dumpTable(out, fRTable);
        out.println("Forward Safe Points Table");
        dumpTable(out, fSFTable);
        out.println("Reverse Safe Points Table");
        dumpTable(out, fSRTable);

        dumpCharCategories(out);
        out.println("Source Rules: " + fRuleSource);

    }
835036
final public function output() {
        
        if($this->_outputOnlyHeaders){
            $this->sendHttpHeaders();
            return true;
        }
        
        $this->_httpHeaders['Content-Type'] = 'application/xml;charset=UTF-8';

        if (count($this->urlSitemap)) {
            $head = '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
            $foot = '</sitemapindex>';
            $this->contentTpl = 'jsitemap~sitemapindex';
            $this->content->assign('sitemaps', $this->urlSitemap);
        } else {
            $head = '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
            $foot = '</urlset>';
            $this->content->assign('urls', $this->urlList);
        }
        $content = $this->content->fetch($this->contentTpl);

        // content is generated, no errors, we can send it
        $this->sendHttpHeaders();
        echo '<?xml version="1.0" encoding="UTF-8"?>', "\n";
        echo $head, $content, $foot;
        return true;
    }
798045
function outputOutput(output, cb) {
    cb = u.maybe(cb);

    if (!output) return cb(new Error('no output specified'));

    debug('output %s', output.name);
    var files = output.files = [];

    var omit = output.omitRoutes;
    if (omit && !u.isArray(omit)) { omit = [omit]; }

    // TODO: re-use similar filter in server/serve-statics and server/serve-scripts
    var filterRe = new RegExp( '^(/admin/|/server/' +
                (opts.editor ? '' : '|/pub/') +
                       (omit ? '|' + u.map(omit, u.escapeRegExp).join('|') : '') +
                               ')');

    // pass1: collect files to generate (not /server or /admin or /pub)
    u.each(generator.pages, function(page) {
      if (filterRe.test(page._href)) return;
      if (output.match && !output.match(page)) return;
      var file = { page: page, path: page._href };
      if (page['http-header']) { file['http-header'] = page['http-header']; }
      files.push(file);
    });

    // pass2:
    fixOutputPaths(output, files);

    // pass3: generate using (possibly modified) file paths for relPaths
    // E.g. /adobe may live in the file /adobe/index.html so the relPath is '..'
    u.each(files, function(file) {
      var renderOpts =
        output.relPaths   ? { relPath:u.relPath(file.path) } :
        output.staticRoot ? { relPath:output.staticRoot } :
        opts.relPaths     ? { relPath:u.relPath(file.path) } :
        opts.staticRoot   ? { relPath:opts.staticRoot } :
        {};
      if (output.fqImages) { renderOpts.fqImages = output.fqImages; }
      file.text = generator.renderDoc(file.page, renderOpts);
      delete file.page;
    });

    output.src.put(files, cb);
  }
11706
public function getOutputPath() : ?string 
    {
        if ( ! $this->hasOutputPath()) {
            $this->setOutputPath($this->getDefaultOutputPath());
        }
        return $this->outputPath;
    }
1277246
private void dumpNode(Node node, int level, int idx, java.io.PrintStream out) {

        // if node null, then return
        if (node == null) {
            return;
        }

        // print out required spaces
        printSpaces(level, out);

        if (idx == -2) {
            out.print("ROOT -> ");
        } else {
            out.print(idx + " -> ");
        }

        // print out the values
        out.print("S: ");
        if (node.getSpecificValue() != null) {
            out.print(node.getSpecificValue().toString());
        } else {
            out.print("(null)");
        }
        out.print(", W: ");
        if (node.getPrefixValue() != null) {
            out.println(node.getPrefixValue().toString());
        } else {
            out.println("(null)");
        }

        // loop through each child node
        for (int index = 0; index < 10; index++) {
            // dump out this node...
            dumpNode(node.getNode(index), level + 1, index, out);
        }
    }
385940
public function output() {
		$arguments = func_get_args();
		$result = [];

		if (count($arguments) == 1) {
			$headers = $arguments[0];
			$fields = $arguments[0];
		} elseif (count($arguments == 2)) {
			$headers = $arguments[0];
			$fields = $arguments[1];
			if (count($headers) != count($fields)) {
				throw new \Exception('If headers and fields are given, both should have an equal amount of values');
			}
		} else {
			throw new \Exception('This function requires 1 or 2 arrays as parameter: The first is the header, second are the field names or closures.');
		}

		echo("<table class='Skeleton-Pager-Output-Html-" . $this->pager->get_classname() . "'>\n");
		echo("	<thead>\n");
		echo("		<tr>\n");
		foreach ($headers as $header) {
			echo("			<th class='" . $this->clean($header) . "'>" . $header . "</th>\n");
		}
		echo("		</tr>\n");
		echo("	</thead>\n");

		echo("	<tbody>\n");
		foreach ($this->pager->items as $item) {
			echo("		<tr>\n");
			foreach ($headers as $key => $header) {
				if (is_callable($fields[$key])) {
					$value = $fields[$key]($item);
				} else {
					$value = \Skeleton\Pager\Util::object_get_attribute($item, $fields[$key]);
				}
				echo("			<td class='" . $this->clean($header) . "'>" . $value . "</td>\n");
			}
			echo("		</tr>\n");
		}
		echo("	</tbody>\n");
		echo("</table>\n");
	}
934535
function output (err, value) {
      // Buffer err and value for
      // sending in case we do not have
      // a callback yet
      if (arguments.length >= 1) {
        buffer.push([err, value])
      }

      // We have something to output
      // and a callback, do it
      if (_cb && buffer.length > 0) {
        var cb = _cb
        _cb = null
        var call = buffer.shift()
        cb(call[0], call[1])
      }
    }
1026709
public void dump(PrintStream output) {
        TreeSet<String> keys = new TreeSet<String>(keySet());
        for (String key : keys) {
            output.println(key + ":" + get(key));
        }
    }
68900
private static ChunkOutput writeOutput(Compiler compiler, Flags flags) {
    ArrayList<File> outputFiles = new ArrayList<>();
    ChunkOutput output = new ChunkOutput();

    File file = new File();
    file.path = flags.jsOutputFile;

    String code = compiler.toSource();
    String prefix = "";
    String postfix = "";
    if (flags.outputWrapper != null) {
      String marker = null;
      int pos = flags.outputWrapper.indexOf(OUTPUT_MARKER_JS_STRING);
      if (pos != -1) {
        // With jsstring, run SourceCodeEscapers (as per AbstractCommandLineRunner).
        code = SourceCodeEscapers.javascriptEscaper().escape(code);
        marker = OUTPUT_MARKER_JS_STRING;
      } else {
        pos = flags.outputWrapper.indexOf(OUTPUT_MARKER);
        if (pos != -1) {
          marker = OUTPUT_MARKER;
        }
      }

      if (marker != null) {
        prefix = flags.outputWrapper.substring(0, pos);
        SourceMap sourceMap = compiler.getSourceMap();
        if (sourceMap != null) {
          sourceMap.setWrapperPrefix(prefix);
        }
      }
      postfix = flags.outputWrapper.substring(pos + marker.length());
    }
    if (flags.createSourceMap != null && !flags.createSourceMap.equals(false)) {
      StringBuilder b = new StringBuilder();
      try {
        compiler.getSourceMap().appendTo(b, flags.jsOutputFile);
      } catch (IOException e) {
        // ignore
      }
      file.sourceMap = b.toString();
    }

    file.src = prefix + code + postfix;
    outputFiles.add(file);
    output.compiledFiles = outputFiles.toArray(new File[0]);
    output.compiledCode = file.src;
    output.sourceMap = file.sourceMap;
    return output;
  }
829014
public void printResults() {
	System.out.println("[ --- Lucee Debug Response --- ]");
	System.out.println();

	System.out.println("----------------------------");
	System.out.println("|          Output          |");
	System.out.println("----------------------------");
	System.out.println(write);
	System.out.println();

	System.out.println("----------------------------");
	System.out.println("|       Debug Output       |");
	System.out.println("----------------------------");
	System.out.println(writeDebug);
	System.out.println();

	System.out.println("----------------------------");
	System.out.println("|        Variables         |");
	System.out.println("----------------------------");

	Enumeration e = variables.keys();
	while (e.hasMoreElements()) {
	    final Object key = e.nextElement();
	    System.out.println("[Variable:" + key + "]");
	    System.out.println(escapeString(variables.get(key).toString()));
	}
	System.out.println();

	e = queries.keys();
	while (e.hasMoreElements()) {
	    final Query query = (Query) queries.get(e.nextElement());
	    printQuery(query);
	    System.out.println();
	}

    }
556958
function printOut(){
		for($i=0;$i<sizeof($this->_Buffer);$i++){
			$this->_Buffer[$i]->flush();
		}
	}
154707
public function outputPlaintext()
    {
        echo str_repeat('=', 100) . "\n";
        echo $this->_backtrace[0]['file'] . ':' . $this->_backtrace[1]['function'] . ':' . $this->_backtrace[0]['line'] . "\n";
        echo str_repeat('-', 100) . "\n";
        echo self::dump($this->_var, $this->_depth, false);
        echo str_repeat('=', 100) . "\n";
    }
421267
@GwtIncompatible("Unnecessary")
  void writeOutput(
      Appendable out,
      Compiler compiler,
      @Nullable JSModule module,
      String wrapper,
      String codePlaceholder,
      @Nullable Function<String, String> escaper)
      throws IOException {
    if (compiler.getOptions().outputJs == OutputJs.SENTINEL) {
      out.append("// No JS output because the compiler was run in checks-only mode.\n");
      return;
    }
    checkState(compiler.getOptions().outputJs == OutputJs.NORMAL);

    String code = module == null ? compiler.toSource() : compiler.toSource(module);
    writeOutput(out, compiler, code, wrapper, codePlaceholder, escaper);
  }
196323
@GwtIncompatible("Unnecessary")
  private void outputStringMap() throws IOException {
    if (!config.stringMapOutputPath.isEmpty()) {
      if (compiler.getStringMap() == null) {
        // Ensure an empty file is created if there is no string map.
        // This avoids confusing some build tools that expect to see the file, even if it is empty.
        if (!(new File(config.stringMapOutputPath).createNewFile())) {
          throw new IOException("Could not create file: " + config.stringMapOutputPath);
        }
      } else {
        compiler.getStringMap().save(config.stringMapOutputPath);
      }
    }
  }
294041
public function output( \Throwable $e )
    {
        $out = '';

        $out .= "=============================================================" . PHP_EOL;
        $out .= "Exception stack trace " . PHP_EOL;
        $out .= "=============================================================" . PHP_EOL;

        $out .= PHP_EOL;
        $out .= "* Defined Constants *" . PHP_EOL;
        $out .= "-------------------------------------------------------------" . PHP_EOL;
        $declared_constants = Util::getUserDefinedConstants();
        foreach( $declared_constants as $key => $value ){
            $out .= "[$key] $value" . PHP_EOL;
        }
        $out .= "-------------------------------------------------------------" . PHP_EOL;
    
        $out .= PHP_EOL;
        $out .= "* Exception Stack *" . PHP_EOL;
        $out .= "-------------------------------------------------------------" . PHP_EOL;

        $first_exception = $e;

        $no = 1;
        while( $e )
        {
            // get exception info
            $clazz = get_class($e);
            $file = $e->getFile();
            $line = $e->getLine();
            $message = $e->getMessage();

            // print exception info
            $out .= "[$no]$clazz" . PHP_EOL;
            $out .= "   $file($line)" . PHP_EOL;
            $out .= "   $message" . PHP_EOL;

            // move to previous exception
            $e = method_exists( $e, 'getPrevious' ) ? $e->getPrevious() : NULL;
            $no ++;
            if ( $e ){
                $out .= PHP_EOL;
            }
        }


        // get backtrace
        if ( $first_exception instanceof CalgamoException ){
            $backtrace = $first_exception->getBackTraceList();

            $out .= PHP_EOL;
            $out .= "* Call Stack *" . PHP_EOL;
            $out .= "-------------------------------------------------------------" . PHP_EOL;

            // print backtrace
            $call_no = 0;
            foreach( $backtrace as $element ){
                $klass = isset($element['class']) ? $element['class'] : '';
                $func  = isset($element['function']) ? $element['function'] : '';
                $type  = isset($element['type']) ? $element['type'] : '';
                $file  = isset($element['file']) ? $element['file'] : '';
                $line  = isset($element['line']) ? $element['line'] : '';

                if ( $call_no > 0 ){
                    $out .= PHP_EOL;
                }
                $out .= "[$call_no]{$klass}{$type}{$func}()" . PHP_EOL;
                $out .= "   {$file}($line)" . PHP_EOL;

                $call_no ++;
            }
        }
        
        // additional debugtrace
        if ($this->additional)
        {
            $title = $this->additional->getAdditionalInfoTitle();
            
            $out .= PHP_EOL;
            $out .= "* {$title} *" . PHP_EOL;
            $out .= "-------------------------------------------------------------" . PHP_EOL;
            
            $this->additional->renderAdditionalInfo( $e, $out );
        }
    
        return $out;
    }
1065161
function processOutputs(outputs) {
  var removeSourceMaps = require('./sourcemaps').removeSourceMaps;

  var offset = 0;

  var outputObj = {};

  var sources = outputObj.sources = [];
  var sourceMapsWithOffsets = outputObj.sourceMapsWithOffsets = [];

  outputs.forEach(function(output) {
    var source;
    if (typeof output == 'object') {
      source = output.source || '';
      var offset_ = output.sourceMapOffset || 0;
      var map = output.sourceMap;
      if (map) {
        sourceMapsWithOffsets.push([offset + offset_, map]);
      }
    }
    // NB perhaps we should enforce output is always an object down the chain?
    else if (typeof output == 'string') {
      source = output;
    }
    else {
      var format = output ? output.toString() : typeof output;
      throw new Error("Unexpected output format: " + format);
    }
    source = removeSourceMaps(source || '');
    offset += countLines(source);
    sources.push(source);
  });

  return outputObj;
}