2 * Copyright (C) 2014, United States Government, as represented by the
3 * Administrator of the National Aeronautics and Space Administration.
6 * The Java Pathfinder core (jpf-core) platform is licensed under the
7 * Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0.
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 package gov.nasa.jpf.util;
21 import gov.nasa.jpf.vm.MJIEnv;
23 import java.io.PrintStream;
25 public class PrintUtils {
27 public static void printChar (PrintStream ps, char c){
29 case '\n': ps.print("\\n"); break;
30 case '\r': ps.print("\\r"); break;
31 case '\t': ps.print("\\t"); break;
32 case '\b': ps.print("\\b"); break;
33 case '\f': ps.print("\\f"); break;
34 case '\'': ps.print("\\'"); break;
35 case '\"': ps.print("\\\""); break;
36 case '\\': ps.print("\\"); break;
41 public static void printCharLiteral (PrintStream ps, char c){
47 public static void printStringLiteral (PrintStream ps, char[] data, int max){
54 for (i=0; i<max; i++){
55 printChar(ps, data[i]);
65 // this is mostly here so that we use the same convention
66 public static void printReference (PrintStream ps, int ref){
67 if (ref == MJIEnv.NULL){