This commit is contained in:
745
ase/cmd/awk/AseAwk.java
Normal file
745
ase/cmd/awk/AseAwk.java
Normal file
@ -0,0 +1,745 @@
|
||||
/*
|
||||
* $Id: AseAwk.java,v 1.16 2007/10/24 03:46:51 bacon Exp $
|
||||
*/
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.net.URL;
|
||||
|
||||
import ase.awk.StdAwk;
|
||||
import ase.awk.Console;
|
||||
import ase.awk.Context;
|
||||
import ase.awk.Argument;
|
||||
import ase.awk.Return;
|
||||
|
||||
public class AseAwk extends StdAwk
|
||||
{
|
||||
private static void run_in_awt ()
|
||||
{
|
||||
final Frame frame = new Frame ();
|
||||
|
||||
frame.setLayout (new BorderLayout());
|
||||
frame.setTitle (AseAwk.class.getName());
|
||||
frame.setSize (640, 480);
|
||||
frame.addWindowListener (new WindowListener ()
|
||||
{
|
||||
public void windowActivated (WindowEvent e) {}
|
||||
public void windowClosed (WindowEvent e) {}
|
||||
public void windowClosing (WindowEvent e) { frame.dispose (); }
|
||||
public void windowDeactivated (WindowEvent e) {}
|
||||
public void windowDeiconified (WindowEvent e) {}
|
||||
public void windowIconified (WindowEvent e) {}
|
||||
public void windowOpened (WindowEvent e) {}
|
||||
});
|
||||
|
||||
frame.add (new AseAwkPanel(), BorderLayout.CENTER);
|
||||
frame.setVisible (true);
|
||||
}
|
||||
|
||||
private static void print_usage ()
|
||||
{
|
||||
System.out.print ("Usage: ");
|
||||
System.out.print (AseAwk.class.getName());
|
||||
|
||||
System.out.println (" [-m main] [-si file]? [-so file]? [-ci file]* [-co file]* [-a arg]* [-w o:n]*");
|
||||
System.out.println (" -m main Specify the main function name");
|
||||
System.out.println (" -si file Specify the input source file");
|
||||
System.out.println (" The source code is read from stdin when it is not specified");
|
||||
System.out.println (" -so file Specify the output source file");
|
||||
System.out.println (" The deparsed code is not output when is it not specified");
|
||||
System.out.println (" -ci file Specify the input console file");
|
||||
System.out.println (" -co file Specify the output console file");
|
||||
System.out.println (" -a str Specify an argument");
|
||||
System.out.println (" -w o:n Specify an old and new word pair");
|
||||
System.out.println (" o - an original word");
|
||||
System.out.println (" n - the new word to replace the original word");
|
||||
}
|
||||
|
||||
private static void print_error (String msg)
|
||||
{
|
||||
System.out.print ("Error: ");
|
||||
System.out.println (msg);
|
||||
}
|
||||
|
||||
private static String get_dll_name ()
|
||||
{
|
||||
URL url = AseAwk.class.getResource (
|
||||
AseAwk.class.getName() + ".class");
|
||||
if (url == null)
|
||||
{
|
||||
// probably it is compiled with gcj
|
||||
|
||||
// TODO: ....
|
||||
String osname = System.getProperty ("os.name").toLowerCase();
|
||||
String aseBase = "..";
|
||||
String path;
|
||||
|
||||
if (osname.startsWith ("windows"))
|
||||
{
|
||||
path = aseBase + "\\lib\\aseawk_jni.dll";
|
||||
}
|
||||
else if (osname.startsWith ("mac"))
|
||||
{
|
||||
path = aseBase + "/lib/.libs/libaseawk_jni.dylib";
|
||||
}
|
||||
else
|
||||
{
|
||||
path = aseBase + "/lib/.libs/libaseawk_jni.so";
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
else
|
||||
{
|
||||
java.io.File file = new java.io.File (url.getFile());
|
||||
|
||||
String osname = System.getProperty ("os.name").toLowerCase();
|
||||
String aseBase = file.getParentFile().getParentFile().getParent();
|
||||
|
||||
String path;
|
||||
|
||||
if (osname.startsWith ("windows"))
|
||||
{
|
||||
path = aseBase + "\\lib\\aseawk_jni.dll";
|
||||
return path.substring(6);
|
||||
}
|
||||
else if (osname.startsWith ("mac"))
|
||||
{
|
||||
path = aseBase + "/lib/.libs/libaseawk_jni.dylib";
|
||||
return path.substring(5);
|
||||
}
|
||||
else
|
||||
{
|
||||
path = aseBase + "/lib/.libs/libaseawk_jni.so";
|
||||
return path.substring(5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void run_in_console (String[] args)
|
||||
{
|
||||
AseAwk awk = null;
|
||||
|
||||
String dll = get_dll_name();
|
||||
try
|
||||
{
|
||||
System.load (dll);
|
||||
}
|
||||
catch (java.lang.UnsatisfiedLinkError e)
|
||||
{
|
||||
print_error ("cannot load the library - " + dll);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
awk = new AseAwk ();
|
||||
awk.setMaxDepth (AseAwk.DEPTH_BLOCK_PARSE, 30);
|
||||
awk.setDebug (true);
|
||||
//awk.setDebug (false);
|
||||
}
|
||||
catch (ase.awk.Exception e)
|
||||
{
|
||||
print_error ("ase.awk.Exception - " + e.getMessage());
|
||||
}
|
||||
|
||||
int mode = 0;
|
||||
String mainfn = null;
|
||||
String srcin = null;
|
||||
String srcout = null;
|
||||
int nsrcins = 0;
|
||||
int nsrcouts = 0;
|
||||
//ArrayList<String> params = new ArrayList<String> ();
|
||||
ArrayList params = new ArrayList ();
|
||||
|
||||
//for (String arg: args)
|
||||
for (int i = 0; i < args.length; i++)
|
||||
{
|
||||
String arg = args[i];
|
||||
if (mode == 0)
|
||||
{
|
||||
if (arg.equals("-si")) mode = 1;
|
||||
else if (arg.equals("-so")) mode = 2;
|
||||
else if (arg.equals("-ci")) mode = 3;
|
||||
else if (arg.equals("-co")) mode = 4;
|
||||
else if (arg.equals("-a")) mode = 5;
|
||||
else if (arg.equals("-m")) mode = 6;
|
||||
else if (arg.equals("-w")) mode = 7;
|
||||
else
|
||||
{
|
||||
print_usage ();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (arg.length() >= 1 && arg.charAt(0) == '-')
|
||||
{
|
||||
print_usage ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (mode == 1) // source input
|
||||
{
|
||||
if (nsrcins != 0)
|
||||
{
|
||||
print_usage ();
|
||||
return;
|
||||
}
|
||||
|
||||
srcin = arg;
|
||||
nsrcins++;
|
||||
mode = 0;
|
||||
}
|
||||
else if (mode == 2) // source output
|
||||
{
|
||||
if (nsrcouts != 0)
|
||||
{
|
||||
print_usage ();
|
||||
return;
|
||||
}
|
||||
|
||||
srcout = arg;
|
||||
nsrcouts++;
|
||||
mode = 0;
|
||||
}
|
||||
else if (mode == 3) // console input
|
||||
{
|
||||
awk.addConsoleInput (arg);
|
||||
mode = 0;
|
||||
}
|
||||
else if (mode == 4) // console output
|
||||
{
|
||||
awk.addConsoleOutput (arg);
|
||||
mode = 0;
|
||||
}
|
||||
else if (mode == 5) // argument mode
|
||||
{
|
||||
params.add (arg);
|
||||
mode = 0;
|
||||
}
|
||||
else if (mode == 6)
|
||||
{
|
||||
if (mainfn != null)
|
||||
{
|
||||
print_usage ();
|
||||
return;
|
||||
}
|
||||
|
||||
mainfn = arg;
|
||||
mode = 0;
|
||||
}
|
||||
else if (mode == 7)
|
||||
{
|
||||
int idx = arg.indexOf(':');
|
||||
if (idx == -1)
|
||||
{
|
||||
print_usage ();
|
||||
return;
|
||||
}
|
||||
|
||||
String ow = arg.substring (0, idx);
|
||||
String nw = arg.substring (idx+1);
|
||||
try { awk.setWord (ow, nw); }
|
||||
catch (Exception e) {/* don't care */}
|
||||
mode = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mode != 0)
|
||||
{
|
||||
print_usage ();
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
awk.parse (srcin, srcout);
|
||||
//awk.run (mainfn, params.toArray(new String[0]));
|
||||
awk.run (mainfn, (String[])params.toArray(new String[0]));
|
||||
}
|
||||
catch (ase.awk.Exception e)
|
||||
{
|
||||
if (e.getLine() == 0)
|
||||
{
|
||||
print_error ("ase.awk.Exception - " + e.getMessage());
|
||||
}
|
||||
else
|
||||
{
|
||||
print_error (
|
||||
"ase.awk.Exception at line " +
|
||||
e.getLine() + " - " + e.getMessage());
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (awk != null)
|
||||
{
|
||||
awk.close ();
|
||||
awk = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main (String[] args)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
run_in_awt ();
|
||||
}
|
||||
else
|
||||
{
|
||||
run_in_console (args);
|
||||
}
|
||||
}
|
||||
|
||||
private Reader srcReader;
|
||||
private Writer srcWriter;
|
||||
private String srcInName;
|
||||
private String srcOutName;
|
||||
|
||||
private LinkedList conInNames;
|
||||
private LinkedList conOutNames;
|
||||
private Iterator conInIter;
|
||||
private Iterator conOutIter;
|
||||
|
||||
public AseAwk () throws ase.awk.Exception
|
||||
{
|
||||
super ();
|
||||
|
||||
srcReader = null;
|
||||
srcWriter = null;
|
||||
|
||||
srcInName = null;
|
||||
srcOutName = null;
|
||||
|
||||
conInNames = new LinkedList ();
|
||||
conOutNames = new LinkedList ();
|
||||
|
||||
addFunction ("sleep", 1, 1);
|
||||
}
|
||||
|
||||
public void sleep (Context ctx, String name, Return ret, Argument[] args) throws ase.awk.Exception
|
||||
{
|
||||
try { Thread.sleep (args[0].getIntValue() * 1000); }
|
||||
catch (InterruptedException e) {}
|
||||
ret.setIntValue (0);
|
||||
}
|
||||
|
||||
public void parse () throws ase.awk.Exception
|
||||
{
|
||||
srcInName = null;
|
||||
srcOutName = null;
|
||||
super.parse ();
|
||||
}
|
||||
|
||||
public void parse (String inName) throws ase.awk.Exception
|
||||
{
|
||||
srcInName = inName;
|
||||
srcOutName = null;
|
||||
super.parse ();
|
||||
}
|
||||
|
||||
public void parse (String inName, String outName) throws ase.awk.Exception
|
||||
{
|
||||
srcInName = inName;
|
||||
srcOutName = outName;
|
||||
super.parse ();
|
||||
}
|
||||
|
||||
public void run (String main, String[] args) throws ase.awk.Exception
|
||||
{
|
||||
conInIter = conInNames.iterator();
|
||||
conOutIter = conOutNames.iterator();
|
||||
super.run (main, args);
|
||||
}
|
||||
|
||||
public void addConsoleInput (String name)
|
||||
{
|
||||
conInNames.addLast (name);
|
||||
}
|
||||
|
||||
public void addConsoleOutput (String name)
|
||||
{
|
||||
conOutNames.addLast (name);
|
||||
}
|
||||
|
||||
protected int openSource (int mode)
|
||||
{
|
||||
if (mode == SOURCE_READ)
|
||||
{
|
||||
Reader isr;
|
||||
|
||||
if (srcInName == null || srcInName.length() == 0)
|
||||
{
|
||||
isr = stdin;
|
||||
}
|
||||
else
|
||||
{
|
||||
FileInputStream fis;
|
||||
try { fis = new FileInputStream (srcInName); }
|
||||
catch (IOException e) { return -1; }
|
||||
isr = new BufferedReader(new InputStreamReader (fis));
|
||||
}
|
||||
if (isr == null) return -1;
|
||||
|
||||
srcReader = isr;
|
||||
return 1;
|
||||
}
|
||||
else if (mode == SOURCE_WRITE)
|
||||
{
|
||||
Writer osw;
|
||||
|
||||
if (srcOutName == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (srcOutName.length() == 0)
|
||||
{
|
||||
osw = stdout;
|
||||
}
|
||||
else
|
||||
{
|
||||
FileOutputStream fos;
|
||||
try { fos = new FileOutputStream (srcOutName); }
|
||||
catch (IOException e) { return -1; }
|
||||
osw = new BufferedWriter(new OutputStreamWriter (fos));
|
||||
}
|
||||
|
||||
srcWriter = osw;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected int closeSource (int mode)
|
||||
{
|
||||
if (mode == SOURCE_READ)
|
||||
{
|
||||
if (srcReader != null)
|
||||
{
|
||||
if (srcReader == stdin)
|
||||
{
|
||||
srcReader = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
srcReader.close ();
|
||||
srcReader = null;
|
||||
}
|
||||
catch (IOException e) { return -1; }
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else if (mode == SOURCE_WRITE)
|
||||
{
|
||||
if (srcWriter != null)
|
||||
{
|
||||
if (srcWriter == stdout)
|
||||
{
|
||||
try
|
||||
{
|
||||
srcWriter.flush ();
|
||||
srcWriter = null;
|
||||
}
|
||||
catch (IOException e) { return -1; }
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
srcWriter.close ();
|
||||
srcWriter = null;
|
||||
}
|
||||
catch (IOException e) { return -1; }
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected int readSource (char[] buf, int len)
|
||||
{
|
||||
try
|
||||
{
|
||||
int n = srcReader.read (buf, 0, len);
|
||||
if (n == -1) n = 0;
|
||||
return n;
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
protected int writeSource (char[] buf, int len)
|
||||
{
|
||||
if (srcWriter == null) return len;
|
||||
|
||||
try { srcWriter.write (buf, 0, len); }
|
||||
catch (IOException e) { return -1; }
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
protected int openConsole (Console con)
|
||||
{
|
||||
int mode = con.getMode ();
|
||||
|
||||
if (mode == Console.MODE_READ)
|
||||
{
|
||||
Reader rd;
|
||||
|
||||
if (!conInIter.hasNext()) rd = stdin;
|
||||
else
|
||||
{
|
||||
FileInputStream fis;
|
||||
String fn = (String)conInIter.next();
|
||||
try
|
||||
{
|
||||
fis = new FileInputStream (fn);
|
||||
rd = new BufferedReader(
|
||||
new InputStreamReader (fis));
|
||||
}
|
||||
catch (IOException e) { return -1; }
|
||||
|
||||
try { con.setFileName (fn); }
|
||||
catch (ase.awk.Exception e)
|
||||
{
|
||||
try { rd.close(); }
|
||||
catch (IOException e2) {}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
con.setHandle (rd);
|
||||
return 1;
|
||||
}
|
||||
else if (mode == Console.MODE_WRITE)
|
||||
{
|
||||
Writer wr;
|
||||
|
||||
if (!conOutIter.hasNext()) wr = stdout;
|
||||
else
|
||||
{
|
||||
FileOutputStream fos;
|
||||
String fn = (String)conOutIter.next();
|
||||
try
|
||||
{
|
||||
fos = new FileOutputStream (fn);
|
||||
wr = new BufferedWriter(
|
||||
new OutputStreamWriter (fos));
|
||||
}
|
||||
catch (IOException e) { return -1; }
|
||||
|
||||
try { con.setFileName (fn); }
|
||||
catch (ase.awk.Exception e)
|
||||
{
|
||||
try { wr.close(); }
|
||||
catch (IOException e2) {}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
con.setHandle (wr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
protected int closeConsole (Console con)
|
||||
{
|
||||
int mode = con.getMode ();
|
||||
|
||||
if (mode == Console.MODE_READ)
|
||||
{
|
||||
Reader rd = (Reader)con.getHandle();
|
||||
if (rd != null && rd != stdin)
|
||||
{
|
||||
try { rd.close (); }
|
||||
catch (IOException e) { return -1; }
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
else if (mode == Console.MODE_WRITE)
|
||||
{
|
||||
Writer wr = (Writer)con.getHandle();
|
||||
if (wr != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
wr.flush ();
|
||||
if (wr != stdout) wr.close ();
|
||||
}
|
||||
catch (IOException e) { return -1; }
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected int readConsole (Console con, char[] buf, int len)
|
||||
{
|
||||
int mode = con.getMode ();
|
||||
|
||||
if (mode == Console.MODE_READ)
|
||||
{
|
||||
Reader rd = (Reader)con.getHandle();
|
||||
|
||||
try
|
||||
{
|
||||
int n = rd.read (buf, 0, len);
|
||||
if (n == -1) n = 0;
|
||||
return n;
|
||||
}
|
||||
catch (IOException e) { return -1; }
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected int writeConsole (Console con, char[] buf, int len)
|
||||
{
|
||||
int mode = con.getMode ();
|
||||
|
||||
if (mode == Console.MODE_WRITE)
|
||||
{
|
||||
Writer wr = (Writer)con.getHandle();
|
||||
try
|
||||
{
|
||||
wr.write (buf, 0, len);
|
||||
wr.flush ();
|
||||
}
|
||||
catch (IOException e) { return -1; }
|
||||
return len;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected int flushConsole (Console con)
|
||||
{
|
||||
int mode = con.getMode ();
|
||||
|
||||
if (mode == Console.MODE_WRITE)
|
||||
{
|
||||
Writer wr = (Writer)con.getHandle();
|
||||
try { wr.flush (); }
|
||||
catch (IOException e) { return -1; }
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected int nextConsole (Console con)
|
||||
{
|
||||
int mode = con.getMode ();
|
||||
|
||||
if (mode == Console.MODE_READ)
|
||||
{
|
||||
if (!conInIter.hasNext()) return 0;
|
||||
String fn = (String)conInIter.next();
|
||||
|
||||
Reader rd;
|
||||
FileInputStream fis;
|
||||
try
|
||||
{
|
||||
fis = new FileInputStream (fn);
|
||||
rd = new BufferedReader(
|
||||
new InputStreamReader (fis));
|
||||
}
|
||||
catch (IOException e) { return -1; }
|
||||
|
||||
try { con.setFileName (fn); }
|
||||
catch (ase.awk.Exception e)
|
||||
{
|
||||
try { rd.close(); }
|
||||
catch (IOException e2) {}
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reader tmp = (Reader)con.getHandle();
|
||||
if (tmp != stdin)
|
||||
{
|
||||
try { tmp.close (); }
|
||||
catch (IOException e)
|
||||
{
|
||||
try { rd.close (); }
|
||||
catch (IOException e2) {}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
con.setHandle (rd);
|
||||
return 1;
|
||||
}
|
||||
else if (mode == Console.MODE_WRITE)
|
||||
{
|
||||
if (!conOutIter.hasNext()) return 0;
|
||||
String fn = (String)conOutIter.next();
|
||||
|
||||
Writer wr;
|
||||
FileOutputStream fos;
|
||||
try
|
||||
{
|
||||
fos = new FileOutputStream (fn);
|
||||
wr = new BufferedWriter(
|
||||
new OutputStreamWriter (fos));
|
||||
}
|
||||
catch (IOException e) { return -1; }
|
||||
|
||||
try { con.setFileName (fn); }
|
||||
catch (ase.awk.Exception e)
|
||||
{
|
||||
try { wr.close(); }
|
||||
catch (IOException e2) {}
|
||||
return -1;
|
||||
}
|
||||
|
||||
Writer tmp = (Writer)con.getHandle();
|
||||
if (tmp != stdout)
|
||||
{
|
||||
try { tmp.close (); }
|
||||
catch (IOException e)
|
||||
{
|
||||
try { wr.close (); }
|
||||
catch (IOException e2) {}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
con.setHandle (wr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
91
ase/cmd/awk/AseAwkApplet-id.html
Normal file
91
ase/cmd/awk/AseAwkApplet-id.html
Normal file
@ -0,0 +1,91 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv=content-type content="text/html; charset=UTF-8">
|
||||
<title>Online AWK Interpreter</title>
|
||||
<style>
|
||||
body { font-family: georgia, tahoma, arial, sans-serif; }
|
||||
p { font-size: 13px; }
|
||||
h2 { font-size: 24px; font-style: italic; }
|
||||
</style>
|
||||
|
||||
<script language='javascript'>
|
||||
|
||||
function resize()
|
||||
{
|
||||
var width, height;
|
||||
|
||||
if (navigator.appName.indexOf("Microsoft") == -1)
|
||||
{
|
||||
width = window.innerWidth;
|
||||
height = window.innerHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
width = document.body.clientWidth;
|
||||
height = document.body.clientHeight;
|
||||
}
|
||||
|
||||
document.AseAwkApplet.width = width - 250;
|
||||
document.AseAwkApplet.height = height - 80;
|
||||
window.scroll (0, 0);
|
||||
}
|
||||
|
||||
function load_sample1()
|
||||
{
|
||||
document.AseAwkApplet.clear ();
|
||||
|
||||
document.AseAwkApplet.setSourceInput (
|
||||
'# wordfreq.awk --- print list of word frequencies\n' +
|
||||
'{\n' +
|
||||
' $0 = tolower($0); # remove case distinctions\n' +
|
||||
'\n' +
|
||||
' # remove punctuation\n' +
|
||||
' gsub(/[^[:alnum:]_[:blank:]]/, " ");\n' +
|
||||
'\n' +
|
||||
' for (i = 1; i <= NF; i++) freq[$i]++;\n' +
|
||||
'}\n' +
|
||||
'\n' +
|
||||
'END {\n' +
|
||||
' for (word in freq)\n' +
|
||||
' print word, freq[word];\n' +
|
||||
'}\n');
|
||||
|
||||
document.AseAwkApplet.setConsoleInput (
|
||||
'ASE aims to produce a script engine framework to ease the burden of creating a proprietary scripting language.\n' +
|
||||
'It allows a hosting application to access various aspects of the embedded script engine and vice versa.');
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body onLoad="resize()" onResize="resize()">
|
||||
|
||||
<h2>Online AWK Interpreter</h2>
|
||||
|
||||
<table cellspacing=3>
|
||||
<tr>
|
||||
<td valign=top>
|
||||
<script src='AseAwkApplet.js'></script>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<p>
|
||||
Applet ini untuk menguji binding JNI yang Interpreternya <a href='http://kldp.net/projects/ase/'>ASE</a> AWK. Bahasa AWK ini agak berbeda dengan yang standar, yang setiap perintah diakhri dengan tanda semikolon. You can enter a valid AWK program into the source input window and click on the <b>Run Awk</b> button while entering arbitrary text into the console input window if needed. You may click <a href='#' onClick='load_sample1(); return true;'>here</a> to load a sample program instead.
|
||||
</p>
|
||||
<p>
|
||||
<b>Note</b>: This java applet has been signed with a self-signed certificate. If you allow the applet to run, it will download a JNI file into your home directory. Currently, it supports Linux(i386) and Microsoft Windows(x86). If you decide to clean your system later, don't forget to delete the local JNI file downloaded.
|
||||
</p>
|
||||
<p>
|
||||
Copyright (c) 2006-2007, Hyung-Hwan Chung. All rights reserved.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
_uacct = "UA-3036869-1";
|
||||
urchinTracker();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
84
ase/cmd/awk/AseAwkApplet-ko.html
Normal file
84
ase/cmd/awk/AseAwkApplet-ko.html
Normal file
@ -0,0 +1,84 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv=content-type content="text/html; charset=UTF-8">
|
||||
<title>온라인 AWK 인터프리터</title>
|
||||
<style>
|
||||
body { font-family: georgia, tahoma, arial, sans-serif; }
|
||||
p { font-size: 13px; }
|
||||
h2 { font-size: 24px; font-style: italic; }
|
||||
</style>
|
||||
|
||||
<script language='javascript'>
|
||||
|
||||
function resize()
|
||||
{
|
||||
var width, height;
|
||||
|
||||
if (navigator.appName.indexOf("Microsoft") == -1)
|
||||
{
|
||||
width = window.innerWidth;
|
||||
height = window.innerHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
width = document.body.clientWidth;
|
||||
height = document.body.clientHeight;
|
||||
}
|
||||
|
||||
document.AseAwkApplet.width = width - 250;
|
||||
document.AseAwkApplet.height = height - 80;
|
||||
window.scroll (0, 0);
|
||||
}
|
||||
|
||||
function load_sample1()
|
||||
{
|
||||
document.AseAwkApplet.clear ();
|
||||
|
||||
document.AseAwkApplet.setSourceInput (
|
||||
'# wordfreq.awk --- print list of word frequencies\n' +
|
||||
'{\n' +
|
||||
' $0 = tolower($0); # remove case distinctions\n' +
|
||||
'\n' +
|
||||
' # remove punctuation\n' +
|
||||
' gsub(/[^[:alnum:]_[:blank:]]/, " ");\n' +
|
||||
'\n' +
|
||||
' for (i = 1; i <= NF; i++) freq[$i]++;\n' +
|
||||
'}\n' +
|
||||
'\n' +
|
||||
'END {\n' +
|
||||
' for (word in freq)\n' +
|
||||
' print word, freq[word];\n' +
|
||||
'}\n');
|
||||
|
||||
document.AseAwkApplet.setConsoleInput (
|
||||
'ASE는 응용프로그램에 스크립팅언어을 쉽게 내장할 수 있도록 하는 스크립팅엔진 프레임웍크 제작을 목표로 한다.\n' +
|
||||
'호스팅 프로그램에서 엔진을 제어할 수 있을 뿐만 아니라, 반대로 엔진에서도 호스팅 프로그램을 접근 할 수 있다.\n');
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body onLoad="resize()" onResize="resize()">
|
||||
|
||||
<h2>온라인 AWK 인터프리터</h2>
|
||||
|
||||
<table cellspacing=3>
|
||||
<tr>
|
||||
<td valign=top>
|
||||
<script src='AseAwkApplet.js'></script>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<p>
|
||||
이 애플릿은 <a href='http://kldp.net/projects/ase/'>ASE</a> AWK 인터프리터의 JNI바인딩을 시험하는 프로그램이다. 지원되는 AWK언어는 표준과 약간의 차이가 있는데, 대표적으로 모든 문장은 세미콜론으로 끝을 내야 한다. 소스창에 AWK 프로그램을 입력하고 <b>Run Awk</b>버튼을 누르면 된다. 예제프로그램을 올리고 싶으면 <a href='#' onClick='load_sample1()'>여기</a>를 눌러라.
|
||||
</p>
|
||||
<p>
|
||||
<b>주의</b>: 이 애플릿은 자기서명인증서로 서명이 되었다. 애플릿 실행을 허가하면 사용자의 홈 디렉토리로 JNI파일을 다운로드 한다. 현재는 Linux(i386)와 Microsoft Windows(x86)만 지원을 한다. 불필요한 파일들을 청소하고 싶다면, 다운로드된 JNI파일도 삭제하기 바란다.
|
||||
</p>
|
||||
<p>
|
||||
Copyright (c) 2006-2007, Hyung-Hwan Chung. All rights reserved.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
85
ase/cmd/awk/AseAwkApplet.html
Normal file
85
ase/cmd/awk/AseAwkApplet.html
Normal file
@ -0,0 +1,85 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv=content-type content="text/html; charset=UTF-8">
|
||||
<title>Online AWK Interpreter</title>
|
||||
<style>
|
||||
body { font-family: tahoma, arial, sans-serif; }
|
||||
p { font-size: 13px; }
|
||||
h2 { font-size: 24px; font-style: italic; }
|
||||
</style>
|
||||
|
||||
<script language='javascript'>
|
||||
|
||||
function resize()
|
||||
{
|
||||
var width, height;
|
||||
|
||||
if (navigator.appName.indexOf("Microsoft") == -1)
|
||||
{
|
||||
width = window.innerWidth;
|
||||
height = window.innerHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
width = document.body.clientWidth;
|
||||
height = document.body.clientHeight;
|
||||
}
|
||||
|
||||
document.AseAwkApplet.width = width - 250;
|
||||
document.AseAwkApplet.height = height - 80;
|
||||
window.scroll (0, 0);
|
||||
}
|
||||
|
||||
function load_sample1()
|
||||
{
|
||||
document.AseAwkApplet.clear ();
|
||||
|
||||
document.AseAwkApplet.setSourceInput (
|
||||
'# wordfreq.awk --- print list of word frequencies\n' +
|
||||
'{\n' +
|
||||
' $0 = tolower($0); # remove case distinctions\n' +
|
||||
'\n' +
|
||||
' # remove punctuation\n' +
|
||||
' gsub(/[^[:alnum:]_[:blank:]]/, " ");\n' +
|
||||
'\n' +
|
||||
' for (i = 1; i <= NF; i++) freq[$i]++;\n' +
|
||||
'}\n' +
|
||||
'\n' +
|
||||
'END {\n' +
|
||||
' for (word in freq)\n' +
|
||||
' print word, freq[word];\n' +
|
||||
'}\n');
|
||||
|
||||
document.AseAwkApplet.setConsoleInput (
|
||||
'ASE aims to produce a script engine framework to ease the burden of creating a proprietary scripting language.\n' +
|
||||
'It allows a hosting application to access various aspects of the embedded script engine and vice versa.');
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body onLoad="resize()" onResize="resize()">
|
||||
|
||||
<h2>Online AWK Interpreter</h2>
|
||||
|
||||
<table cellspacing=3>
|
||||
<tr>
|
||||
<td valign=top>
|
||||
<script src='AseAwkApplet.js'></script>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<p>
|
||||
This applet is a test program for JNI binding to the <a href='http://kldp.net/projects/ase/'>ASE</a> AWK interpreter. The AWK language supported is slightly different from the standard in that all statements must end with a semicolon. You may enter a valid AWK program into the source input window and click on the <b>Run Awk</b> button. You can enter arbitrary text into the console input window if the AWK program entered contains an action-pattern block. You may click <a href='#' onClick='load_sample1(); return true;'>here</a> to load a sample program instead.
|
||||
</p>
|
||||
<p>
|
||||
<b>Note</b>: This java applet has been signed with a self-signed certificate. If you allow the applet to run, it will download a JNI file into your home directory. Currently, it supports Linux(i386) and Microsoft Windows(x86). If you decide to clean your system later, don't forget to delete the local JNI file downloaded.
|
||||
</p>
|
||||
<p>
|
||||
Copyright (c) 2006-2007, Hyung-Hwan Chung. All rights reserved.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
38
ase/cmd/awk/AseAwkApplet.java
Normal file
38
ase/cmd/awk/AseAwkApplet.java
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* $Id: AseAwkApplet.java,v 1.1 2007/04/30 08:32:41 bacon Exp $
|
||||
*/
|
||||
|
||||
import java.applet.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
public class AseAwkApplet extends Applet
|
||||
{
|
||||
AseAwkPanel awkPanel;
|
||||
|
||||
public void init ()
|
||||
{
|
||||
awkPanel = new AseAwkPanel ();
|
||||
|
||||
setLayout (new BorderLayout ());
|
||||
add (awkPanel, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
public void stop () {}
|
||||
public void paint (Graphics g) {}
|
||||
|
||||
public void setConsoleInput (String str)
|
||||
{
|
||||
awkPanel.setConsoleInput (str);
|
||||
}
|
||||
|
||||
public void setSourceInput (String str)
|
||||
{
|
||||
awkPanel.setSourceInput (str);
|
||||
}
|
||||
|
||||
public void clear ()
|
||||
{
|
||||
awkPanel.clear ();
|
||||
}
|
||||
}
|
5
ase/cmd/awk/AseAwkApplet.js
Normal file
5
ase/cmd/awk/AseAwkApplet.js
Normal file
@ -0,0 +1,5 @@
|
||||
<!--
|
||||
document.write ('<applet name="AseAwkApplet" code="AseAwkApplet" archive="bin/aseawk.jar" codebase="." width="700" height="550">');
|
||||
document.write ('</applet>');
|
||||
-->
|
||||
|
976
ase/cmd/awk/AseAwkPanel.java
Normal file
976
ase/cmd/awk/AseAwkPanel.java
Normal file
@ -0,0 +1,976 @@
|
||||
/*
|
||||
* $Id: AseAwkPanel.java,v 1.32 2007/11/12 07:21:52 bacon Exp $
|
||||
*/
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.dnd.*;
|
||||
import java.awt.datatransfer.*;
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
import java.io.InputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
|
||||
import ase.awk.StdAwk;
|
||||
import ase.awk.Console;
|
||||
import ase.awk.Context;
|
||||
import ase.awk.Argument;
|
||||
import ase.awk.Return;
|
||||
|
||||
public class AseAwkPanel extends Panel implements DropTargetListener
|
||||
{
|
||||
/* MsgBox taken from http://www.rgagnon.com/javadetails/java-0242.html */
|
||||
|
||||
class MsgBox extends Dialog implements ActionListener
|
||||
{
|
||||
boolean id = false;
|
||||
Button ok,can;
|
||||
|
||||
MsgBox (Frame frame, String msg, boolean okcan)
|
||||
{
|
||||
super (frame, "Message", true);
|
||||
setLayout(new BorderLayout());
|
||||
add("Center",new Label(msg));
|
||||
addOKCancelPanel(okcan);
|
||||
createFrame();
|
||||
pack();
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
void addOKCancelPanel( boolean okcan )
|
||||
{
|
||||
Panel p = new Panel();
|
||||
p.setLayout(new FlowLayout());
|
||||
createOKButton( p );
|
||||
if (okcan == true) createCancelButton( p );
|
||||
add("South",p);
|
||||
}
|
||||
|
||||
void createOKButton(Panel p)
|
||||
{
|
||||
p.add(ok = new Button("OK"));
|
||||
ok.addActionListener(this);
|
||||
}
|
||||
|
||||
void createCancelButton(Panel p)
|
||||
{
|
||||
p.add(can = new Button("Cancel"));
|
||||
can.addActionListener(this);
|
||||
}
|
||||
|
||||
void createFrame()
|
||||
{
|
||||
Dimension d = getToolkit().getScreenSize();
|
||||
setLocation(d.width/3,d.height/3);
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent ae)
|
||||
{
|
||||
if(ae.getSource() == ok)
|
||||
{
|
||||
id = true;
|
||||
setVisible(false);
|
||||
}
|
||||
else if(ae.getSource() == can)
|
||||
{
|
||||
setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Awk extends StdAwk
|
||||
{
|
||||
private AseAwkPanel awkPanel;
|
||||
|
||||
private StringReader srcIn;
|
||||
private StringWriter srcOut;
|
||||
|
||||
public Awk (AseAwkPanel awkPanel) throws Exception
|
||||
{
|
||||
super ();
|
||||
this.awkPanel = awkPanel;
|
||||
|
||||
addFunction ("sleep", 1, 1);
|
||||
|
||||
/*
|
||||
setWord ("sin", "cain");
|
||||
setWord ("length", "len");
|
||||
setWord ("OFMT", "ofmt");
|
||||
setWord ("END", "end");
|
||||
setWord ("sleep", "cleep");
|
||||
setWord ("end", "END");
|
||||
*/
|
||||
}
|
||||
|
||||
public void sleep (Context ctx, String name, Return ret, Argument[] args) throws ase.awk.Exception
|
||||
{
|
||||
Argument t = args[0];
|
||||
//if (args[0].isIndexed()) t = args[0].getIndexed(0);
|
||||
|
||||
try { Thread.sleep (t.getIntValue() * 1000); }
|
||||
catch (InterruptedException e) {}
|
||||
|
||||
ret.setIntValue (0);
|
||||
/*
|
||||
ret.setIndexedRealValue (1, 111.23);
|
||||
ret.setIndexedStringValue (2, "1111111");
|
||||
ret.setIndexedStringValue (3, "22222222");
|
||||
ret.setIndexedIntValue (4, 444);
|
||||
ret.setIndexedIntValue (5, 55555);
|
||||
|
||||
Return r = new Return (ctx);
|
||||
r.setStringValue ("[[%.6f]]");
|
||||
Return r2 = new Return (ctx);
|
||||
r2.setStringValue ("[[%.6f]]");
|
||||
|
||||
//ctx.setGlobal (Context.GLOBAL_CONVFMT, ret);
|
||||
Argument g = ctx.getGlobal (Context.GLOBAL_CONVFMT);
|
||||
ctx.setGlobal (Context.GLOBAL_CONVFMT, r2);
|
||||
System.out.println (g.getStringValue());
|
||||
g = ctx.getGlobal (Context.GLOBAL_CONVFMT);
|
||||
System.out.println (g.getStringValue());
|
||||
*/
|
||||
}
|
||||
|
||||
protected int openSource (int mode)
|
||||
{
|
||||
if (mode == SOURCE_READ)
|
||||
{
|
||||
srcIn = new StringReader (awkPanel.getSourceInput());
|
||||
return 1;
|
||||
}
|
||||
else if (mode == SOURCE_WRITE)
|
||||
{
|
||||
srcOut = new StringWriter ();
|
||||
return 1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected int closeSource (int mode)
|
||||
{
|
||||
if (mode == SOURCE_READ)
|
||||
{
|
||||
srcIn.close ();
|
||||
return 0;
|
||||
}
|
||||
else if (mode == SOURCE_WRITE)
|
||||
{
|
||||
awkPanel.setSourceOutput (srcOut.toString());
|
||||
|
||||
try { srcOut.close (); }
|
||||
catch (IOException e) { return -1; }
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected int readSource (char[] buf, int len)
|
||||
{
|
||||
try
|
||||
{
|
||||
int n = srcIn.read (buf, 0, len);
|
||||
if (n == -1) n = 0;
|
||||
return n;
|
||||
}
|
||||
catch (IOException e) { return -1; }
|
||||
}
|
||||
|
||||
protected int writeSource (char[] buf, int len)
|
||||
{
|
||||
srcOut.write (buf, 0, len);
|
||||
return len;
|
||||
}
|
||||
|
||||
protected int openConsole (Console con)
|
||||
{
|
||||
int mode = con.getMode ();
|
||||
|
||||
if (mode == Console.MODE_READ)
|
||||
{
|
||||
con.setHandle (new StringReader (awkPanel.getConsoleInput()));
|
||||
return 1;
|
||||
}
|
||||
else if (mode == Console.MODE_WRITE)
|
||||
{
|
||||
con.setHandle (new StringWriter ());
|
||||
return 1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
protected int closeConsole (Console con)
|
||||
{
|
||||
int mode = con.getMode ();
|
||||
|
||||
if (mode == Console.MODE_READ)
|
||||
{
|
||||
Reader rd = (Reader)con.getHandle();
|
||||
try { rd.close (); }
|
||||
catch (IOException e) { return -1; }
|
||||
return 0;
|
||||
}
|
||||
else if (mode == Console.MODE_WRITE)
|
||||
{
|
||||
Writer wr = (Writer)con.getHandle();
|
||||
awkPanel.setConsoleOutput (wr.toString());
|
||||
try { wr.close (); }
|
||||
catch (IOException e) { return -1; }
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected int readConsole (Console con, char[] buf, int len)
|
||||
{
|
||||
int mode = con.getMode ();
|
||||
|
||||
if (mode == Console.MODE_READ)
|
||||
{
|
||||
Reader rd = (Reader)con.getHandle();
|
||||
|
||||
try
|
||||
{
|
||||
int n = rd.read (buf, 0, len);
|
||||
if (n == -1) n = 0;
|
||||
return n;
|
||||
}
|
||||
catch (IOException e) { return -1; }
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected int writeConsole (Console con, char[] buf, int len)
|
||||
{
|
||||
int mode = con.getMode ();
|
||||
|
||||
if (mode == Console.MODE_WRITE)
|
||||
{
|
||||
Writer wr = (Writer)con.getHandle();
|
||||
try { wr.write (buf, 0, len); }
|
||||
catch (IOException e) { return -1; }
|
||||
return len;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected int flushConsole (Console con)
|
||||
{
|
||||
int mode = con.getMode ();
|
||||
|
||||
if (mode == Console.MODE_WRITE)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected int nextConsole (Console con)
|
||||
{
|
||||
int mode = con.getMode ();
|
||||
|
||||
if (mode == Console.MODE_READ)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (mode == Console.MODE_WRITE)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
private TextArea srcIn;
|
||||
private TextArea srcOut;
|
||||
private TextArea conIn;
|
||||
private TextArea conOut;
|
||||
private TextField entryPoint;
|
||||
private TextField jniLib;
|
||||
private Label statusLabel;
|
||||
|
||||
private DropTarget srcInDropTarget;
|
||||
private DropTarget conInDropTarget;
|
||||
|
||||
private boolean jniLibLoaded = false;
|
||||
|
||||
private class Option
|
||||
{
|
||||
private String name;
|
||||
private int value;
|
||||
private boolean state;
|
||||
|
||||
public Option (String name, int value, boolean state)
|
||||
{
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public int getValue()
|
||||
{
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public boolean getState()
|
||||
{
|
||||
return this.state;
|
||||
}
|
||||
|
||||
public void setState (boolean state)
|
||||
{
|
||||
this.state = state;
|
||||
}
|
||||
}
|
||||
|
||||
protected Option[] options = new Option[]
|
||||
{
|
||||
new Option("IMPLICIT", StdAwk.OPTION_IMPLICIT, true),
|
||||
new Option("EXPLICIT", StdAwk.OPTION_EXPLICIT, false),
|
||||
new Option("SHIFT", StdAwk.OPTION_SHIFT, false),
|
||||
new Option("IDIV", StdAwk.OPTION_IDIV, false),
|
||||
new Option("STRCONCAT", StdAwk.OPTION_STRCONCAT, false),
|
||||
new Option("EXTIO", StdAwk.OPTION_EXTIO, true),
|
||||
new Option("BLOCKLESS", StdAwk.OPTION_BLOCKLESS, true),
|
||||
new Option("BASEONE", StdAwk.OPTION_BASEONE, true),
|
||||
new Option("STRIPSPACES", StdAwk.OPTION_STRIPSPACES, false),
|
||||
new Option("NEXTOFILE", StdAwk.OPTION_NEXTOFILE, false),
|
||||
//new Option("CRLF", StdAwk.OPTION_CRLF, false),
|
||||
new Option("ARGSTOMAIN", StdAwk.OPTION_ARGSTOMAIN, false),
|
||||
new Option("RESET", StdAwk.OPTION_RESET, false),
|
||||
new Option("MAPTOVAR", StdAwk.OPTION_MAPTOVAR, false),
|
||||
new Option("PABLOCK", StdAwk.OPTION_PABLOCK, true)
|
||||
};
|
||||
|
||||
public AseAwkPanel ()
|
||||
{
|
||||
prepareUserInterface ();
|
||||
prepareNativeInterface ();
|
||||
}
|
||||
|
||||
private void prepareUserInterface ()
|
||||
{
|
||||
jniLib = new TextField ();
|
||||
|
||||
String osname = System.getProperty ("os.name").toLowerCase();
|
||||
int fontSize = (osname.startsWith("windows"))? 14: 12;
|
||||
|
||||
Font font = new Font ("Monospaced", Font.PLAIN, fontSize);
|
||||
|
||||
srcIn = new TextArea ();
|
||||
srcOut = new TextArea ();
|
||||
conIn = new TextArea ();
|
||||
conOut = new TextArea ();
|
||||
|
||||
srcIn.setFont (font);
|
||||
srcOut.setFont (font);
|
||||
conIn.setFont (font);
|
||||
conOut.setFont (font);
|
||||
|
||||
Panel srcInPanel = new Panel();
|
||||
srcInPanel.setLayout (new BorderLayout());
|
||||
srcInPanel.add (new Label("Source Input"), BorderLayout.NORTH);
|
||||
srcInPanel.add (srcIn, BorderLayout.CENTER);
|
||||
|
||||
Panel srcOutPanel = new Panel();
|
||||
srcOutPanel.setLayout (new BorderLayout());
|
||||
srcOutPanel.add (new Label("Source Output"), BorderLayout.NORTH);
|
||||
srcOutPanel.add (srcOut, BorderLayout.CENTER);
|
||||
|
||||
Panel conInPanel = new Panel();
|
||||
conInPanel.setLayout (new BorderLayout());
|
||||
conInPanel.add (new Label("Console Input"), BorderLayout.NORTH);
|
||||
conInPanel.add (conIn, BorderLayout.CENTER);
|
||||
|
||||
Panel conOutPanel = new Panel();
|
||||
conOutPanel.setLayout (new BorderLayout());
|
||||
conOutPanel.add (new Label("Console Output"), BorderLayout.NORTH);
|
||||
conOutPanel.add (conOut, BorderLayout.CENTER);
|
||||
|
||||
Button runBtn = new Button ("Run Awk");
|
||||
|
||||
runBtn.addActionListener (new ActionListener ()
|
||||
{
|
||||
public void actionPerformed (ActionEvent e)
|
||||
{
|
||||
runAwk ();
|
||||
}
|
||||
});
|
||||
|
||||
entryPoint = new TextField();
|
||||
|
||||
Panel entryPanel = new Panel();
|
||||
entryPanel.setLayout (new BorderLayout());
|
||||
entryPanel.add (new Label("Main:"), BorderLayout.WEST);
|
||||
entryPanel.add (entryPoint, BorderLayout.CENTER);
|
||||
|
||||
Panel leftPanel = new Panel();
|
||||
leftPanel.setLayout (new BorderLayout());
|
||||
leftPanel.add (runBtn, BorderLayout.SOUTH);
|
||||
|
||||
Panel optPanel = new Panel();
|
||||
optPanel.setBackground (Color.YELLOW);
|
||||
optPanel.setLayout (new GridLayout(options.length, 1));
|
||||
for (int i = 0; i < options.length; i++)
|
||||
{
|
||||
Checkbox cb = new Checkbox(options[i].getName(), options[i].getState());
|
||||
|
||||
cb.addItemListener (new ItemListener ()
|
||||
{
|
||||
public void itemStateChanged (ItemEvent e)
|
||||
{
|
||||
Object x = e.getItem();
|
||||
String name;
|
||||
|
||||
if (x instanceof Checkbox)
|
||||
{
|
||||
// gcj
|
||||
name = ((Checkbox)x).getLabel();
|
||||
}
|
||||
else if (x instanceof String)
|
||||
{
|
||||
// standard jdk
|
||||
name = (String)x;
|
||||
}
|
||||
else name = x.toString();
|
||||
|
||||
for (int i = 0; i < options.length; i++)
|
||||
{
|
||||
if (options[i].getName().equals(name))
|
||||
{
|
||||
options[i].setState (e.getStateChange() == ItemEvent.SELECTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
optPanel.add (cb);
|
||||
}
|
||||
leftPanel.add (entryPanel, BorderLayout.NORTH);
|
||||
leftPanel.add (optPanel, BorderLayout.CENTER);
|
||||
|
||||
Panel topPanel = new Panel ();
|
||||
BorderLayout topPanelLayout = new BorderLayout ();
|
||||
topPanel.setLayout (topPanelLayout);
|
||||
|
||||
topPanelLayout.setHgap (2);
|
||||
topPanelLayout.setVgap (2);
|
||||
topPanel.add (new Label ("JNI Library: "), BorderLayout.WEST);
|
||||
topPanel.add (jniLib, BorderLayout.CENTER);
|
||||
|
||||
Panel centerPanel = new Panel ();
|
||||
GridLayout centerPanelLayout = new GridLayout (2, 2);
|
||||
|
||||
centerPanel.setLayout (centerPanelLayout);
|
||||
|
||||
centerPanelLayout.setHgap (2);
|
||||
centerPanelLayout.setVgap (2);
|
||||
|
||||
centerPanel.add (srcInPanel);
|
||||
centerPanel.add (srcOutPanel);
|
||||
centerPanel.add (conInPanel);
|
||||
centerPanel.add (conOutPanel);
|
||||
|
||||
BorderLayout mainLayout = new BorderLayout ();
|
||||
mainLayout.setHgap (2);
|
||||
mainLayout.setVgap (2);
|
||||
|
||||
setLayout (mainLayout);
|
||||
statusLabel = new Label ("Ready - " + System.getProperty("user.dir"));
|
||||
statusLabel.setBackground (Color.GREEN);
|
||||
|
||||
add (topPanel, BorderLayout.NORTH);
|
||||
add (centerPanel, BorderLayout.CENTER);
|
||||
add (leftPanel, BorderLayout.WEST);
|
||||
add (statusLabel, BorderLayout.SOUTH);
|
||||
|
||||
srcInDropTarget = new DropTarget (srcIn, this);
|
||||
conInDropTarget = new DropTarget (conIn, this);
|
||||
}
|
||||
|
||||
public void prepareNativeInterface ()
|
||||
{
|
||||
String libBase = "aseawk_jni";
|
||||
|
||||
String osname = System.getProperty ("os.name").toLowerCase();
|
||||
String osarch = System.getProperty("os.arch").toLowerCase();
|
||||
String userHome = System.getProperty("user.home");
|
||||
|
||||
if (osname.startsWith("windows")) osname = "win";
|
||||
else if (osname.startsWith("linux")) osname = "linux";
|
||||
else if (osname.startsWith("mac")) osname = "mac";
|
||||
|
||||
URL url = this.getClass().getResource (
|
||||
this.getClass().getName() + ".class");
|
||||
if (url == null)
|
||||
{
|
||||
if (osname.equals("win"))
|
||||
{
|
||||
jniLib.setText(System.getProperty("user.dir") +
|
||||
"\\.\\lib\\" + System.mapLibraryName(libBase));
|
||||
}
|
||||
else
|
||||
{
|
||||
jniLib.setText(System.getProperty("user.dir") +
|
||||
"/../lib/.libs/" + System.mapLibraryName(libBase));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
String protocol = url.getProtocol ();
|
||||
|
||||
boolean isHttp = url.getPath().startsWith ("http://");
|
||||
File file = new File (isHttp? url.getPath():url.getFile());
|
||||
|
||||
String base = protocol.equals("jar")?
|
||||
file.getParentFile().getParentFile().getParent():
|
||||
file.getParentFile().getParent();
|
||||
|
||||
/*if (isHttp)*/ base = java.net.URLDecoder.decode (base);
|
||||
|
||||
if (isHttp) libBase = libBase + "-" + osname + "-" + osarch;
|
||||
String libName = System.mapLibraryName(libBase);
|
||||
|
||||
if (osname.equals("win"))
|
||||
{
|
||||
String jniLocal;
|
||||
if (isHttp)
|
||||
{
|
||||
base = "http://" + base.substring(6).replace('\\', '/');
|
||||
String jniUrl = base + "/lib/" + libName;
|
||||
String md5Url = jniUrl + ".md5";
|
||||
|
||||
jniLocal = userHome + "\\" + libName;
|
||||
|
||||
try
|
||||
{
|
||||
downloadNative (md5Url, jniUrl, jniLocal);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
showMessage ("Cannot download native library - " + e.getMessage());
|
||||
jniLocal = "ERROR - Not Available";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jniLocal = base + "\\lib\\" + libName;
|
||||
if (protocol.equals("jar")) jniLocal = jniLocal.substring(6);
|
||||
}
|
||||
|
||||
jniLib.setText (jniLocal);
|
||||
}
|
||||
else
|
||||
{
|
||||
String jniLocal;
|
||||
if (isHttp)
|
||||
{
|
||||
base = "http://" + base.substring(6);
|
||||
String jniUrl = base + "/lib/" + libName;
|
||||
String md5Url = jniUrl + ".md5";
|
||||
|
||||
jniLocal = userHome + "/" + libName;
|
||||
|
||||
try
|
||||
{
|
||||
downloadNative (md5Url, jniUrl, jniLocal);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
showMessage ("Cannot download native library - " + e.getMessage());
|
||||
jniLocal = "ERROR - Not Available";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jniLocal = base + "/lib/.libs/" + libName;
|
||||
if (protocol.equals("jar")) jniLocal = jniLocal.substring(5);
|
||||
}
|
||||
|
||||
jniLib.setText (jniLocal);
|
||||
}
|
||||
}
|
||||
|
||||
public String getSourceInput ()
|
||||
{
|
||||
return srcIn.getText ();
|
||||
}
|
||||
|
||||
public void setSourceOutput (String output)
|
||||
{
|
||||
srcOut.setText (output);
|
||||
}
|
||||
|
||||
public String getConsoleInput ()
|
||||
{
|
||||
return conIn.getText ();
|
||||
}
|
||||
|
||||
public void setConsoleOutput (String output)
|
||||
{
|
||||
conOut.setText (output);
|
||||
}
|
||||
|
||||
private void runAwk ()
|
||||
{
|
||||
Awk awk = null;
|
||||
|
||||
if (!jniLibLoaded)
|
||||
{
|
||||
try
|
||||
{
|
||||
System.load (jniLib.getText());
|
||||
jniLib.setEnabled (false);
|
||||
jniLibLoaded = true;
|
||||
}
|
||||
catch (UnsatisfiedLinkError e)
|
||||
{
|
||||
showMessage ("Cannot load library - " + e.getMessage());
|
||||
return;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
showMessage ("Cannot load library - " + e.getMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
srcOut.setText ("");
|
||||
conOut.setText ("");
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
awk = new Awk (this);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
showMessage ("Cannot instantiate awk - " + e.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < options.length; i++)
|
||||
{
|
||||
if (options[i].getState())
|
||||
{
|
||||
awk.setOption (awk.getOption() | options[i].getValue());
|
||||
}
|
||||
else
|
||||
{
|
||||
awk.setOption (awk.getOption() & ~options[i].getValue());
|
||||
}
|
||||
}
|
||||
|
||||
statusLabel.setText ("Parsing...");
|
||||
awk.parse ();
|
||||
|
||||
String main = entryPoint.getText().trim();
|
||||
|
||||
statusLabel.setText ("Running...");
|
||||
if (main.length() > 0) awk.run (main);
|
||||
else awk.run ();
|
||||
|
||||
statusLabel.setText ("Done...");
|
||||
}
|
||||
catch (ase.awk.Exception e)
|
||||
{
|
||||
String msg;
|
||||
int line = e.getLine();
|
||||
int code = e.getCode();
|
||||
|
||||
if (line <= 0)
|
||||
msg = "An exception occurred - [" + code + "] " + e.getMessage();
|
||||
else
|
||||
msg = "An exception occurred - [" + code + "] " + e.getMessage() + " at line " + line;
|
||||
|
||||
showMessage (msg);
|
||||
statusLabel.setText (msg);
|
||||
return;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (awk != null) awk.close ();
|
||||
}
|
||||
}
|
||||
|
||||
private void showMessage (String msg)
|
||||
{
|
||||
Frame tmp = new Frame ("");
|
||||
MsgBox message = new MsgBox (tmp, msg, false);
|
||||
requestFocus ();
|
||||
message.dispose ();
|
||||
tmp.dispose ();
|
||||
}
|
||||
|
||||
|
||||
private String getFileMD5 (String file) throws Exception
|
||||
{
|
||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
FileInputStream fis = null;
|
||||
|
||||
try
|
||||
{
|
||||
fis = new FileInputStream (file);
|
||||
|
||||
int n;
|
||||
byte[] b = new byte[1024];
|
||||
while ((n = fis.read(b)) != -1)
|
||||
{
|
||||
md.update (b, 0, n);
|
||||
}
|
||||
}
|
||||
catch (FileNotFoundException e) { return ""; }
|
||||
catch (IOException e) { throw e; }
|
||||
finally
|
||||
{
|
||||
if (fis != null)
|
||||
{
|
||||
try { fis.close (); }
|
||||
catch (IOException e) {}
|
||||
fis = null;
|
||||
}
|
||||
}
|
||||
|
||||
StringBuffer buf = new StringBuffer ();
|
||||
byte[] d = md.digest ();
|
||||
for (int i = 0; i < d.length; i++)
|
||||
{
|
||||
String x = Integer.toHexString((d[i] & 0x00FF));
|
||||
if (x.length() == 1) buf.append ('0');
|
||||
buf.append (x);
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
private void downloadNative (String md5URL, String sourceURL, String destFile) throws Exception
|
||||
{
|
||||
InputStream is = null;
|
||||
FileOutputStream fos = null;
|
||||
String sumRemote = null;
|
||||
|
||||
/* download the checksum file */
|
||||
try
|
||||
{
|
||||
URL url = new URL (md5URL);
|
||||
URLConnection conn = url.openConnection ();
|
||||
|
||||
is = url.openStream ();
|
||||
|
||||
int n, total = 0;
|
||||
byte[] b = new byte[32];
|
||||
while ((n = is.read(b, total, 32-total)) != -1)
|
||||
{
|
||||
total += n;
|
||||
if (total >= 32)
|
||||
{
|
||||
sumRemote = new String (b);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e) { throw e; }
|
||||
finally
|
||||
{
|
||||
if (is != null)
|
||||
{
|
||||
try { is.close (); }
|
||||
catch (IOException e) {}
|
||||
is = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (sumRemote != null)
|
||||
{
|
||||
/* if the checksum matches the checksum of the local file,
|
||||
* the native library file doesn't have to be downloaded */
|
||||
String sumLocal = getFileMD5 (destFile);
|
||||
if (sumRemote.equalsIgnoreCase(sumLocal)) return;
|
||||
}
|
||||
|
||||
/* download the actual file */
|
||||
try
|
||||
{
|
||||
URL url = new URL(sourceURL);
|
||||
URLConnection conn = url.openConnection();
|
||||
|
||||
is = url.openStream();
|
||||
fos = new FileOutputStream(destFile);
|
||||
|
||||
int n;
|
||||
byte[] b = new byte[1024];
|
||||
while ((n = is.read(b)) != -1)
|
||||
{
|
||||
fos.write(b, 0, n);
|
||||
}
|
||||
}
|
||||
catch (IOException e) { throw e; }
|
||||
finally
|
||||
{
|
||||
if (is != null)
|
||||
{
|
||||
try { is.close (); }
|
||||
catch (IOException e) {}
|
||||
is = null;
|
||||
}
|
||||
if (fos != null)
|
||||
{
|
||||
try { fos.close (); }
|
||||
catch (IOException e) {}
|
||||
fos = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void dragEnter(DropTargetDragEvent dtde) { }
|
||||
public void dragExit(DropTargetEvent dte) { }
|
||||
public void dragOver(DropTargetDragEvent dtde) { }
|
||||
public void dropActionChanged(DropTargetDragEvent dtde) { }
|
||||
|
||||
public void drop (DropTargetDropEvent dtde)
|
||||
{
|
||||
DropTarget dropTarget = dtde.getDropTargetContext().getDropTarget();
|
||||
|
||||
if (dropTarget != srcInDropTarget &&
|
||||
dropTarget != conInDropTarget)
|
||||
{
|
||||
dtde.rejectDrop ();
|
||||
return;
|
||||
}
|
||||
|
||||
Transferable tr = dtde.getTransferable ();
|
||||
DataFlavor[] flavors = tr.getTransferDataFlavors();
|
||||
for (int i = 0; i < flavors.length; i++)
|
||||
{
|
||||
//System.out.println("Possible flavor: " + flavors[i].getMimeType());
|
||||
|
||||
if (flavors[i].isFlavorJavaFileListType())
|
||||
{
|
||||
TextArea t = (TextArea)dropTarget.getComponent();
|
||||
t.setText ("");
|
||||
|
||||
try
|
||||
{
|
||||
dtde.acceptDrop (DnDConstants.ACTION_COPY_OR_MOVE);
|
||||
List files = (List)tr.getTransferData(flavors[i]);
|
||||
Iterator x = files.iterator ();
|
||||
while (x.hasNext())
|
||||
{
|
||||
File file = (File)x.next ();
|
||||
loadFileTo (file, t);
|
||||
}
|
||||
dtde.dropComplete (true);
|
||||
return;
|
||||
}
|
||||
catch (UnsupportedFlavorException e)
|
||||
{
|
||||
dtde.rejectDrop ();
|
||||
return;
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
dtde.rejectDrop ();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (flavors[i].isFlavorSerializedObjectType())
|
||||
{
|
||||
TextArea t = (TextArea)dropTarget.getComponent();
|
||||
try
|
||||
{
|
||||
dtde.acceptDrop (DnDConstants.ACTION_COPY_OR_MOVE);
|
||||
Object o = tr.getTransferData(flavors[i]);
|
||||
t.replaceText (o.toString(), t.getSelectionStart(), t.getSelectionEnd());
|
||||
dtde.dropComplete(true);
|
||||
return;
|
||||
}
|
||||
catch (UnsupportedFlavorException e)
|
||||
{
|
||||
dtde.rejectDrop ();
|
||||
return;
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
dtde.rejectDrop ();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dtde.rejectDrop ();
|
||||
}
|
||||
|
||||
private void loadFileTo (File file, TextArea textArea) throws IOException
|
||||
{
|
||||
FileReader fr = null;
|
||||
StringBuffer fb = new StringBuffer(textArea.getText());
|
||||
|
||||
try
|
||||
{
|
||||
fr = new FileReader (file);
|
||||
|
||||
int n;
|
||||
char[] b = new char[1024];
|
||||
while ((n = fr.read (b)) != -1) fb.append (b, 0, n);
|
||||
}
|
||||
catch (IOException e) { throw e; }
|
||||
finally
|
||||
{
|
||||
if (fr != null)
|
||||
{
|
||||
try { fr.close (); }
|
||||
catch (IOException e) {}
|
||||
fr = null;
|
||||
}
|
||||
}
|
||||
|
||||
textArea.setText (fb.toString());
|
||||
}
|
||||
|
||||
void clear ()
|
||||
{
|
||||
conIn.setText ("");
|
||||
srcIn.setText ("");
|
||||
conOut.setText ("");
|
||||
srcOut.setText ("");
|
||||
}
|
||||
|
||||
void setConsoleInput (String str)
|
||||
{
|
||||
conIn.setText (str);
|
||||
}
|
||||
|
||||
void setSourceInput (String str)
|
||||
{
|
||||
srcIn.setText (str);
|
||||
}
|
||||
|
||||
}
|
914
ase/cmd/awk/Awk.cpp
Normal file
914
ase/cmd/awk/Awk.cpp
Normal file
@ -0,0 +1,914 @@
|
||||
/*
|
||||
* $Id: Awk.cpp,v 1.48 2007/11/09 08:09:29 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <ase/awk/StdAwk.hpp>
|
||||
#include <ase/cmn/str.h>
|
||||
#include <ase/utl/stdio.h>
|
||||
#include <ase/utl/main.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && defined(_MSC_VER) && defined(_DEBUG)
|
||||
#define _CRTDBG_MAP_ALLOC
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
|
||||
#if defined(__linux) && defined(_DEBUG)
|
||||
#include <mcheck.h>
|
||||
#endif
|
||||
|
||||
static bool verbose = false;
|
||||
|
||||
class TestAwk: public ASE::StdAwk
|
||||
{
|
||||
public:
|
||||
TestAwk (): srcInName(ASE_NULL), srcOutName(ASE_NULL),
|
||||
numConInFiles(0), numConOutFiles(0)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
heap = ASE_NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
~TestAwk ()
|
||||
{
|
||||
close ();
|
||||
}
|
||||
|
||||
int open ()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
ASE_ASSERT (heap == ASE_NULL);
|
||||
heap = ::HeapCreate (0, 1000000, 1000000);
|
||||
if (heap == ASE_NULL) return -1;
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER<1400)
|
||||
int n = StdAwk::open ();
|
||||
#else
|
||||
int n = ASE::StdAwk::open ();
|
||||
#endif
|
||||
if (n == -1)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
HeapDestroy (heap);
|
||||
heap = ASE_NULL;
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
idLastSleep = addGlobal (ASE_T("LAST_SLEEP"));
|
||||
if (idLastSleep == -1) goto failure;
|
||||
|
||||
if (addFunction (ASE_T("sleep"), 1, 1,
|
||||
(FunctionHandler)&TestAwk::sleep) == -1) goto failure;
|
||||
|
||||
if (addFunction (ASE_T("sumintarray"), 1, 1,
|
||||
(FunctionHandler)&TestAwk::sumintarray) == -1) goto failure;
|
||||
|
||||
if (addFunction (ASE_T("arrayindices"), 1, 1,
|
||||
(FunctionHandler)&TestAwk::arrayindices) == -1) goto failure;
|
||||
return 0;
|
||||
|
||||
failure:
|
||||
#if defined(_MSC_VER) && (_MSC_VER<1400)
|
||||
StdAwk::close ();
|
||||
#else
|
||||
ASE::StdAwk::close ();
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
HeapDestroy (heap);
|
||||
heap = ASE_NULL;
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
void close ()
|
||||
{
|
||||
#if defined(_MSC_VER) && (_MSC_VER<1400)
|
||||
StdAwk::close ();
|
||||
#else
|
||||
ASE::StdAwk::close ();
|
||||
#endif
|
||||
|
||||
numConInFiles = 0;
|
||||
numConOutFiles = 0;
|
||||
|
||||
#ifdef _WIN32
|
||||
if (heap != ASE_NULL)
|
||||
{
|
||||
HeapDestroy (heap);
|
||||
heap = ASE_NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int sleep (Run& run, Return& ret, const Argument* args, size_t nargs,
|
||||
const char_t* name, size_t len)
|
||||
{
|
||||
if (args[0].isIndexed())
|
||||
{
|
||||
run.setError (ERR_INVAL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
long_t x = args[0].toInt();
|
||||
|
||||
/*Argument arg;
|
||||
if (run.getGlobal(idLastSleep, arg) == 0)
|
||||
ase_printf (ASE_T("GOOD: [%d]\n"), (int)arg.toInt());
|
||||
else { ase_printf (ASE_T("BAD:\n")); }
|
||||
*/
|
||||
|
||||
if (run.setGlobal (idLastSleep, x) == -1) return -1;
|
||||
|
||||
#ifdef _WIN32
|
||||
::Sleep ((DWORD)(x * 1000));
|
||||
return ret.set ((long_t)0);
|
||||
#else
|
||||
return ret.set ((long_t)::sleep (x));
|
||||
#endif
|
||||
}
|
||||
|
||||
int sumintarray (Run& run, Return& ret, const Argument* args, size_t nargs,
|
||||
const char_t* name, size_t len)
|
||||
{
|
||||
long_t x = 0;
|
||||
|
||||
if (args[0].isIndexed())
|
||||
{
|
||||
Argument idx(run), val(run);
|
||||
|
||||
int n = args[0].getFirstIndex (idx);
|
||||
while (n > 0)
|
||||
{
|
||||
size_t len;
|
||||
const char_t* ptr = idx.toStr(&len);
|
||||
|
||||
if (args[0].getIndexed(ptr, len, val) == -1) return -1;
|
||||
x += val.toInt ();
|
||||
|
||||
n = args[0].getNextIndex (idx);
|
||||
}
|
||||
if (n != 0) return -1;
|
||||
}
|
||||
else x += args[0].toInt();
|
||||
|
||||
return ret.set (x);
|
||||
}
|
||||
|
||||
int arrayindices (Run& run, Return& ret, const Argument* args, size_t nargs,
|
||||
const char_t* name, size_t len)
|
||||
{
|
||||
if (!args[0].isIndexed()) return 0;
|
||||
|
||||
Argument idx (run);
|
||||
long_t i;
|
||||
|
||||
int n = args[0].getFirstIndex (idx);
|
||||
for (i = 0; n > 0; i++)
|
||||
{
|
||||
size_t len;
|
||||
const char_t* ptr = idx.toStr(&len);
|
||||
n = args[0].getNextIndex (idx);
|
||||
if (ret.setIndexed (i, ptr, len) == -1) return -1;
|
||||
}
|
||||
if (n != 0) return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int addConsoleInput (const char_t* file)
|
||||
{
|
||||
if (numConInFiles < ASE_COUNTOF(conInFile))
|
||||
{
|
||||
conInFile[numConInFiles++] = file;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int addConsoleOutput (const char_t* file)
|
||||
{
|
||||
if (numConOutFiles < ASE_COUNTOF(conOutFile))
|
||||
{
|
||||
conOutFile[numConOutFiles++] = file;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int parse (const char_t* in, const char_t* out)
|
||||
{
|
||||
srcInName = in;
|
||||
srcOutName = out;
|
||||
#if defined(_MSC_VER) && (_MSC_VER<1400)
|
||||
return StdAwk::parse ();
|
||||
#else
|
||||
return ASE::StdAwk::parse ();
|
||||
#endif
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
void onRunStart (Run& run)
|
||||
{
|
||||
if (verbose) ase_printf (ASE_T("*** awk run started ***\n"));
|
||||
}
|
||||
|
||||
void onRunEnd (Run& run)
|
||||
{
|
||||
ErrorCode err = run.getErrorCode();
|
||||
|
||||
if (err != ERR_NOERR)
|
||||
{
|
||||
ase_fprintf (stderr, ASE_T("cannot run: LINE[%d] %s\n"),
|
||||
run.getErrorLine(), run.getErrorMessage());
|
||||
}
|
||||
|
||||
if (verbose) ase_printf (ASE_T("*** awk run ended ***\n"));
|
||||
}
|
||||
|
||||
void onRunReturn (Run& run, const Argument& ret)
|
||||
{
|
||||
if (verbose)
|
||||
{
|
||||
size_t len;
|
||||
const char_t* ptr = ret.toStr (&len);
|
||||
ase_printf (ASE_T("*** return [%.*s] ***\n"), (int)len, ptr);
|
||||
}
|
||||
}
|
||||
|
||||
int openSource (Source& io)
|
||||
{
|
||||
Source::Mode mode = io.getMode();
|
||||
FILE* fp = ASE_NULL;
|
||||
|
||||
if (mode == Source::READ)
|
||||
{
|
||||
if (srcInName == ASE_NULL)
|
||||
{
|
||||
io.setHandle (stdin);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (srcInName[0] == ASE_T('\0')) fp = stdin;
|
||||
else fp = ase_fopen (srcInName, ASE_T("r"));
|
||||
}
|
||||
else if (mode == Source::WRITE)
|
||||
{
|
||||
if (srcOutName == ASE_NULL)
|
||||
{
|
||||
io.setHandle (stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (srcOutName[0] == ASE_T('\0')) fp = stdout;
|
||||
else fp = ase_fopen (srcOutName, ASE_T("w"));
|
||||
}
|
||||
|
||||
if (fp == ASE_NULL) return -1;
|
||||
io.setHandle (fp);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int closeSource (Source& io)
|
||||
{
|
||||
Source::Mode mode = io.getMode();
|
||||
FILE* fp = (FILE*)io.getHandle();
|
||||
if (fp == stdout || fp == stderr) fflush (fp);
|
||||
if (fp != stdin && fp != stdout && fp != stderr) fclose (fp);
|
||||
io.setHandle (ASE_NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ssize_t readSource (Source& io, char_t* buf, size_t len)
|
||||
{
|
||||
FILE* fp = (FILE*)io.getHandle();
|
||||
ssize_t n = 0;
|
||||
|
||||
while (n < (ssize_t)len)
|
||||
{
|
||||
ase_cint_t c = ase_fgetc (fp);
|
||||
if (c == ASE_CHAR_EOF)
|
||||
{
|
||||
if (ase_ferror(fp)) n = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
buf[n++] = c;
|
||||
if (c == ASE_T('\n')) break;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
ssize_t writeSource (Source& io, char_t* buf, size_t len)
|
||||
{
|
||||
FILE* fp = (FILE*)io.getHandle();
|
||||
size_t left = len;
|
||||
|
||||
while (left > 0)
|
||||
{
|
||||
if (*buf == ASE_T('\0'))
|
||||
{
|
||||
if (ase_fputc (*buf, fp) == ASE_CHAR_EOF) return -1;
|
||||
left -= 1; buf += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
int chunk = (left > ASE_TYPE_MAX(int))? ASE_TYPE_MAX(int): (int)left;
|
||||
int n = ase_fprintf (fp, ASE_T("%.*s"), chunk, buf);
|
||||
if (n < 0 || n > chunk) return -1;
|
||||
left -= n; buf += n;
|
||||
}
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
// console io handlers
|
||||
int openConsole (Console& io)
|
||||
{
|
||||
#if defined(_MSC_VER) && (_MSC_VER<1400)
|
||||
StdAwk::Console::Mode mode = io.getMode();
|
||||
#else
|
||||
ASE::StdAwk::Console::Mode mode = io.getMode();
|
||||
#endif
|
||||
FILE* fp = ASE_NULL;
|
||||
const char_t* fn = ASE_NULL;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
#if defined(_MSC_VER) && (_MSC_VER<1400)
|
||||
case StdAwk::Console::READ:
|
||||
#else
|
||||
case ASE::StdAwk::Console::READ:
|
||||
#endif
|
||||
if (numConInFiles == 0) fp = stdin;
|
||||
else
|
||||
{
|
||||
fn = conInFile[0];
|
||||
fp = ase_fopen (fn, ASE_T("r"));
|
||||
}
|
||||
break;
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER<1400)
|
||||
case StdAwk::Console::WRITE:
|
||||
#else
|
||||
case ASE::StdAwk::Console::WRITE:
|
||||
#endif
|
||||
if (numConOutFiles == 0) fp = stdout;
|
||||
else
|
||||
{
|
||||
fn = conOutFile[0];
|
||||
fp = ase_fopen (fn, ASE_T("w"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (fp == NULL) return -1;
|
||||
|
||||
ConTrack* t = (ConTrack*)
|
||||
ase_awk_malloc (awk, ASE_SIZEOF(ConTrack));
|
||||
if (t == ASE_NULL)
|
||||
{
|
||||
if (fp != stdin && fp != stdout) fclose (fp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
t->handle = fp;
|
||||
t->nextConIdx = 1;
|
||||
|
||||
if (fn != ASE_NULL)
|
||||
{
|
||||
if (io.setFileName(fn) == -1)
|
||||
{
|
||||
if (fp != stdin && fp != stdout) fclose (fp);
|
||||
ase_awk_free (awk, t);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
io.setHandle (t);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int closeConsole (Console& io)
|
||||
{
|
||||
ConTrack* t = (ConTrack*)io.getHandle();
|
||||
FILE* fp = t->handle;
|
||||
|
||||
if (fp == stdout || fp == stderr) fflush (fp);
|
||||
if (fp != stdin && fp != stdout && fp != stderr) fclose (fp);
|
||||
|
||||
ase_awk_free (awk, t);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ssize_t readConsole (Console& io, char_t* buf, size_t len)
|
||||
{
|
||||
ConTrack* t = (ConTrack*)io.getHandle();
|
||||
FILE* fp = t->handle;
|
||||
ssize_t n = 0;
|
||||
|
||||
while (n < (ssize_t)len)
|
||||
{
|
||||
ase_cint_t c = ase_fgetc (fp);
|
||||
if (c == ASE_CHAR_EOF)
|
||||
{
|
||||
if (ase_ferror(fp)) return -1;
|
||||
if (t->nextConIdx >= numConInFiles) break;
|
||||
|
||||
const char_t* fn = conInFile[t->nextConIdx];
|
||||
FILE* nfp = ase_fopen (fn, ASE_T("r"));
|
||||
if (nfp == ASE_NULL) return -1;
|
||||
|
||||
if (io.setFileName(fn) == -1 || io.setFNR(0) == -1)
|
||||
{
|
||||
fclose (nfp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
fclose (fp);
|
||||
fp = nfp;
|
||||
t->nextConIdx++;
|
||||
t->handle = fp;
|
||||
|
||||
if (n == 0) continue;
|
||||
else break;
|
||||
}
|
||||
|
||||
buf[n++] = c;
|
||||
if (c == ASE_T('\n')) break;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
ssize_t writeConsole (Console& io, char_t* buf, size_t len)
|
||||
{
|
||||
ConTrack* t = (ConTrack*)io.getHandle();
|
||||
FILE* fp = t->handle;
|
||||
size_t left = len;
|
||||
|
||||
while (left > 0)
|
||||
{
|
||||
if (*buf == ASE_T('\0'))
|
||||
{
|
||||
if (ase_fputc (*buf, fp) == ASE_CHAR_EOF) return -1;
|
||||
left -= 1; buf += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
int chunk = (left > ASE_TYPE_MAX(int))? ASE_TYPE_MAX(int): (int)left;
|
||||
int n = ase_fprintf (fp, ASE_T("%.*s"), chunk, buf);
|
||||
if (n < 0 || n > chunk) return -1;
|
||||
left -= n; buf += n;
|
||||
}
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
int flushConsole (Console& io)
|
||||
{
|
||||
ConTrack* t = (ConTrack*)io.getHandle();
|
||||
FILE* fp = t->handle;
|
||||
return ::fflush (fp);
|
||||
}
|
||||
|
||||
int nextConsole (Console& io)
|
||||
{
|
||||
#if defined(_MSC_VER) && (_MSC_VER<1400)
|
||||
StdAwk::Console::Mode mode = io.getMode();
|
||||
#else
|
||||
ASE::StdAwk::Console::Mode mode = io.getMode();
|
||||
#endif
|
||||
ConTrack* t = (ConTrack*)io.getHandle();
|
||||
FILE* ofp = t->handle;
|
||||
FILE* nfp = ASE_NULL;
|
||||
const char_t* fn = ASE_NULL;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
#if defined(_MSC_VER) && (_MSC_VER<1400)
|
||||
case StdAwk::Console::READ:
|
||||
#else
|
||||
case ASE::StdAwk::Console::READ:
|
||||
#endif
|
||||
if (t->nextConIdx >= numConInFiles) return 0;
|
||||
fn = conInFile[t->nextConIdx];
|
||||
nfp = ase_fopen (fn, ASE_T("r"));
|
||||
break;
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER<1400)
|
||||
case StdAwk::Console::WRITE:
|
||||
#else
|
||||
case ASE::StdAwk::Console::WRITE:
|
||||
#endif
|
||||
if (t->nextConIdx >= numConOutFiles) return 0;
|
||||
fn = conOutFile[t->nextConIdx];
|
||||
nfp = ase_fopen (fn, ASE_T("w"));
|
||||
break;
|
||||
}
|
||||
|
||||
if (nfp == ASE_NULL) return -1;
|
||||
|
||||
if (fn != ASE_NULL)
|
||||
{
|
||||
if (io.setFileName (fn) == -1)
|
||||
{
|
||||
fclose (nfp);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
fclose (ofp);
|
||||
|
||||
t->nextConIdx++;
|
||||
t->handle = nfp;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void* allocMem (size_t n)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return ::HeapAlloc (heap, 0, n);
|
||||
#else
|
||||
return ::malloc (n);
|
||||
#endif
|
||||
}
|
||||
|
||||
void* reallocMem (void* ptr, size_t n)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (ptr == NULL)
|
||||
return ::HeapAlloc (heap, 0, n);
|
||||
else
|
||||
return ::HeapReAlloc (heap, 0, ptr, n);
|
||||
#else
|
||||
return ::realloc (ptr, n);
|
||||
#endif
|
||||
}
|
||||
|
||||
void freeMem (void* ptr)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
::HeapFree (heap, 0, ptr);
|
||||
#else
|
||||
::free (ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
const char_t* srcInName;
|
||||
const char_t* srcOutName;
|
||||
|
||||
struct ConTrack
|
||||
{
|
||||
FILE* handle;
|
||||
size_t nextConIdx;
|
||||
};
|
||||
|
||||
size_t numConInFiles;
|
||||
const char_t* conInFile[128];
|
||||
|
||||
size_t numConOutFiles;
|
||||
const char_t* conOutFile[128];
|
||||
|
||||
int idLastSleep;
|
||||
|
||||
#ifdef _WIN32
|
||||
void* heap;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifndef NDEBUG
|
||||
void ase_assert_abort (void)
|
||||
{
|
||||
abort ();
|
||||
}
|
||||
|
||||
void ase_assert_printf (const ase_char_t* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
#ifdef _WIN32
|
||||
int n;
|
||||
ase_char_t buf[1024];
|
||||
#endif
|
||||
|
||||
va_start (ap, fmt);
|
||||
#if defined(_WIN32)
|
||||
n = _vsntprintf (buf, ASE_COUNTOF(buf), fmt, ap);
|
||||
if (n < 0) buf[ASE_COUNTOF(buf)-1] = ASE_T('\0');
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER<1400)
|
||||
MessageBox (NULL, buf,
|
||||
ASE_T("Assertion Failure"), MB_OK|MB_ICONERROR);
|
||||
#else
|
||||
MessageBox (NULL, buf,
|
||||
ASE_T("\uB2DD\uAE30\uB9AC \uC870\uB610"), MB_OK|MB_ICONERROR);
|
||||
#endif
|
||||
#else
|
||||
ase_vprintf (fmt, ap);
|
||||
#endif
|
||||
va_end (ap);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void print_error (const ase_char_t* msg)
|
||||
{
|
||||
ase_printf (ASE_T("Error: %s\n"), msg);
|
||||
}
|
||||
|
||||
static struct
|
||||
{
|
||||
const ase_char_t* name;
|
||||
TestAwk::Option opt;
|
||||
} otab[] =
|
||||
{
|
||||
{ ASE_T("implicit"), TestAwk::OPT_IMPLICIT },
|
||||
{ ASE_T("explicit"), TestAwk::OPT_EXPLICIT },
|
||||
{ ASE_T("shift"), TestAwk::OPT_SHIFT },
|
||||
{ ASE_T("idiv"), TestAwk::OPT_IDIV },
|
||||
{ ASE_T("strconcat"), TestAwk::OPT_STRCONCAT },
|
||||
{ ASE_T("extio"), TestAwk::OPT_EXTIO },
|
||||
{ ASE_T("blockless"), TestAwk::OPT_BLOCKLESS },
|
||||
{ ASE_T("baseone"), TestAwk::OPT_BASEONE },
|
||||
{ ASE_T("stripspaces"), TestAwk::OPT_STRIPSPACES },
|
||||
{ ASE_T("nextofile"), TestAwk::OPT_NEXTOFILE },
|
||||
{ ASE_T("crlf"), TestAwk::OPT_CRLF },
|
||||
{ ASE_T("argstomain"), TestAwk::OPT_ARGSTOMAIN },
|
||||
{ ASE_T("reset"), TestAwk::OPT_RESET },
|
||||
{ ASE_T("maptovar"), TestAwk::OPT_MAPTOVAR },
|
||||
{ ASE_T("pablock"), TestAwk::OPT_PABLOCK }
|
||||
};
|
||||
|
||||
static void print_usage (const ase_char_t* argv0)
|
||||
{
|
||||
const ase_char_t* base;
|
||||
int j;
|
||||
|
||||
base = ase_strrchr(argv0, ASE_T('/'));
|
||||
if (base == ASE_NULL) base = ase_strrchr(argv0, ASE_T('\\'));
|
||||
if (base == ASE_NULL) base = argv0; else base++;
|
||||
|
||||
ase_printf (ASE_T("Usage: %s [-m main] [-si file]? [-so file]? [-ci file]* [-co file]* [-a arg]* [-w o:n]* \n"), base);
|
||||
ase_printf (ASE_T(" -m main Specify the main function name\n"));
|
||||
ase_printf (ASE_T(" -si file Specify the input source file\n"));
|
||||
ase_printf (ASE_T(" The source code is read from stdin when it is not specified\n"));
|
||||
ase_printf (ASE_T(" -so file Specify the output source file\n"));
|
||||
ase_printf (ASE_T(" The deparsed code is not output when is it not specified\n"));
|
||||
ase_printf (ASE_T(" -ci file Specify the input console file\n"));
|
||||
ase_printf (ASE_T(" -co file Specify the output console file\n"));
|
||||
ase_printf (ASE_T(" -a str Specify an argument\n"));
|
||||
ase_printf (ASE_T(" -w o:n Specify an old and new word pair\n"));
|
||||
ase_printf (ASE_T(" o - an original word\n"));
|
||||
ase_printf (ASE_T(" n - the new word to replace the original\n"));
|
||||
ase_printf (ASE_T(" -v Print extra messages\n"));
|
||||
|
||||
|
||||
ase_printf (ASE_T("\nYou may specify the following options to change the behavior of the interpreter.\n"));
|
||||
for (j = 0; j < ASE_COUNTOF(otab); j++)
|
||||
{
|
||||
ase_printf (ASE_T(" -%-20s -no%-20s\n"), otab[j].name, otab[j].name);
|
||||
}
|
||||
}
|
||||
|
||||
static int awk_main (int argc, ase_char_t* argv[])
|
||||
{
|
||||
TestAwk awk;
|
||||
|
||||
int mode = 0;
|
||||
const ase_char_t* mainfn = NULL;
|
||||
const ase_char_t* srcin = ASE_T("");
|
||||
const ase_char_t* srcout = NULL;
|
||||
const ase_char_t* args[256];
|
||||
ase_size_t nargs = 0;
|
||||
ase_size_t nsrcins = 0;
|
||||
ase_size_t nsrcouts = 0;
|
||||
|
||||
if (awk.open() == -1)
|
||||
{
|
||||
ase_fprintf (stderr, ASE_T("cannot open awk\n"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (int i = 1; i < argc; i++)
|
||||
{
|
||||
if (mode == 0)
|
||||
{
|
||||
if (ase_strcmp(argv[i], ASE_T("-si")) == 0) mode = 1;
|
||||
else if (ase_strcmp(argv[i], ASE_T("-so")) == 0) mode = 2;
|
||||
else if (ase_strcmp(argv[i], ASE_T("-ci")) == 0) mode = 3;
|
||||
else if (ase_strcmp(argv[i], ASE_T("-co")) == 0) mode = 4;
|
||||
else if (ase_strcmp(argv[i], ASE_T("-a")) == 0) mode = 5;
|
||||
else if (ase_strcmp(argv[i], ASE_T("-m")) == 0) mode = 6;
|
||||
else if (ase_strcmp(argv[i], ASE_T("-w")) == 0) mode = 7;
|
||||
else if (ase_strcmp(argv[i], ASE_T("-v")) == 0)
|
||||
{
|
||||
verbose = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (argv[i][0] == ASE_T('-'))
|
||||
{
|
||||
int j;
|
||||
|
||||
if (argv[i][1] == ASE_T('n') && argv[i][2] == ASE_T('o'))
|
||||
{
|
||||
for (j = 0; j < ASE_COUNTOF(otab); j++)
|
||||
{
|
||||
if (ase_strcmp(&argv[i][3], otab[j].name) == 0)
|
||||
{
|
||||
awk.setOption (awk.getOption() & ~otab[j].opt);
|
||||
goto ok_valid;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (j = 0; j < ASE_COUNTOF(otab); j++)
|
||||
{
|
||||
if (ase_strcmp(&argv[i][1], otab[j].name) == 0)
|
||||
{
|
||||
awk.setOption (awk.getOption() | otab[j].opt);
|
||||
goto ok_valid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print_usage (argv[0]);
|
||||
return -1;
|
||||
|
||||
ok_valid:
|
||||
;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (argv[i][0] == ASE_T('-'))
|
||||
{
|
||||
print_usage (argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (mode == 1) // source input
|
||||
{
|
||||
if (nsrcins != 0)
|
||||
{
|
||||
print_usage (argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
srcin = argv[i];
|
||||
nsrcins++;
|
||||
mode = 0;
|
||||
}
|
||||
else if (mode == 2) // source output
|
||||
{
|
||||
if (nsrcouts != 0)
|
||||
{
|
||||
print_usage (argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
srcout = argv[i];
|
||||
nsrcouts++;
|
||||
mode = 0;
|
||||
}
|
||||
else if (mode == 3) // console input
|
||||
{
|
||||
if (awk.addConsoleInput (argv[i]) == -1)
|
||||
{
|
||||
print_error (ASE_T("too many console inputs"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
mode = 0;
|
||||
}
|
||||
else if (mode == 4) // console output
|
||||
{
|
||||
if (awk.addConsoleOutput (argv[i]) == -1)
|
||||
{
|
||||
print_error (ASE_T("too many console outputs"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
mode = 0;
|
||||
}
|
||||
else if (mode == 5) // argument mode
|
||||
{
|
||||
if (nargs >= ASE_COUNTOF(args))
|
||||
{
|
||||
print_usage (argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
args[nargs++] = argv[i];
|
||||
mode = 0;
|
||||
}
|
||||
else if (mode == 6) // entry point
|
||||
{
|
||||
if (mainfn != NULL)
|
||||
{
|
||||
print_usage (argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
mainfn = argv[i];
|
||||
mode = 0;
|
||||
}
|
||||
else if (mode == 7) // word replacement
|
||||
{
|
||||
const ase_char_t* p;
|
||||
ase_size_t l;
|
||||
|
||||
p = ase_strchr(argv[i], ASE_T(':'));
|
||||
if (p == ASE_NULL)
|
||||
{
|
||||
print_usage (argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
l = ase_strlen (argv[i]);
|
||||
|
||||
awk.setWord (
|
||||
argv[i], p - argv[i],
|
||||
p + 1, l - (p - argv[i] + 1));
|
||||
|
||||
mode = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mode != 0)
|
||||
{
|
||||
print_usage (argv[0]);
|
||||
awk.close ();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if (awk.parse (srcin, srcout) == -1)
|
||||
{
|
||||
ase_fprintf (stderr, ASE_T("cannot parse: LINE[%d] %s\n"),
|
||||
awk.getErrorLine(), awk.getErrorMessage());
|
||||
awk.close ();
|
||||
return -1;
|
||||
}
|
||||
|
||||
awk.enableRunCallback ();
|
||||
|
||||
if (awk.run (mainfn, args, nargs) == -1)
|
||||
{
|
||||
ase_fprintf (stderr, ASE_T("cannot run: LINE[%d] %s\n"),
|
||||
awk.getErrorLine(), awk.getErrorMessage());
|
||||
awk.close ();
|
||||
return -1;
|
||||
}
|
||||
|
||||
awk.close ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" int ase_main (int argc, ase_achar_t* argv[])
|
||||
{
|
||||
int n;
|
||||
|
||||
#if defined(__linux) && defined(_DEBUG)
|
||||
mtrace ();
|
||||
#endif
|
||||
#if defined(_WIN32) && defined(_DEBUG) && defined(_MSC_VER)
|
||||
_CrtSetDbgFlag (_CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF);
|
||||
#endif
|
||||
|
||||
n = ase_runmain (argc,argv,awk_main);
|
||||
|
||||
#if defined(__linux) && defined(_DEBUG)
|
||||
muntrace ();
|
||||
#endif
|
||||
#if defined(_WIN32) && defined(_DEBUG)
|
||||
/* #if defined(_MSC_VER)
|
||||
_CrtDumpMemoryLeaks ();
|
||||
#endif */
|
||||
_tprintf (_T("Press ENTER to quit\n"));
|
||||
getchar ();
|
||||
#endif
|
||||
|
||||
return n;
|
||||
}
|
9
ase/cmd/awk/adr-001.awk
Normal file
9
ase/cmd/awk/adr-001.awk
Normal file
@ -0,0 +1,9 @@
|
||||
#!/bin/awk
|
||||
|
||||
BEGIN {
|
||||
RS = "\n\n";
|
||||
FS = "\n";
|
||||
}
|
||||
{
|
||||
print $1, $NF;
|
||||
}
|
12
ase/cmd/awk/adr-001.out
Normal file
12
ase/cmd/awk/adr-001.out
Normal file
@ -0,0 +1,12 @@
|
||||
BEGIN {
|
||||
RS = "\n\n";
|
||||
FS = "\n";
|
||||
}
|
||||
|
||||
{
|
||||
print $1,$NF;
|
||||
}
|
||||
|
||||
James Brown 012-345-678
|
||||
Richie Ren 02-3473-9192
|
||||
Toh WeeKung 9102-1203
|
15
ase/cmd/awk/adr-en.data
Normal file
15
ase/cmd/awk/adr-en.data
Normal file
@ -0,0 +1,15 @@
|
||||
James Brown
|
||||
IBM
|
||||
Somewhere over the rainbow
|
||||
012-345-678
|
||||
|
||||
Richie Ren
|
||||
Ezsystem
|
||||
Taipei Taiwan
|
||||
02-3473-9192
|
||||
|
||||
Toh WeeKung
|
||||
Topaz
|
||||
Singapore
|
||||
9102-1203
|
||||
|
34
ase/cmd/awk/arg.awk
Normal file
34
ase/cmd/awk/arg.awk
Normal file
@ -0,0 +1,34 @@
|
||||
BEGIN {
|
||||
print "ARGC=", ARGC;
|
||||
for (i in ARGV)
|
||||
{
|
||||
print "ARGV[" i "]", ARGV[i];
|
||||
}
|
||||
|
||||
print "----------------------";
|
||||
print "ARGC=", ARGC;
|
||||
split ("111 22 333 555 666 777", ARGV);
|
||||
for (i in ARGV)
|
||||
{
|
||||
print "ARGV[" i "]", ARGV[i];
|
||||
}
|
||||
|
||||
#for (i = 0
|
||||
# i < 20
|
||||
# i;;) print "[" i "]";
|
||||
#for (i = 0
|
||||
# (i < 20)
|
||||
# i;;) print "[" i "]";
|
||||
|
||||
#printf 10, 20, 30;
|
||||
if (ARGC >= 0) printf ("ARGC [%++#10.10i] is positive\n", 10);
|
||||
if (ARGC >= 0) printf ("ARGC [%++#10.10f] is positive\n", 10);
|
||||
if (ARGC >= 0) printf ("ARGC [%++#10.10E] is positive\n", 10124.1123);
|
||||
if (ARGC >= 0) printf ("ARGC [%++#10.10G] is positive\n", 10124.1123);
|
||||
if (ARGC >= 0) printf ("ARGC [%++#10.10g] is positive\n", 10124.1123);
|
||||
if (ARGC >= 0) printf ("ARGC [%++#10.10f] is positive\n", 10124.1123);
|
||||
printf ("[%d], [%f], [%s]\n", 10124.1123, 10124.1123, 10124.1123);
|
||||
printf ("[%-10c] [% 0*.*d]\n", 65, 45, 48, -1);
|
||||
|
||||
print sprintf ("abc%d %*.*d %c %s %c", 10, 20, 30, 40, "good", "good", 75.34);
|
||||
}
|
18
ase/cmd/awk/arr.awk
Normal file
18
ase/cmd/awk/arr.awk
Normal file
@ -0,0 +1,18 @@
|
||||
BEGIN {
|
||||
a[1,2,3] = 20;
|
||||
a[4,5,6] = 30;
|
||||
|
||||
for (i in a)
|
||||
{
|
||||
n = split (i, k, SUBSEP);
|
||||
for (j = 1; j < n; j++)
|
||||
{
|
||||
print k[j]
|
||||
}
|
||||
}
|
||||
|
||||
if ((1,2,3) in a)
|
||||
{
|
||||
print a[1,2,3];
|
||||
}
|
||||
}
|
261
ase/cmd/awk/aseawk++.bdsproj
Normal file
261
ase/cmd/awk/aseawk++.bdsproj
Normal file
@ -0,0 +1,261 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<BorlandProject>
|
||||
<PersonalityInfo>
|
||||
<Option>
|
||||
<Option Name="Personality">CPlusPlusBuilder.Personality</Option>
|
||||
<Option Name="ProjectType">Application</Option>
|
||||
<Option Name="Version">1.0</Option>
|
||||
<Option Name="GUID">{F0848980-053C-44B1-B7A0-4C834C1EB585}</Option>
|
||||
</Option>
|
||||
</PersonalityInfo>
|
||||
<CPlusPlusBuilder.Personality>
|
||||
<Source>
|
||||
<Source Name="MainSource">Awk.cpp</Source>
|
||||
</Source>
|
||||
<BCBPROJECT>
|
||||
<project version="10.0">
|
||||
<property category="build.config" name="active" value="0"/>
|
||||
<property category="build.config" name="count" value="1"/>
|
||||
<property category="build.config" name="excludedefaultforzero" value="0"/>
|
||||
<property category="build.config.0" name="builddir" value="Debug"/>
|
||||
<property category="build.config.0" name="key" value="Debug_Build"/>
|
||||
<property category="build.config.0" name="name" value="Debug Build"/>
|
||||
<property category="build.config.0" name="settings.win32b" value="default"/>
|
||||
<property category="build.config.0" name="type" value="Toolset"/>
|
||||
<property category="build.config.0" name="win32.win32b.builddir" value="debug"/>
|
||||
<property category="build.config.1" name="key" value="Release_Build"/>
|
||||
<property category="build.config.1" name="name" value="Release Build"/>
|
||||
<property category="build.config.1" name="settings.win32b" value="default"/>
|
||||
<property category="build.config.1" name="type" value="Toolset"/>
|
||||
<property category="build.config.1" name="win32.win32b.builddir" value="release"/>
|
||||
<property category="build.node" name="lastconfig" value="Debug_Build"/>
|
||||
<property category="build.node" name="name" value="aseawk++.exe"/>
|
||||
<property category="build.node" name="packages" value="vclx;vcl;rtl;dbrtl;vcldb;adortl;dbxcds;dbexpress;xmlrtl;vclie;inet;inetdbbde;inetdbxpress;soaprtl;dsnap;bdertl;vcldbx"/>
|
||||
<property category="build.node" name="use_packages" value="0"/>
|
||||
<property category="build.platform" name="active" value="win32"/>
|
||||
<property category="build.platform" name="win32.Debug_Build.toolset" value="win32b"/>
|
||||
<property category="build.platform" name="win32.Release_Build.toolset" value="win32b"/>
|
||||
<property category="build.platform" name="win32.default" value="win32b"/>
|
||||
<property category="build.platform" name="win32.enabled" value="1"/>
|
||||
<property category="build.platform" name="win32.win32b.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="param.filenames.merge" value="1"/>
|
||||
<property category="win32.*.win32b.tasm32" name="param.listfile.merge" value="1"/>
|
||||
<property category="win32.*.win32b.tasm32" name="param.objfile.merge" value="1"/>
|
||||
<property category="win32.*.win32b.tasm32" name="param.xreffile.merge" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.D.arg.1" value="_DEBUG"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.D.arg.merge" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.D.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.Od.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.k.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.n.arg.1" value="debug\cpp"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.n.arg.merge" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.n.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.r.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.v.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.vG.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.vi.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.y.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.dcc32" name="option.$D.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.dcc32" name="option.$O.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.dcc32" name="option.D.arg.1" value="DEBUG"/>
|
||||
<property category="win32.Debug_Build.win32b.dcc32" name="option.D.arg.merge" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.dcc32" name="option.D.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.dcc32" name="option.V.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.ilink32" name="option.L.arg.1" value="..\..\debug\lib"/>
|
||||
<property category="win32.Debug_Build.win32b.ilink32" name="option.L.arg.2" value="$(BDS)\lib\debug"/>
|
||||
<property category="win32.Debug_Build.win32b.ilink32" name="option.L.arg.merge" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.ilink32" name="option.L.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.tasm32" name="option.z.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.tasm32" name="option.zd.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.tasm32" name="option.zi.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="container.SelectedOptimizations.containerenabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="container.SelectedWarnings.containerenabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.D.arg.1" value="NDEBUG"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.D.arg.merge" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.D.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.O1.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.O2.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.Od.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.disablewarns.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.k.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.n.arg.1" value="release\cpp"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.n.arg.merge" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.n.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.r.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.vi.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.w.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.dcc32" name="option.$D.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.dcc32" name="option.$O.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.dcc32" name="option.V.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.ilink32" name="container.SelectedWarnings.containerenabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.ilink32" name="option.L.arg.1" value="..\..\release\lib"/>
|
||||
<property category="win32.Release_Build.win32b.ilink32" name="option.L.arg.2" value="$(BDS)\lib\release"/>
|
||||
<property category="win32.Release_Build.win32b.ilink32" name="option.L.arg.merge" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.ilink32" name="option.L.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.ilink32" name="option.outputdir.arg.1" value="..\..\release\bin"/>
|
||||
<property category="win32.Release_Build.win32b.ilink32" name="option.outputdir.arg.merge" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.ilink32" name="option.outputdir.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.tasm32" name="option.z.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.tasm32" name="option.zd.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.tasm32" name="option.zi.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.tasm32" name="option.zn.enabled" value="1"/>
|
||||
<optionset name="all_configurations">
|
||||
<property category="node" name="displayname" value="All Configurations"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.H=.arg.1" value="$(BDS)\lib\vcl100.csm"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.H=.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.H=.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.Hc.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.1" value="..\..\.."/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.2" value="$(BDS)\include"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.3" value="$(BDS)\include\dinkumware"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.4" value="$(BDS)\include\vcl"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.Ve.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.additional_switches.arg" value=""/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.additional_switches.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.additional_switches.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.b.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.sysdefines.arg.1" value="_RTLDLL"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.sysdefines.arg.2" value="NO_STRICT"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.sysdefines.arg.3" value="_NO_VCL"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.sysdefines.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.sysdefines.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.tW.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.tWC.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.tWD.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.tWM.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.I.arg.1" value="C:\projects\ase\cmd\awk"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.I.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.I.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.O.arg.1" value="C:\projects\ase\cmd\awk"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.O.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.O.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.R.arg.1" value="C:\projects\ase\cmd\awk"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.R.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.R.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.1" value="C:\projects\ase\cmd\awk"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.2" value="C:\Documents and Settings\root\My Documents\Borland Studio Projects"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.3" value="$(BDS)\lib"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.4" value="$(BDS)\lib\obj"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="param.filenames.merge" value="1"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.I.arg.1" value="C:\projects\ase\cmd\awk"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.I.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.I.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.ilink32" name="container.SelectedWarnings.containerenabled" value="1"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.-w-.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.Gi.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.Gpd.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.Gpr.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.L.arg.1" value="$(BDS)\lib"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.L.arg.2" value="$(BDS)\lib\obj"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.L.arg.3" value="$(BDS)\lib\psdk"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.L.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.L.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.Tpd.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.Tpe.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.Tpp.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.aa.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.ap.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.dynamicrtl.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.j.arg.1" value="C:\projects\ase\cmd\awk"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.j.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.j.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.m.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.map_segments.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.outputdir.arg.1" value="..\..\debug\bin"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.outputdir.arg.merge" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.outputdir.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.s.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.w.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="param.libfiles.1" value="import32.lib"/>
|
||||
<property category="win32.*.win32b.ilink32" name="param.libfiles.2" value="cw32mti.lib"/>
|
||||
<property category="win32.*.win32b.ilink32" name="param.libfiles.3" value="aseawk.lib"/>
|
||||
<property category="win32.*.win32b.ilink32" name="param.libfiles.4" value="aseawk++.lib"/>
|
||||
<property category="win32.*.win32b.ilink32" name="param.libfiles.5" value="aseutl.lib"/>
|
||||
<property category="win32.*.win32b.ilink32" name="param.libfiles.6" value="aseutl.lib"/>
|
||||
<property category="win32.*.win32b.ilink32" name="param.libfiles.7" value="asecmn.lib"/>
|
||||
<property category="win32.*.win32b.ilink32" name="param.libfiles.merge" value="1"/>
|
||||
<property category="win32.*.win32b.ilink32" name="param.objfiles.1" value="c0x32w.obj"/>
|
||||
<property category="win32.*.win32b.ilink32" name="param.objfiles.2" value="$(PACKAGES)"/>
|
||||
<property category="win32.*.win32b.ilink32" name="param.objfiles.merge" value="1"/>
|
||||
</optionset>
|
||||
</project>
|
||||
<FILELIST>
|
||||
<FILE FILENAME="Awk.cpp" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="Awk" FORMNAME="" DESIGNCLASS=""/>
|
||||
</FILELIST>
|
||||
<IDEOPTIONS>
|
||||
<VersionInfo>
|
||||
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
|
||||
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
|
||||
<VersionInfo Name="MajorVer">1</VersionInfo>
|
||||
<VersionInfo Name="MinorVer">0</VersionInfo>
|
||||
<VersionInfo Name="Release">0</VersionInfo>
|
||||
<VersionInfo Name="Build">0</VersionInfo>
|
||||
<VersionInfo Name="Debug">False</VersionInfo>
|
||||
<VersionInfo Name="PreRelease">False</VersionInfo>
|
||||
<VersionInfo Name="Special">False</VersionInfo>
|
||||
<VersionInfo Name="Private">False</VersionInfo>
|
||||
<VersionInfo Name="DLL">False</VersionInfo>
|
||||
<VersionInfo Name="Locale">1033</VersionInfo>
|
||||
<VersionInfo Name="CodePage">1252</VersionInfo>
|
||||
</VersionInfo>
|
||||
<VersionInfoKeys>
|
||||
<VersionInfoKeys Name="CompanyName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="FileDescription"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="InternalName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="ProductName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="Comments"></VersionInfoKeys>
|
||||
</VersionInfoKeys>
|
||||
<Debugging>
|
||||
<Debugging Name="DebugSourceDirs"></Debugging>
|
||||
</Debugging>
|
||||
<Parameters>
|
||||
<Parameters Name="RunParams">arg.awk ""</Parameters>
|
||||
<Parameters Name="Launcher"></Parameters>
|
||||
<Parameters Name="UseLauncher">True</Parameters>
|
||||
<Parameters Name="DebugCWD">C:\projects\ase\cmd\awk</Parameters>
|
||||
<Parameters Name="HostApplication"></Parameters>
|
||||
<Parameters Name="RemoteHost"></Parameters>
|
||||
<Parameters Name="RemotePath"></Parameters>
|
||||
<Parameters Name="RemoteParams"></Parameters>
|
||||
<Parameters Name="RemoteLauncher"></Parameters>
|
||||
<Parameters Name="UseRemoteLauncher">False</Parameters>
|
||||
<Parameters Name="RemoteCWD"></Parameters>
|
||||
<Parameters Name="RemoteDebug">False</Parameters>
|
||||
<Parameters Name="Debug Symbols Search Path"></Parameters>
|
||||
<Parameters Name="LoadAllSymbols">True</Parameters>
|
||||
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
|
||||
</Parameters>
|
||||
<Excluded_Packages>
|
||||
<Excluded_Packages Name="c:\program files\borland\bds\4.0\Bin\dclib100.bpl">Borland InterBase Express Components</Excluded_Packages>
|
||||
<Excluded_Packages Name="c:\program files\borland\bds\4.0\Bin\dclIntraweb_80_100.bpl">Intraweb 8.0 Design Package for Borland Development Studio 2006</Excluded_Packages>
|
||||
<Excluded_Packages Name="c:\program files\borland\bds\4.0\Bin\dclindy100.bpl">Internet Direct Version 9 (Indy) Property and Component Editors</Excluded_Packages>
|
||||
<Excluded_Packages Name="c:\program files\borland\bds\4.0\Bin\bcbofficexp100.bpl">Borland C++Builder Office XP Servers Package</Excluded_Packages>
|
||||
<Excluded_Packages Name="c:\program files\borland\bds\4.0\Bin\dclbcbsmp100.bpl">Borland Sample Controls Design Time Package</Excluded_Packages>
|
||||
<Excluded_Packages Name="c:\program files\borland\bds\4.0\Bin\bcbie100.bpl">Borland C++Builder Internet Explorer 5 Components Package</Excluded_Packages>
|
||||
<Excluded_Packages Name="c:\program files\borland\bds\4.0\Bin\dcltee100.bpl">TeeChart Components</Excluded_Packages>
|
||||
</Excluded_Packages>
|
||||
<Linker>
|
||||
<Linker Name="LibPrefix"></Linker>
|
||||
<Linker Name="LibSuffix"></Linker>
|
||||
<Linker Name="LibVersion"></Linker>
|
||||
</Linker>
|
||||
</IDEOPTIONS>
|
||||
</BCBPROJECT>
|
||||
<buildevents>
|
||||
<buildevent file="aseawk++.bdsproj">
|
||||
<precompile mode="0" cancancel="0" capture="-1" showconsole="0">mkdir $(PROJECTDIR)..\release\bin
|
||||
mkdir $(PROJECTDIR)..\debug\bin
|
||||
</precompile>
|
||||
</buildevent>
|
||||
</buildevents>
|
||||
</CPlusPlusBuilder.Personality>
|
||||
</BorlandProject>
|
440
ase/cmd/awk/aseawk++.vcproj
Normal file
440
ase/cmd/awk/aseawk++.vcproj
Normal file
@ -0,0 +1,440 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="aseawk++"
|
||||
ProjectGUID="{3BEA6CFE-C158-4BFB-B5FB-ED85251E3F98}"
|
||||
RootNamespace="aseawk++"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)\bin"
|
||||
IntermediateDirectory="$(ConfigurationName)\cpp"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\../../release/bin/aseawk++.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
PrecompiledHeaderFile=".\release\cpp\aseawk++.pch"
|
||||
AssemblerListingLocation=""
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="asecmn.lib aseawk.lib aseawk++.lib aseutl.lib"
|
||||
OutputFile="..\..\release\bin\aseawk++.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\release\lib"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)\bin"
|
||||
IntermediateDirectory="$(ConfigurationName)\cpp"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
TypeLibraryName=".\../../release/bin/aseawk++.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
PrecompiledHeaderFile=".\release\cpp\aseawk++.pch"
|
||||
AssemblerListingLocation=""
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="asecmn.lib aseawk.lib aseawk++.lib aseutl.lib"
|
||||
OutputFile="..\..\release\bin\aseawk++.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\release\lib"
|
||||
SubSystem="1"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)\bin"
|
||||
IntermediateDirectory="$(ConfigurationName)\cpp"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\../../debug/bin/aseawk++.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
PrecompiledHeaderFile=".\debug\cpp\aseawk++.pch"
|
||||
AssemblerListingLocation=""
|
||||
BrowseInformation="1"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="asecmn.lib aseawk.lib aseawk++.lib aseutl.lib"
|
||||
OutputFile="..\..\debug\bin\aseawk++.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\debug\lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)\bin"
|
||||
IntermediateDirectory="$(ConfigurationName)\cpp"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
TypeLibraryName=".\../../debug/bin/aseawk++.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
PrecompiledHeaderFile=".\debug\cpp\aseawk++.pch"
|
||||
AssemblerListingLocation=""
|
||||
BrowseInformation="1"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="asecmn.lib aseawk.lib aseawk++.lib aseutl.lib"
|
||||
OutputFile="..\..\debug\bin\aseawk++.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\debug\lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
>
|
||||
<File
|
||||
RelativePath="Awk.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
262
ase/cmd/awk/aseawk.bdsproj
Normal file
262
ase/cmd/awk/aseawk.bdsproj
Normal file
@ -0,0 +1,262 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<BorlandProject>
|
||||
<PersonalityInfo>
|
||||
<Option>
|
||||
<Option Name="Personality">CPlusPlusBuilder.Personality</Option>
|
||||
<Option Name="ProjectType">Application</Option>
|
||||
<Option Name="Version">1.0</Option>
|
||||
<Option Name="GUID">{F0848980-053C-44B1-B7A0-4C834C1EB585}</Option>
|
||||
</Option>
|
||||
</PersonalityInfo>
|
||||
<CPlusPlusBuilder.Personality>
|
||||
<Source>
|
||||
<Source Name="MainSource">awk.c</Source>
|
||||
</Source>
|
||||
<BCBPROJECT>
|
||||
<project version="10.0">
|
||||
<property category="build.config" name="active" value="0"/>
|
||||
<property category="build.config" name="count" value="1"/>
|
||||
<property category="build.config" name="excludedefaultforzero" value="0"/>
|
||||
<property category="build.config.0" name="builddir" value="Debug"/>
|
||||
<property category="build.config.0" name="key" value="Debug_Build"/>
|
||||
<property category="build.config.0" name="name" value="Debug Build"/>
|
||||
<property category="build.config.0" name="settings.win32b" value="default"/>
|
||||
<property category="build.config.0" name="type" value="Toolset"/>
|
||||
<property category="build.config.0" name="win32.win32b.builddir" value="debug"/>
|
||||
<property category="build.config.1" name="key" value="Release_Build"/>
|
||||
<property category="build.config.1" name="name" value="Release Build"/>
|
||||
<property category="build.config.1" name="settings.win32b" value="default"/>
|
||||
<property category="build.config.1" name="type" value="Toolset"/>
|
||||
<property category="build.config.1" name="win32.win32b.builddir" value="release"/>
|
||||
<property category="build.node" name="lastconfig" value="Debug_Build"/>
|
||||
<property category="build.node" name="name" value="aseawk.exe"/>
|
||||
<property category="build.node" name="packages" value="vclx;vcl;rtl;dbrtl;vcldb;adortl;dbxcds;dbexpress;xmlrtl;vclie;inet;inetdbbde;inetdbxpress;soaprtl;dsnap;bdertl;vcldbx"/>
|
||||
<property category="build.node" name="use_packages" value="0"/>
|
||||
<property category="build.platform" name="active" value="win32"/>
|
||||
<property category="build.platform" name="win32.Debug_Build.toolset" value="win32b"/>
|
||||
<property category="build.platform" name="win32.Release_Build.toolset" value="win32b"/>
|
||||
<property category="build.platform" name="win32.default" value="win32b"/>
|
||||
<property category="build.platform" name="win32.enabled" value="1"/>
|
||||
<property category="build.platform" name="win32.win32b.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="param.filenames.merge" value="1"/>
|
||||
<property category="win32.*.win32b.tasm32" name="param.listfile.merge" value="1"/>
|
||||
<property category="win32.*.win32b.tasm32" name="param.objfile.merge" value="1"/>
|
||||
<property category="win32.*.win32b.tasm32" name="param.xreffile.merge" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.D.arg.1" value="_DEBUG"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.D.arg.merge" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.D.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.Od.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.k.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.n.arg.1" value="debug"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.n.arg.merge" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.n.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.r.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.v.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.vG.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.vG0.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.vG2.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.vG3.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.vi.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.bcc32" name="option.y.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.dcc32" name="option.$D.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.dcc32" name="option.$O.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.dcc32" name="option.D.arg.1" value="DEBUG"/>
|
||||
<property category="win32.Debug_Build.win32b.dcc32" name="option.D.arg.merge" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.dcc32" name="option.D.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.dcc32" name="option.V.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.ilink32" name="option.L.arg.1" value="..\..\debug\lib"/>
|
||||
<property category="win32.Debug_Build.win32b.ilink32" name="option.L.arg.2" value="$(BDS)\lib\debug"/>
|
||||
<property category="win32.Debug_Build.win32b.ilink32" name="option.L.arg.merge" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.ilink32" name="option.L.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.tasm32" name="option.z.enabled" value="1"/>
|
||||
<property category="win32.Debug_Build.win32b.tasm32" name="option.zd.enabled" value="0"/>
|
||||
<property category="win32.Debug_Build.win32b.tasm32" name="option.zi.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="container.SelectedOptimizations.containerenabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="container.SelectedWarnings.containerenabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.D.arg.1" value="NDEBUG"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.D.arg.merge" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.D.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.O1.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.O2.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.Od.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.disablewarns.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.k.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.n.arg.1" value="release"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.n.arg.merge" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.n.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.r.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.vi.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.bcc32" name="option.w.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.dcc32" name="option.$D.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.dcc32" name="option.$O.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.dcc32" name="option.V.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.ilink32" name="container.SelectedWarnings.containerenabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.ilink32" name="option.L.arg.1" value="..\..\release\lib"/>
|
||||
<property category="win32.Release_Build.win32b.ilink32" name="option.L.arg.2" value="$(BDS)\lib\release"/>
|
||||
<property category="win32.Release_Build.win32b.ilink32" name="option.L.arg.merge" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.ilink32" name="option.L.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.ilink32" name="option.outputdir.arg.1" value="..\..\release\bin"/>
|
||||
<property category="win32.Release_Build.win32b.ilink32" name="option.outputdir.arg.merge" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.ilink32" name="option.outputdir.enabled" value="1"/>
|
||||
<property category="win32.Release_Build.win32b.tasm32" name="option.z.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.tasm32" name="option.zd.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.tasm32" name="option.zi.enabled" value="0"/>
|
||||
<property category="win32.Release_Build.win32b.tasm32" name="option.zn.enabled" value="1"/>
|
||||
<optionset name="all_configurations">
|
||||
<property category="node" name="displayname" value="All Configurations"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.H=.arg.1" value="$(BDS)\lib\vcl100.csm"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.H=.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.H=.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.Hc.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.1" value="..\..\.."/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.2" value="$(BDS)\include"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.3" value="$(BDS)\include\dinkumware"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.4" value="$(BDS)\include\vcl"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.I.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.Ve.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.additional_switches.arg" value=""/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.additional_switches.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.additional_switches.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.b.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.sysdefines.arg.1" value="_RTLDLL"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.sysdefines.arg.2" value="NO_STRICT"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.sysdefines.arg.3" value="_NO_VCL"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.sysdefines.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.sysdefines.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.tW.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.tWC.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.tWD.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.bcc32" name="option.tWM.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.I.arg.1" value="C:\projects\ase\test\awk"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.I.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.I.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.O.arg.1" value="C:\projects\ase\test\awk"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.O.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.O.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.R.arg.1" value="C:\projects\ase\test\awk"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.R.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.R.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.1" value="C:\projects\ase\test\awk"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.2" value="C:\Documents and Settings\root\My Documents\Borland Studio Projects"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.3" value="$(BDS)\lib"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.4" value="$(BDS)\lib\obj"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="option.U.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.dcc32" name="param.filenames.merge" value="1"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.I.arg.1" value="C:\projects\ase\test\awk"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.I.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.idl2cpp" name="option.I.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.ilink32" name="container.SelectedWarnings.containerenabled" value="1"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.-w-.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.Gi.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.Gpd.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.Gpr.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.L.arg.1" value="$(BDS)\lib"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.L.arg.2" value="$(BDS)\lib\obj"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.L.arg.3" value="$(BDS)\lib\psdk"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.L.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.L.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.Tpd.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.Tpe.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.Tpp.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.aa.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.ap.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.dynamicrtl.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.j.arg.1" value="C:\projects\ase\test\awk"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.j.arg.merge" value="1"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.j.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.m.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.map_segments.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.outputdir.arg.1" value="..\..\debug\bin"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.outputdir.arg.merge" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.outputdir.enabled" value="1"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.s.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="option.w.enabled" value="0"/>
|
||||
<property category="win32.*.win32b.ilink32" name="param.libfiles.1" value="import32.lib"/>
|
||||
<property category="win32.*.win32b.ilink32" name="param.libfiles.2" value="cw32mti.lib"/>
|
||||
<property category="win32.*.win32b.ilink32" name="param.libfiles.3" value="aseawk.lib"/>
|
||||
<property category="win32.*.win32b.ilink32" name="param.libfiles.4" value="aseutl.lib"/>
|
||||
<property category="win32.*.win32b.ilink32" name="param.libfiles.5" value="asecmn.lib"/>
|
||||
<property category="win32.*.win32b.ilink32" name="param.libfiles.merge" value="1"/>
|
||||
<property category="win32.*.win32b.ilink32" name="param.objfiles.1" value="c0x32w.obj"/>
|
||||
<property category="win32.*.win32b.ilink32" name="param.objfiles.2" value="$(PACKAGES)"/>
|
||||
<property category="win32.*.win32b.ilink32" name="param.objfiles.merge" value="1"/>
|
||||
</optionset>
|
||||
</project>
|
||||
<FILELIST>
|
||||
<FILE FILENAME="awk.c" CONTAINERID="CCompiler" LOCALCOMMAND="" UNITNAME="awk" FORMNAME="" DESIGNCLASS=""/>
|
||||
</FILELIST>
|
||||
<IDEOPTIONS>
|
||||
<VersionInfo>
|
||||
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
|
||||
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
|
||||
<VersionInfo Name="MajorVer">1</VersionInfo>
|
||||
<VersionInfo Name="MinorVer">0</VersionInfo>
|
||||
<VersionInfo Name="Release">0</VersionInfo>
|
||||
<VersionInfo Name="Build">0</VersionInfo>
|
||||
<VersionInfo Name="Debug">False</VersionInfo>
|
||||
<VersionInfo Name="PreRelease">False</VersionInfo>
|
||||
<VersionInfo Name="Special">False</VersionInfo>
|
||||
<VersionInfo Name="Private">False</VersionInfo>
|
||||
<VersionInfo Name="DLL">False</VersionInfo>
|
||||
<VersionInfo Name="Locale">1033</VersionInfo>
|
||||
<VersionInfo Name="CodePage">1252</VersionInfo>
|
||||
</VersionInfo>
|
||||
<VersionInfoKeys>
|
||||
<VersionInfoKeys Name="CompanyName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="FileDescription"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="InternalName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="ProductName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="Comments"></VersionInfoKeys>
|
||||
</VersionInfoKeys>
|
||||
<Debugging>
|
||||
<Debugging Name="DebugSourceDirs"></Debugging>
|
||||
</Debugging>
|
||||
<Parameters>
|
||||
<Parameters Name="RunParams">-f arg.awk ""</Parameters>
|
||||
<Parameters Name="Launcher"></Parameters>
|
||||
<Parameters Name="UseLauncher">True</Parameters>
|
||||
<Parameters Name="DebugCWD">C:\projects\ase\test\awk</Parameters>
|
||||
<Parameters Name="HostApplication"></Parameters>
|
||||
<Parameters Name="RemoteHost"></Parameters>
|
||||
<Parameters Name="RemotePath"></Parameters>
|
||||
<Parameters Name="RemoteParams"></Parameters>
|
||||
<Parameters Name="RemoteLauncher"></Parameters>
|
||||
<Parameters Name="UseRemoteLauncher">False</Parameters>
|
||||
<Parameters Name="RemoteCWD"></Parameters>
|
||||
<Parameters Name="RemoteDebug">False</Parameters>
|
||||
<Parameters Name="Debug Symbols Search Path"></Parameters>
|
||||
<Parameters Name="LoadAllSymbols">True</Parameters>
|
||||
<Parameters Name="LoadUnspecifiedSymbols">False</Parameters>
|
||||
</Parameters>
|
||||
<Excluded_Packages>
|
||||
<Excluded_Packages Name="c:\program files\borland\bds\4.0\Bin\dclib100.bpl">Borland InterBase Express Components</Excluded_Packages>
|
||||
<Excluded_Packages Name="c:\program files\borland\bds\4.0\Bin\dclIntraweb_80_100.bpl">Intraweb 8.0 Design Package for Borland Development Studio 2006</Excluded_Packages>
|
||||
<Excluded_Packages Name="c:\program files\borland\bds\4.0\Bin\dclindy100.bpl">Internet Direct Version 9 (Indy) Property and Component Editors</Excluded_Packages>
|
||||
<Excluded_Packages Name="c:\program files\borland\bds\4.0\Bin\bcbofficexp100.bpl">Borland C++Builder Office XP Servers Package</Excluded_Packages>
|
||||
<Excluded_Packages Name="c:\program files\borland\bds\4.0\Bin\dclbcbsmp100.bpl">Borland Sample Controls Design Time Package</Excluded_Packages>
|
||||
<Excluded_Packages Name="c:\program files\borland\bds\4.0\Bin\bcbie100.bpl">Borland C++Builder Internet Explorer 5 Components Package</Excluded_Packages>
|
||||
<Excluded_Packages Name="c:\program files\borland\bds\4.0\Bin\dcltee100.bpl">TeeChart Components</Excluded_Packages>
|
||||
</Excluded_Packages>
|
||||
<Linker>
|
||||
<Linker Name="LibPrefix"></Linker>
|
||||
<Linker Name="LibSuffix"></Linker>
|
||||
<Linker Name="LibVersion"></Linker>
|
||||
</Linker>
|
||||
</IDEOPTIONS>
|
||||
</BCBPROJECT>
|
||||
<buildevents>
|
||||
<buildevent file="aseawk.bdsproj">
|
||||
<precompile mode="0" cancancel="0" capture="-1" showconsole="0">mkdir $(PROJECTDIR)..\release\bin
|
||||
mkdir $(PROJECTDIR)..\debug\bin
|
||||
</precompile>
|
||||
</buildevent>
|
||||
</buildevents>
|
||||
</CPlusPlusBuilder.Personality>
|
||||
</BorlandProject>
|
395
ase/cmd/awk/aseawk.vcproj
Normal file
395
ase/cmd/awk/aseawk.vcproj
Normal file
@ -0,0 +1,395 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="aseawk"
|
||||
ProjectGUID="{57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F}"
|
||||
RootNamespace="aseawk"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)\bin"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\../../release/bin/aseawk.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="asecmn.lib aseawk.lib aseutl.lib"
|
||||
OutputFile="$(OutDir)\aseawk.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\release\lib"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)\bin"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
TypeLibraryName=".\../../release/bin/aseawk.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="asecmn.lib aseawk.lib aseutl.lib"
|
||||
OutputFile="$(OutDir)\aseawk.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\release\lib"
|
||||
SubSystem="1"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)\bin"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\../../debug/bin/aseawk.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
BrowseInformation="1"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="asecmn.lib aseawk.lib aseutl.lib"
|
||||
OutputFile="$(OutDir)\aseawk.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\debug\lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)\bin"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
TypeLibraryName=".\../../debug/bin/aseawk.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
BrowseInformation="1"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="asecmn.lib aseawk.lib aseutl.lib"
|
||||
OutputFile="$(OutDir)\aseawk.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="..\..\debug\lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\awk.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl"
|
||||
>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
102
ase/cmd/awk/asetestawk++.dsp
Normal file
102
ase/cmd/awk/asetestawk++.dsp
Normal file
@ -0,0 +1,102 @@
|
||||
# Microsoft Developer Studio Project File - Name="asetestawk++" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=asetestawk++ - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "asetestawk++.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "asetestawk++.mak" CFG="asetestawk++ - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "asetestawk++ - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "asetestawk++ - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "asetestawk++ - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "../../release/bin"
|
||||
# PROP Intermediate_Dir "release/cpp"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\.." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_UNICODE" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 asecmn.lib aseawk.lib aseawk++.lib aseutl.lib user32.lib kernel32.lib /nologo /subsystem:console /machine:I386 /out:"../../release/bin/aseawk++.exe" /libpath:"../../release/lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "asetestawk++ - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "../../debug/bin"
|
||||
# PROP Intermediate_Dir "debug/cpp"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /FR /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 asecmn.lib aseawk.lib aseawk++.lib aseutl.lib user32.lib kernel32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../../debug/bin/aseawk++.exe" /pdbtype:sept /libpath:"../../debug/lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "asetestawk++ - Win32 Release"
|
||||
# Name "asetestawk++ - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Awk.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
102
ase/cmd/awk/asetestawk.dsp
Normal file
102
ase/cmd/awk/asetestawk.dsp
Normal file
@ -0,0 +1,102 @@
|
||||
# Microsoft Developer Studio Project File - Name="asetestawk" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=asetestawk - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "asetestawk.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "asetestawk.mak" CFG="asetestawk - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "asetestawk - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "asetestawk - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "asetestawk - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "../../release/bin"
|
||||
# PROP Intermediate_Dir "release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\.." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_UNICODE" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 asecmn.lib aseawk.lib aseutl.lib user32.lib kernel32.lib /nologo /subsystem:console /machine:I386 /out:"../../release/bin/aseawk.exe" /libpath:"../../release/lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "asetestawk - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "../../debug/bin"
|
||||
# PROP Intermediate_Dir "debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /FR /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 asecmn.lib aseawk.lib aseutl.lib user32.lib kernel32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../../debug/bin/aseawk.exe" /pdbtype:sept /libpath:"../../debug/lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "asetestawk - Win32 Release"
|
||||
# Name "asetestawk - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\awk.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
52
ase/cmd/awk/asm.awk
Normal file
52
ase/cmd/awk/asm.awk
Normal file
@ -0,0 +1,52 @@
|
||||
#
|
||||
# $Id: asm.awk,v 1.4 2007/09/27 11:33:45 bacon Exp $
|
||||
#
|
||||
# Taken from the book "The AWK Programming Language"
|
||||
# aseawk++ -si asm.awk -a asm.s -nostripspaces -baseone
|
||||
#
|
||||
|
||||
BEGIN {
|
||||
srcfile = ARGV[1];
|
||||
ARGV[1] = "";
|
||||
tempfile = "asm.temp";
|
||||
n = split("const get put ld st add sub jpos jz j halt", x);
|
||||
for (i = 1; i <= n; i++) op[x[i]] = i - 1;
|
||||
|
||||
# PASS 1
|
||||
FS = "[ \t]+";
|
||||
while (getline <srcfile > 0) {
|
||||
sub (/#.*/, "");
|
||||
symtab[$1] = nextmem;
|
||||
|
||||
if ($2 != "") {
|
||||
print $2 "\t" $3 >tempfile;
|
||||
nextmem++;
|
||||
}
|
||||
}
|
||||
close (tempfile);
|
||||
|
||||
# PASS 2
|
||||
nextmem = 0;
|
||||
while (getline <tempfile > 0) {
|
||||
if ($2 !~ /^[0-9]*$/) $2 = symtab[$2];
|
||||
mem[nextmem++] = 1000 * op[$1] + $2;
|
||||
}
|
||||
|
||||
# INTERPRETER
|
||||
for (pc = 0; pc >= 0; ) {
|
||||
addr = mem[pc] % 1000;
|
||||
code = int(mem[pc++] / 1000);
|
||||
if (code == op["get"]) { if (getline acc <= 0) acc = 0; }
|
||||
else if (code == op["put"]) { print acc; }
|
||||
else if (code == op["st"]) { mem[addr] = acc; }
|
||||
else if (code == op["ld"]) { acc = mem[addr]; }
|
||||
else if (code == op["add"]) { acc += mem[addr]; }
|
||||
else if (code == op["sub"]) { acc -= mem[addr]; }
|
||||
else if (code == op["jpos"]) { if (acc > 0) pc = addr; }
|
||||
else if (code == op["jz"]) { if (acc == 0) pc = addr; }
|
||||
else if (code == op["j"]) { pc = addr; }
|
||||
else if (code == op["halt"]) { pc = -1; }
|
||||
else { pc = -1; }
|
||||
}
|
||||
}
|
||||
|
14
ase/cmd/awk/asm.s
Normal file
14
ase/cmd/awk/asm.s
Normal file
@ -0,0 +1,14 @@
|
||||
ld zero # initialize sum to zero
|
||||
st sum
|
||||
loop get # read a number
|
||||
jz done # no more input if number is zero
|
||||
add sum # add in accumulated sum
|
||||
st sum # store new value back in sum
|
||||
j loop # go back and read another number
|
||||
|
||||
done ld sum # print sum
|
||||
put
|
||||
halt
|
||||
|
||||
zero const 0
|
||||
sum const
|
1329
ase/cmd/awk/awk.c
Normal file
1329
ase/cmd/awk/awk.c
Normal file
File diff suppressed because it is too large
Load Diff
121
ase/cmd/awk/comp.awk
Normal file
121
ase/cmd/awk/comp.awk
Normal file
@ -0,0 +1,121 @@
|
||||
BEGIN {
|
||||
OFS="\t\t";
|
||||
|
||||
print "1==1 :", (1 == 1);
|
||||
print "1==0 :", (1 == 0);
|
||||
|
||||
print "1.0==1 :", (1.0 == 1);
|
||||
print "1.1==1 :", (1.1 == 1);
|
||||
|
||||
print "1.0!=1 :", (1.0 != 1);
|
||||
print "1.1!=1 :", (1.1 != 1);
|
||||
|
||||
print "\"abc\" == \"abc\"", ("abc" == "abc");
|
||||
print "\"abc\" != \"abc\"", ("abc" != "abc");
|
||||
|
||||
print "--------------------------";
|
||||
print "a == \"\" :", (a == "");
|
||||
print "a >= \"\" :", (a >= "");
|
||||
print "a <= \"\" :", (a <= "");
|
||||
print "a > \"\" :", (a > "");
|
||||
print "a < \"\" :", (a < "");
|
||||
|
||||
print "--------------------------";
|
||||
print "a == \" \" :", (a == " ");
|
||||
print "a >= \" \" :", (a >= " ");
|
||||
print "a <= \" \" :", (a <= " ");
|
||||
print "a > \" \" :", (a > " ");
|
||||
print "a < \" \" :", (a < " ");
|
||||
|
||||
print "--------------------------";
|
||||
print "\"\" == a :", ("" == a);
|
||||
print "\"\" >= a:", ("" >= a);
|
||||
print "\"\" <= a:", ("" <= a);
|
||||
print "\"\" > a:", ("" > a);
|
||||
print "\"\" < a:", ("" < a);
|
||||
|
||||
print "--------------------------";
|
||||
print "\" \" == a :", (" " == a);
|
||||
print "\" \" >= a:", (" " >= a);
|
||||
print "\" \" <= a:", (" " <= a);
|
||||
print "\" \" > a:", (" " > a);
|
||||
print "\" \" < a:", (" " < a);
|
||||
|
||||
print "--------------------------";
|
||||
print "10 == \"10\"", (10 == "10");
|
||||
print "10 != \"10\"", (10 != "10");
|
||||
print "10 >= \"10\"", (10 >= "10");
|
||||
print "10 <= \"10\"", (10 <= "10");
|
||||
print "10 > \"10\"", (10 > "10");
|
||||
print "10 < \"10\"", (10 < "10");
|
||||
|
||||
print "--------------------------";
|
||||
print "10 == \"11\"", (10 == "11");
|
||||
print "10 != \"11\"", (10 != "11");
|
||||
print "10 >= \"11\"", (10 >= "11");
|
||||
print "10 <= \"11\"", (10 <= "11");
|
||||
print "10 > \"11\"", (10 > "11");
|
||||
print "10 < \"11\"", (10 < "11");
|
||||
|
||||
print "--------------------------";
|
||||
print "11 == \"10\"", (11 == "10");
|
||||
print "11 != \"10\"", (11 != "10");
|
||||
print "11 >= \"10\"", (11 >= "10");
|
||||
print "11 <= \"10\"", (11 <= "10");
|
||||
print "11 > \"10\"", (11 > "10");
|
||||
print "11 < \"10\"", (11 < "10");
|
||||
|
||||
print "--------------------------";
|
||||
print "010 == \"8\"", (010 == "8");
|
||||
print "010 != \"8\"", (010 != "8");
|
||||
print "010 >= \"8\"", (010 >= "8");
|
||||
print "010 <= \"8\"", (010 <= "8");
|
||||
print "010 > \"8\"", (010 > "8");
|
||||
print "010 < \"8\"", (010 < "8");
|
||||
|
||||
print "--------------------------";
|
||||
print "10 == \"10.0\"", (10 == "10.0");
|
||||
print "10 != \"10.0\"", (10 != "10.0");
|
||||
print "10 >= \"10.0\"", (10 >= "10.0");
|
||||
print "10 <= \"10.0\"", (10 <= "10.0");
|
||||
print "10 > \"10.0\"", (10 > "10.0");
|
||||
print "10 < \"10.0\"", (10 < "10.0");
|
||||
|
||||
#OFMT="abc";
|
||||
print "--------------------------";
|
||||
print "10.0 == \"10\"", (10.0 == "10");
|
||||
print "10.0 != \"10\"", (10.0 != "10");
|
||||
print "10.0 >= \"10\"", (10.0 >= "10");
|
||||
print "10.0 <= \"10\"", (10.0 <= "10");
|
||||
print "10.0 > \"10\"", (10.0 > "10");
|
||||
print "10.0 < \"10\"", (10.0 < "10");
|
||||
|
||||
print "--------------------------";
|
||||
print "\"10\" == 10.0", ("10" == 10.0);
|
||||
print "\"10\" != 10.0", ("10" != 10.0);
|
||||
print "\"10\" >= 10.0", ("10" >= 10.0);
|
||||
print "\"10\" <= 10.0", ("10" <= 10.0);
|
||||
print "\"10\" > 10.0", ("10" > 10.0);
|
||||
print "\"10\" < 10.0", ("10" < 10.0);
|
||||
|
||||
print "--------------------------";
|
||||
print "\"10\" == 10.1", ("10" == 10.1);
|
||||
print "\"10\" != 10.1", ("10" != 10.1);
|
||||
print "\"10\" >= 10.1", ("10" >= 10.1);
|
||||
print "\"10\" <= 10.1", ("10" <= 10.1);
|
||||
print "\"10\" > 10.1", ("10" > 10.1);
|
||||
print "\"10\" < 10.1", ("10" < 10.1);
|
||||
|
||||
#a[10] = 2;
|
||||
#print a == 1;
|
||||
|
||||
print (0.234 + 1.01123);
|
||||
print 12345678901234567890E20;
|
||||
print .123;
|
||||
print +.123;
|
||||
print -.123;
|
||||
print .123E-;
|
||||
print +.123E-;
|
||||
print -.123E-;
|
||||
print -.123E- + "123";
|
||||
}
|
1
ase/cmd/awk/cou-001.awk
Normal file
1
ase/cmd/awk/cou-001.awk
Normal file
@ -0,0 +1 @@
|
||||
{ print $1, $3; } # print country name and population
|
15
ase/cmd/awk/cou-001.out
Normal file
15
ase/cmd/awk/cou-001.out
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
print $1,$3;
|
||||
}
|
||||
|
||||
USSR 275
|
||||
Canada 25
|
||||
China 1032
|
||||
USA 237
|
||||
Brazil 134
|
||||
India 746
|
||||
Mexico 78
|
||||
France 55
|
||||
Japan 120
|
||||
Germany 61
|
||||
England 56
|
15
ase/cmd/awk/cou-002.awk
Normal file
15
ase/cmd/awk/cou-002.awk
Normal file
@ -0,0 +1,15 @@
|
||||
BEGIN {
|
||||
FS = "\t";
|
||||
printf ("%10s %6s %5s %s\n\n",
|
||||
"COUNTRY", "AREA", "POP", "CONTINENT");
|
||||
}
|
||||
|
||||
{
|
||||
printf ("%10s %6d %5d %s\n", $1, $2, $3, $4);
|
||||
area = area + $2;
|
||||
pop = pop + $3;
|
||||
}
|
||||
|
||||
END {
|
||||
printf ("\n%10s %6d %5d\n", "TOTAL", area, pop);
|
||||
}
|
29
ase/cmd/awk/cou-002.out
Normal file
29
ase/cmd/awk/cou-002.out
Normal file
@ -0,0 +1,29 @@
|
||||
BEGIN {
|
||||
FS = " ";
|
||||
printf ("%10s %6s %5s %s\n\n","COUNTRY","AREA","POP","CONTINENT");
|
||||
}
|
||||
|
||||
{
|
||||
printf ("%10s %6d %5d %s\n",$1,$2,$3,$4);
|
||||
area = (area + $2);
|
||||
pop = (pop + $3);
|
||||
}
|
||||
|
||||
END {
|
||||
printf ("\n%10s %6d %5d\n","TOTAL",area,pop);
|
||||
}
|
||||
COUNTRY AREA POP CONTINENT
|
||||
|
||||
USSR 8649 275 Asia
|
||||
Canada 3852 25 North America
|
||||
China 3705 1032 Asia
|
||||
USA 3615 237 North America
|
||||
Brazil 3286 134 South America
|
||||
India 1267 746 Asia
|
||||
Mexico 762 78 North America
|
||||
France 211 55 Europe
|
||||
Japan 144 120 Asia
|
||||
Germany 96 61 Europe
|
||||
England 94 56 Europe
|
||||
|
||||
TOTAL 25681 2819
|
1
ase/cmd/awk/cou-003.awk
Normal file
1
ase/cmd/awk/cou-003.awk
Normal file
@ -0,0 +1 @@
|
||||
$3/$2 >= 0.5
|
6
ase/cmd/awk/cou-003.out
Normal file
6
ase/cmd/awk/cou-003.out
Normal file
@ -0,0 +1,6 @@
|
||||
(($3 / $2) >= 0.5)
|
||||
|
||||
India 1267 746 Asia
|
||||
Japan 144 120 Asia
|
||||
Germany 96 61 Europe
|
||||
England 94 56 Europe
|
1
ase/cmd/awk/cou-004.awk
Normal file
1
ase/cmd/awk/cou-004.awk
Normal file
@ -0,0 +1 @@
|
||||
$0 >= "M"
|
5
ase/cmd/awk/cou-004.out
Normal file
5
ase/cmd/awk/cou-004.out
Normal file
@ -0,0 +1,5 @@
|
||||
($0 >= "M")
|
||||
|
||||
USSR 8649 275 Asia
|
||||
USA 3615 237 North America
|
||||
Mexico 762 78 North America
|
1
ase/cmd/awk/cou-005.awk
Normal file
1
ase/cmd/awk/cou-005.awk
Normal file
@ -0,0 +1 @@
|
||||
$1 < $4
|
6
ase/cmd/awk/cou-005.out
Normal file
6
ase/cmd/awk/cou-005.out
Normal file
@ -0,0 +1,6 @@
|
||||
($1 < $4)
|
||||
|
||||
Canada 3852 25 North America
|
||||
Brazil 3286 134 South America
|
||||
Mexico 762 78 North America
|
||||
England 94 56 Europe
|
1
ase/cmd/awk/cou-006.awk
Normal file
1
ase/cmd/awk/cou-006.awk
Normal file
@ -0,0 +1 @@
|
||||
$2 < $3
|
5
ase/cmd/awk/cou-006.out
Normal file
5
ase/cmd/awk/cou-006.out
Normal file
@ -0,0 +1,5 @@
|
||||
($2 < $3)
|
||||
|
||||
India 1267 746 Asia
|
||||
Mexico 762 78 North America
|
||||
France 211 55 Europe
|
1
ase/cmd/awk/cou-007.awk
Normal file
1
ase/cmd/awk/cou-007.awk
Normal file
@ -0,0 +1 @@
|
||||
/Asia/
|
6
ase/cmd/awk/cou-007.out
Normal file
6
ase/cmd/awk/cou-007.out
Normal file
@ -0,0 +1,6 @@
|
||||
/Asia/
|
||||
|
||||
USSR 8649 275 Asia
|
||||
China 3705 1032 Asia
|
||||
India 1267 746 Asia
|
||||
Japan 144 120 Asia
|
1
ase/cmd/awk/cou-008.awk
Normal file
1
ase/cmd/awk/cou-008.awk
Normal file
@ -0,0 +1 @@
|
||||
$4 ~ /Asia/
|
6
ase/cmd/awk/cou-008.out
Normal file
6
ase/cmd/awk/cou-008.out
Normal file
@ -0,0 +1,6 @@
|
||||
($4 ~ /Asia/)
|
||||
|
||||
USSR 8649 275 Asia
|
||||
China 3705 1032 Asia
|
||||
India 1267 746 Asia
|
||||
Japan 144 120 Asia
|
1
ase/cmd/awk/cou-009.awk
Normal file
1
ase/cmd/awk/cou-009.awk
Normal file
@ -0,0 +1 @@
|
||||
$4 !~ /Asia/
|
9
ase/cmd/awk/cou-009.out
Normal file
9
ase/cmd/awk/cou-009.out
Normal file
@ -0,0 +1,9 @@
|
||||
($4 !~ /Asia/)
|
||||
|
||||
Canada 3852 25 North America
|
||||
USA 3615 237 North America
|
||||
Brazil 3286 134 South America
|
||||
Mexico 762 78 North America
|
||||
France 211 55 Europe
|
||||
Germany 96 61 Europe
|
||||
England 94 56 Europe
|
1
ase/cmd/awk/cou-010.awk
Normal file
1
ase/cmd/awk/cou-010.awk
Normal file
@ -0,0 +1 @@
|
||||
$0 ~ /Asia/
|
6
ase/cmd/awk/cou-010.out
Normal file
6
ase/cmd/awk/cou-010.out
Normal file
@ -0,0 +1,6 @@
|
||||
($0 ~ /Asia/)
|
||||
|
||||
USSR 8649 275 Asia
|
||||
China 3705 1032 Asia
|
||||
India 1267 746 Asia
|
||||
Japan 144 120 Asia
|
3
ase/cmd/awk/cou-011.awk
Normal file
3
ase/cmd/awk/cou-011.awk
Normal file
@ -0,0 +1,3 @@
|
||||
$2 !~ /^[0-9]+$/
|
||||
|
||||
|
2
ase/cmd/awk/cou-011.out
Normal file
2
ase/cmd/awk/cou-011.out
Normal file
@ -0,0 +1,2 @@
|
||||
($2 !~ /^[0-9]+$/)
|
||||
|
1
ase/cmd/awk/cou-012.awk
Normal file
1
ase/cmd/awk/cou-012.awk
Normal file
@ -0,0 +1 @@
|
||||
$4 == "Asia" && $3 > 500
|
4
ase/cmd/awk/cou-012.out
Normal file
4
ase/cmd/awk/cou-012.out
Normal file
@ -0,0 +1,4 @@
|
||||
(($4 == "Asia") && ($3 > 500))
|
||||
|
||||
China 3705 1032 Asia
|
||||
India 1267 746 Asia
|
1
ase/cmd/awk/cou-013.awk
Normal file
1
ase/cmd/awk/cou-013.awk
Normal file
@ -0,0 +1 @@
|
||||
$4 == "Asia" || $4 == "Europe"
|
9
ase/cmd/awk/cou-013.out
Normal file
9
ase/cmd/awk/cou-013.out
Normal file
@ -0,0 +1,9 @@
|
||||
(($4 == "Asia") || ($4 == "Europe"))
|
||||
|
||||
USSR 8649 275 Asia
|
||||
China 3705 1032 Asia
|
||||
India 1267 746 Asia
|
||||
France 211 55 Europe
|
||||
Japan 144 120 Asia
|
||||
Germany 96 61 Europe
|
||||
England 94 56 Europe
|
1
ase/cmd/awk/cou-014.awk
Normal file
1
ase/cmd/awk/cou-014.awk
Normal file
@ -0,0 +1 @@
|
||||
$4 ~ /^(Asia|Europe)$/
|
9
ase/cmd/awk/cou-014.out
Normal file
9
ase/cmd/awk/cou-014.out
Normal file
@ -0,0 +1,9 @@
|
||||
($4 ~ /^(Asia|Europe)$/)
|
||||
|
||||
USSR 8649 275 Asia
|
||||
China 3705 1032 Asia
|
||||
India 1267 746 Asia
|
||||
France 211 55 Europe
|
||||
Japan 144 120 Asia
|
||||
Germany 96 61 Europe
|
||||
England 94 56 Europe
|
1
ase/cmd/awk/cou-015.awk
Normal file
1
ase/cmd/awk/cou-015.awk
Normal file
@ -0,0 +1 @@
|
||||
/Asia/ || /Europe/
|
9
ase/cmd/awk/cou-015.out
Normal file
9
ase/cmd/awk/cou-015.out
Normal file
@ -0,0 +1,9 @@
|
||||
(/Asia/ || /Europe/)
|
||||
|
||||
USSR 8649 275 Asia
|
||||
China 3705 1032 Asia
|
||||
India 1267 746 Asia
|
||||
France 211 55 Europe
|
||||
Japan 144 120 Asia
|
||||
Germany 96 61 Europe
|
||||
England 94 56 Europe
|
1
ase/cmd/awk/cou-016.awk
Normal file
1
ase/cmd/awk/cou-016.awk
Normal file
@ -0,0 +1 @@
|
||||
/Asia|Europe/
|
9
ase/cmd/awk/cou-016.out
Normal file
9
ase/cmd/awk/cou-016.out
Normal file
@ -0,0 +1,9 @@
|
||||
/Asia|Europe/
|
||||
|
||||
USSR 8649 275 Asia
|
||||
China 3705 1032 Asia
|
||||
India 1267 746 Asia
|
||||
France 211 55 Europe
|
||||
Japan 144 120 Asia
|
||||
Germany 96 61 Europe
|
||||
England 94 56 Europe
|
1
ase/cmd/awk/cou-017.awk
Normal file
1
ase/cmd/awk/cou-017.awk
Normal file
@ -0,0 +1 @@
|
||||
/Canada/, /USA/
|
5
ase/cmd/awk/cou-017.out
Normal file
5
ase/cmd/awk/cou-017.out
Normal file
@ -0,0 +1,5 @@
|
||||
/Canada/,/USA/
|
||||
|
||||
Canada 3852 25 North America
|
||||
China 3705 1032 Asia
|
||||
USA 3615 237 North America
|
1
ase/cmd/awk/cou-018.awk
Normal file
1
ase/cmd/awk/cou-018.awk
Normal file
@ -0,0 +1 @@
|
||||
/Eurpoe/, /Africa/
|
2
ase/cmd/awk/cou-018.out
Normal file
2
ase/cmd/awk/cou-018.out
Normal file
@ -0,0 +1,2 @@
|
||||
/Eurpoe/,/Africa/
|
||||
|
1
ase/cmd/awk/cou-019.awk
Normal file
1
ase/cmd/awk/cou-019.awk
Normal file
@ -0,0 +1 @@
|
||||
FNR == 1, FNR == 5 { print FILENAME ": " $0; }
|
9
ase/cmd/awk/cou-019.out
Normal file
9
ase/cmd/awk/cou-019.out
Normal file
@ -0,0 +1,9 @@
|
||||
(FNR == 1),(FNR == 5) {
|
||||
print ((FILENAME ": ") $0);
|
||||
}
|
||||
|
||||
cou-en.data: USSR 8649 275 Asia
|
||||
cou-en.data: Canada 3852 25 North America
|
||||
cou-en.data: China 3705 1032 Asia
|
||||
cou-en.data: USA 3615 237 North America
|
||||
cou-en.data: Brazil 3286 134 South America
|
1
ase/cmd/awk/cou-020.awk
Normal file
1
ase/cmd/awk/cou-020.awk
Normal file
@ -0,0 +1 @@
|
||||
FNR <= 5 { print FILENAME ": " $0; }
|
9
ase/cmd/awk/cou-020.out
Normal file
9
ase/cmd/awk/cou-020.out
Normal file
@ -0,0 +1,9 @@
|
||||
(FNR <= 5) {
|
||||
print ((FILENAME ": ") $0);
|
||||
}
|
||||
|
||||
cou-en.data: USSR 8649 275 Asia
|
||||
cou-en.data: Canada 3852 25 North America
|
||||
cou-en.data: China 3705 1032 Asia
|
||||
cou-en.data: USA 3615 237 North America
|
||||
cou-en.data: Brazil 3286 134 South America
|
1
ase/cmd/awk/cou-021.awk
Normal file
1
ase/cmd/awk/cou-021.awk
Normal file
@ -0,0 +1 @@
|
||||
$4 == "Asia" { print $1, 1000 * $2; }
|
8
ase/cmd/awk/cou-021.out
Normal file
8
ase/cmd/awk/cou-021.out
Normal file
@ -0,0 +1,8 @@
|
||||
($4 == "Asia") {
|
||||
print $1,(1000 * $2);
|
||||
}
|
||||
|
||||
USSR 8649000
|
||||
China 3705000
|
||||
India 1267000
|
||||
Japan 144000
|
6
ase/cmd/awk/cou-022.awk
Normal file
6
ase/cmd/awk/cou-022.awk
Normal file
@ -0,0 +1,6 @@
|
||||
#BEGIN { FS = "\t"; OFS = "\t"; }
|
||||
BEGIN { FS = OFS = "\t"; }
|
||||
$4 == "North America" { $4 = "NA"; }
|
||||
$4 == "South America" { $4 = "SA"; }
|
||||
{ print; }
|
||||
|
27
ase/cmd/awk/cou-022.out
Normal file
27
ase/cmd/awk/cou-022.out
Normal file
@ -0,0 +1,27 @@
|
||||
BEGIN {
|
||||
FS = OFS = " ";
|
||||
}
|
||||
|
||||
($4 == "North America") {
|
||||
$4 = "NA";
|
||||
}
|
||||
|
||||
($4 == "South America") {
|
||||
$4 = "SA";
|
||||
}
|
||||
|
||||
{
|
||||
print;
|
||||
}
|
||||
|
||||
USSR 8649 275 Asia
|
||||
Canada 3852 25 NA
|
||||
China 3705 1032 Asia
|
||||
USA 3615 237 NA
|
||||
Brazil 3286 134 SA
|
||||
India 1267 746 Asia
|
||||
Mexico 762 78 NA
|
||||
France 211 55 Europe
|
||||
Japan 144 120 Asia
|
||||
Germany 96 61 Europe
|
||||
England 94 56 Europe
|
2
ase/cmd/awk/cou-023.awk
Normal file
2
ase/cmd/awk/cou-023.awk
Normal file
@ -0,0 +1,2 @@
|
||||
BEGIN { FS = OFS = "\t"; }
|
||||
{ $5 = 1000 * $3 / $2; print; }
|
20
ase/cmd/awk/cou-023.out
Normal file
20
ase/cmd/awk/cou-023.out
Normal file
@ -0,0 +1,20 @@
|
||||
BEGIN {
|
||||
FS = OFS = " ";
|
||||
}
|
||||
|
||||
{
|
||||
$5 = ((1000 * $3) / $2);
|
||||
print;
|
||||
}
|
||||
|
||||
USSR 8649 275 Asia 31.7956
|
||||
Canada 3852 25 North America 6.49013
|
||||
China 3705 1032 Asia 278.543
|
||||
USA 3615 237 North America 65.5602
|
||||
Brazil 3286 134 South America 40.7791
|
||||
India 1267 746 Asia 588.792
|
||||
Mexico 762 78 North America 102.362
|
||||
France 211 55 Europe 260.664
|
||||
Japan 144 120 Asia 833.333
|
||||
Germany 96 61 Europe 635.417
|
||||
England 94 56 Europe 595.745
|
4
ase/cmd/awk/cou-024.awk
Normal file
4
ase/cmd/awk/cou-024.awk
Normal file
@ -0,0 +1,4 @@
|
||||
$4 == "Asia" { pop = pop + $3; n = n + 1; }
|
||||
END { print "Total population of the", n,
|
||||
"Asian countries is", pop, "million.";
|
||||
}
|
9
ase/cmd/awk/cou-024.out
Normal file
9
ase/cmd/awk/cou-024.out
Normal file
@ -0,0 +1,9 @@
|
||||
($4 == "Asia") {
|
||||
pop = (pop + $3);
|
||||
n = (n + 1);
|
||||
}
|
||||
|
||||
END {
|
||||
print "Total population of the",n,"Asian countries is",pop,"million.";
|
||||
}
|
||||
Total population of the 4 Asian countries is 2173 million.
|
6
ase/cmd/awk/cou-025.awk
Normal file
6
ase/cmd/awk/cou-025.awk
Normal file
@ -0,0 +1,6 @@
|
||||
/Asia/ { pop["Asia"] += $3; }
|
||||
/Europe/ { pop["Europe"] += $3; }
|
||||
END { print "Asian population is", pop["Asia"], "million.";
|
||||
print "European population is", pop["Europe"], "million.";
|
||||
}
|
||||
|
14
ase/cmd/awk/cou-025.out
Normal file
14
ase/cmd/awk/cou-025.out
Normal file
@ -0,0 +1,14 @@
|
||||
/Asia/ {
|
||||
pop["Asia"] += $3;
|
||||
}
|
||||
|
||||
/Europe/ {
|
||||
pop["Europe"] += $3;
|
||||
}
|
||||
|
||||
END {
|
||||
print "Asian population is",pop["Asia"],"million.";
|
||||
print "European population is",pop["Europe"],"million.";
|
||||
}
|
||||
Asian population is 2173 million.
|
||||
European population is 172 million.
|
3
ase/cmd/awk/cou-026.awk
Normal file
3
ase/cmd/awk/cou-026.awk
Normal file
@ -0,0 +1,3 @@
|
||||
BEGIN { FS = "\t"; }
|
||||
{ pop[$4] += $3; }
|
||||
END { for (name in pop) print name, pop[name]; }
|
16
ase/cmd/awk/cou-026.out
Normal file
16
ase/cmd/awk/cou-026.out
Normal file
@ -0,0 +1,16 @@
|
||||
BEGIN {
|
||||
FS = " ";
|
||||
}
|
||||
|
||||
{
|
||||
pop[$4] += $3;
|
||||
}
|
||||
|
||||
END {
|
||||
for (name in pop)
|
||||
print name,pop[name];
|
||||
}
|
||||
Europe 172
|
||||
South America 134
|
||||
North America 340
|
||||
Asia 2173
|
13
ase/cmd/awk/cou-027.awk
Normal file
13
ase/cmd/awk/cou-027.awk
Normal file
@ -0,0 +1,13 @@
|
||||
BEGIN { FS = "\t"; }
|
||||
{ pop[$4] += $3; }
|
||||
END {
|
||||
for (c in pop)
|
||||
printf ("%15s\t%6d\n", c, pop[c]) | "sort -t'\t' +1rn";
|
||||
|
||||
# the following two statements make the program behave
|
||||
# consistently across different platforms.
|
||||
# on some platforms, the sort command output has
|
||||
# been delayed until the program exits.
|
||||
close ("sort -t'\t' +1rn");
|
||||
sleep (1);
|
||||
}
|
18
ase/cmd/awk/cou-027.out
Normal file
18
ase/cmd/awk/cou-027.out
Normal file
@ -0,0 +1,18 @@
|
||||
BEGIN {
|
||||
FS = " ";
|
||||
}
|
||||
|
||||
{
|
||||
pop[$4] += $3;
|
||||
}
|
||||
|
||||
END {
|
||||
for (c in pop)
|
||||
printf ("%15s %6d\n",c,pop[c]) | "sort -t' ' +1rn";
|
||||
close ("sort -t' ' +1rn");
|
||||
sleep (1);
|
||||
}
|
||||
Asia 2173
|
||||
North America 340
|
||||
Europe 172
|
||||
South America 134
|
11
ase/cmd/awk/cou-en.data
Normal file
11
ase/cmd/awk/cou-en.data
Normal file
@ -0,0 +1,11 @@
|
||||
USSR 8649 275 Asia
|
||||
Canada 3852 25 North America
|
||||
China 3705 1032 Asia
|
||||
USA 3615 237 North America
|
||||
Brazil 3286 134 South America
|
||||
India 1267 746 Asia
|
||||
Mexico 762 78 North America
|
||||
France 211 55 Europe
|
||||
Japan 144 120 Asia
|
||||
Germany 96 61 Europe
|
||||
England 94 56 Europe
|
1
ase/cmd/awk/crash01.awk
Normal file
1
ase/cmd/awk/crash01.awk
Normal file
@ -0,0 +1 @@
|
||||
BEGIN { CONVFMT="%s"; printf ("%s\n", 10.34); }
|
9
ase/cmd/awk/crash02.awk
Normal file
9
ase/cmd/awk/crash02.awk
Normal file
@ -0,0 +1,9 @@
|
||||
BEGIN {
|
||||
#CONVFMT="%s";
|
||||
#CONVFMT="%*.*s";
|
||||
#CONVFMT="%*.*f";
|
||||
printf "[[[[[%s]]]]\n", sprintf ("abc %s abc", sprintf ("def %s %s", sprintf ("%s %s %s", "xyz", 1.2342, "xyz"), sprintf ("ttt %s tttt", 123.12)));
|
||||
|
||||
printf "[[[[%s]]]]\n", sprintf ("ttt %s tttt", 123.12);
|
||||
}
|
||||
|
17
ase/cmd/awk/crash04.awk
Normal file
17
ase/cmd/awk/crash04.awk
Normal file
@ -0,0 +1,17 @@
|
||||
BEGIN {
|
||||
|
||||
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
|
||||
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
|
||||
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
|
||||
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
|
||||
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
|
||||
|
||||
abc = 20;
|
||||
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
|
||||
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
|
||||
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
|
||||
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
|
||||
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
|
||||
|
||||
}
|
||||
|
5
ase/cmd/awk/crash05.awk
Normal file
5
ase/cmd/awk/crash05.awk
Normal file
@ -0,0 +1,5 @@
|
||||
BEGIN {
|
||||
a = (((((10+20)))));
|
||||
b = (((((((((((((((((((10+20)))))))))))))))))));
|
||||
c = ((((((((((((((((((((((((((((10 + 20))))))))))))))))))))))))))));
|
||||
}
|
23
ase/cmd/awk/crash08.awk
Normal file
23
ase/cmd/awk/crash08.awk
Normal file
@ -0,0 +1,23 @@
|
||||
function a()
|
||||
{
|
||||
print "aaaa";
|
||||
a();
|
||||
}
|
||||
|
||||
BEGIN {
|
||||
a = (b = 20);
|
||||
print a; print b; for(i=j=1; i< 10; i++) print i, j;
|
||||
|
||||
a += b += 20;
|
||||
print a; print b; for(i=j=1; i< 10; i++) print i, j;
|
||||
|
||||
j = (a < 20)? k = 20: c = 30;
|
||||
print (a < 20)? k = 20: c = 30;
|
||||
print "j=" j;
|
||||
print "k=" k;
|
||||
print "c=" c;
|
||||
|
||||
a();
|
||||
}
|
||||
|
||||
|
13
ase/cmd/awk/descrip.mms
Normal file
13
ase/cmd/awk/descrip.mms
Normal file
@ -0,0 +1,13 @@
|
||||
#
|
||||
# OpenVMS MMS/MMK
|
||||
#
|
||||
|
||||
objects = awk.obj
|
||||
|
||||
CFLAGS = /include="../../.."
|
||||
#CFLAGS = /pointer_size=long /include="../../.."
|
||||
|
||||
aseawk.exe : $(objects)
|
||||
link /executable=aseawk.exe $(objects),[-.-.awk]aseawk/library,[-.-.utl]aseutl/library
|
||||
|
||||
awk.obj depends_on awk.c
|
1
ase/cmd/awk/emp-001.awk
Normal file
1
ase/cmd/awk/emp-001.awk
Normal file
@ -0,0 +1 @@
|
||||
$3 > 0 { print $1, $2 * $3; }
|
8
ase/cmd/awk/emp-001.out
Normal file
8
ase/cmd/awk/emp-001.out
Normal file
@ -0,0 +1,8 @@
|
||||
($3 > 0) {
|
||||
print $1,($2 * $3);
|
||||
}
|
||||
|
||||
Kathy 40
|
||||
Mark 100
|
||||
Mary 121
|
||||
Susie 76.5
|
1
ase/cmd/awk/emp-002.awk
Normal file
1
ase/cmd/awk/emp-002.awk
Normal file
@ -0,0 +1 @@
|
||||
$3 == 0 { print $1; }
|
6
ase/cmd/awk/emp-002.out
Normal file
6
ase/cmd/awk/emp-002.out
Normal file
@ -0,0 +1,6 @@
|
||||
($3 == 0) {
|
||||
print $1;
|
||||
}
|
||||
|
||||
Beth
|
||||
Dan
|
1
ase/cmd/awk/emp-003.awk
Normal file
1
ase/cmd/awk/emp-003.awk
Normal file
@ -0,0 +1 @@
|
||||
{ print NF, $1, $NF; }
|
10
ase/cmd/awk/emp-003.out
Normal file
10
ase/cmd/awk/emp-003.out
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
print NF,$1,$NF;
|
||||
}
|
||||
|
||||
3 Beth 0
|
||||
3 Dan 0
|
||||
3 Kathy 10
|
||||
3 Mark 20
|
||||
3 Mary 22
|
||||
3 Susie 18
|
1
ase/cmd/awk/emp-004.awk
Normal file
1
ase/cmd/awk/emp-004.awk
Normal file
@ -0,0 +1 @@
|
||||
{ print NR, $0; }
|
10
ase/cmd/awk/emp-004.out
Normal file
10
ase/cmd/awk/emp-004.out
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
print NR,$0;
|
||||
}
|
||||
|
||||
1 Beth 4.00 0
|
||||
2 Dan 3.74 0
|
||||
3 Kathy 4.00 10
|
||||
4 Mark 5.00 20
|
||||
5 Mary 5.50 22
|
||||
6 Susie 4.25 18
|
1
ase/cmd/awk/emp-005.awk
Normal file
1
ase/cmd/awk/emp-005.awk
Normal file
@ -0,0 +1 @@
|
||||
{ print "total pay for", $1, "is", $2 * $3; }
|
10
ase/cmd/awk/emp-005.out
Normal file
10
ase/cmd/awk/emp-005.out
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
print "total pay for",$1,"is",($2 * $3);
|
||||
}
|
||||
|
||||
total pay for Beth is 0
|
||||
total pay for Dan is 0
|
||||
total pay for Kathy is 40
|
||||
total pay for Mark is 100
|
||||
total pay for Mary is 121
|
||||
total pay for Susie is 76.5
|
1
ase/cmd/awk/emp-006.awk
Normal file
1
ase/cmd/awk/emp-006.awk
Normal file
@ -0,0 +1 @@
|
||||
{ printf ("total pay for %s is $%.2f\n", $1, $2 * $3); }
|
10
ase/cmd/awk/emp-006.out
Normal file
10
ase/cmd/awk/emp-006.out
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
printf ("total pay for %s is $%.2f\n",$1,($2 * $3));
|
||||
}
|
||||
|
||||
total pay for Beth is $0.00
|
||||
total pay for Dan is $0.00
|
||||
total pay for Kathy is $40.00
|
||||
total pay for Mark is $100.00
|
||||
total pay for Mary is $121.00
|
||||
total pay for Susie is $76.50
|
1
ase/cmd/awk/emp-007.awk
Normal file
1
ase/cmd/awk/emp-007.awk
Normal file
@ -0,0 +1 @@
|
||||
{ printf ("%-8s $%6.2f\n", $1, $2 * $3); }
|
10
ase/cmd/awk/emp-007.out
Normal file
10
ase/cmd/awk/emp-007.out
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
printf ("%-8s $%6.2f\n",$1,($2 * $3));
|
||||
}
|
||||
|
||||
Beth $ 0.00
|
||||
Dan $ 0.00
|
||||
Kathy $ 40.00
|
||||
Mark $100.00
|
||||
Mary $121.00
|
||||
Susie $ 76.50
|
1
ase/cmd/awk/emp-008.awk
Normal file
1
ase/cmd/awk/emp-008.awk
Normal file
@ -0,0 +1 @@
|
||||
$2 >= 5
|
4
ase/cmd/awk/emp-008.out
Normal file
4
ase/cmd/awk/emp-008.out
Normal file
@ -0,0 +1,4 @@
|
||||
($2 >= 5)
|
||||
|
||||
Mark 5.00 20
|
||||
Mary 5.50 22
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user