Path: blob/master/runtime/compiler/env/FilePointer.hpp
6000 views
/*******************************************************************************1* Copyright (c) 2000, 2021 IBM Corp. and others2*3* This program and the accompanying materials are made available under4* the terms of the Eclipse Public License 2.0 which accompanies this5* distribution and is available at https://www.eclipse.org/legal/epl-2.0/6* or the Apache License, Version 2.0 which accompanies this distribution and7* is available at https://www.apache.org/licenses/LICENSE-2.0.8*9* This Source Code may also be made available under the following10* Secondary Licenses when the conditions for such availability set11* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU12* General Public License, version 2 with the GNU Classpath13* Exception [1] and GNU General Public License, version 2 with the14* OpenJDK Assembly Exception [2].15*16* [1] https://www.gnu.org/software/classpath/license.html17* [2] http://openjdk.java.net/legal/assembly-exception.html18*19* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception20*******************************************************************************/2122#ifndef TR_FILEPOINTER_INCL23#define TR_FILEPOINTER_INCL2425#include <stdio.h>26#include <stdint.h>27#include "env/FilePointerDecl.hpp"2829extern "C" { struct J9PortLibrary; }3031namespace TR32{33struct FilePointer34{3536FilePointer(::FILE *stream);3738void initialize(J9PortLibrary *portLib, int32_t fileId);39void initialize(::FILE *stream);4041int32_t write(J9PortLibrary *portLib, char *buf, int32_t length);4243void close(J9PortLibrary *portLib);4445void flush(J9PortLibrary *portLib);4647union48{49int32_t _fileId;50::FILE *_stream;51};5253static FILE *Null() { return &_null; }54static FILE *Stdin() { return &_stdin; }55static FILE *Stdout() { return &_stdout; }56static FILE *Stderr() { return &_stderr; }5758private:5960static FILE _null;61static FILE _stdin;62static FILE _stdout;63static FILE _stderr;6465void swap();66uint8_t cipher(uint8_t c);6768bool _useJ9IO;69};7071}727374#endif757677