001 /**
002 * Copyright (C) 2009, Progress Software Corporation and/or its
003 * subsidiaries or affiliates. All rights reserved.
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.fusesource.jansi.internal;
018
019 import static org.fusesource.hawtjni.runtime.FieldFlag.CONSTANT;
020 import static org.fusesource.hawtjni.runtime.MethodFlag.CONSTANT_INITIALIZER;
021
022 import org.fusesource.hawtjni.runtime.JniClass;
023 import org.fusesource.hawtjni.runtime.JniField;
024 import org.fusesource.hawtjni.runtime.JniMethod;
025 import org.fusesource.hawtjni.runtime.Library;
026
027 /**
028 * Interface to access some low level POSIX functions.
029 *
030 * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
031 */
032 @JniClass()
033 public class CLibrary {
034
035 private static final Library LIBRARY = new Library("jansi", CLibrary.class);
036 static {
037 LIBRARY.load();
038 init();
039 }
040
041 @JniMethod(flags={CONSTANT_INITIALIZER})
042 private static final native void init();
043
044 @JniField(flags={CONSTANT}, conditional="defined(STDIN_FILENO)")
045 public static int STDIN_FILENO;
046 @JniField(flags={CONSTANT}, conditional="defined(STDIN_FILENO)")
047 public static int STDOUT_FILENO;
048 @JniField(flags={CONSTANT}, conditional="defined(STDIN_FILENO)")
049 public static int STDERR_FILENO;
050
051 @JniField(flags={CONSTANT}, accessor="1", conditional="defined(HAVE_ISATTY)")
052 public static boolean HAVE_ISATTY;
053 @JniMethod(conditional="defined(HAVE_ISATTY)")
054 public static final native int isatty(int fd);
055
056
057 }