//Mike Maxim
//Global usefulness

package edu.cmu.cs.l3.general;

import java.io.*;

public class Globals {
    public Globals() {
    }

    public static boolean verboseCompilation = false;
    public static boolean underCygwin = false;

    public static void shutdown(int code) {
        File curdir = new File(".");
        File[] files = curdir.listFiles();
        int i;
        for (i = 0;  i < files.length; i++) {
            if (files[i].getName().endsWith(".m__")) {
                if (!files[i].delete()) { }
            }
        }
        System.exit(code);
    }

    public static void verbosePrint(String s) {
        if (verboseCompilation) {
            System.out.print(s);
        }
    }

    public static void verbosePrintln(String s) {
        if (verboseCompilation) {
            System.out.println(s);
        }
    }

    public static String extFunctionName(String f) {
        if (underCygwin)
            return "_" + f;
        return f;
    }
}