Recovered from cvs revision 2007-05-01 07:40:00
This commit is contained in:
142
ase/test/awk/AseAwk.java
Normal file
142
ase/test/awk/AseAwk.java
Normal file
@ -0,0 +1,142 @@
|
||||
/*
|
||||
* $Id: AseAwk.java,v 1.1 2007/04/30 08:32:41 bacon Exp $
|
||||
*/
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
public class AseAwk extends ase.awk.StdAwk
|
||||
{
|
||||
public AseAwk () throws ase.awk.Exception
|
||||
{
|
||||
super ();
|
||||
}
|
||||
|
||||
protected String[] consoleInputNames ()
|
||||
{
|
||||
String[] cin = new String[3];
|
||||
cin[0] = "c1.txt";
|
||||
cin[1] = "c2.txt";
|
||||
cin[2] = "c3.txt";
|
||||
return cin;
|
||||
}
|
||||
|
||||
protected String[] consoleOutputNames ()
|
||||
{
|
||||
String[] cout = new String[1];
|
||||
cout[0] = "";
|
||||
return cout;
|
||||
/*
|
||||
String[] cout = new String[3];
|
||||
cout[0] = "c4.txt";
|
||||
cout[1] = "c5.txt";
|
||||
cout[2] = "";
|
||||
return cout;
|
||||
*/
|
||||
}
|
||||
|
||||
protected String[] sourceInputNames ()
|
||||
{
|
||||
String[] sin = new String[1];
|
||||
sin[0] = "t.awk";
|
||||
return sin;
|
||||
}
|
||||
|
||||
/*
|
||||
protected String sourceOutputName ()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
*/
|
||||
|
||||
public static void main (String[] args)
|
||||
{
|
||||
// AWT mode
|
||||
if (args.length == 0)
|
||||
{
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
||||
// console mode
|
||||
AseAwk awk = null;
|
||||
|
||||
if (args.length != 1)
|
||||
{
|
||||
|
||||
System.err.println ("Usage: " + AseAwk.class.getName() + " jni");
|
||||
System.err.println ("Where jni := the full path to the jni library");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
System.load (args[0]);
|
||||
}
|
||||
catch (java.lang.UnsatisfiedLinkError e)
|
||||
{
|
||||
System.err.println ("Error: cannot load the library - " + args[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
awk = new AseAwk ();
|
||||
awk.setMaxDepth (AseAwk.DEPTH_BLOCK_PARSE, 30);
|
||||
awk.setDebug (true);
|
||||
//awk.setDebug (false);
|
||||
|
||||
//awk.setOption (awk.getOption() | OPTION_STRBASEONE);
|
||||
System.out.println ("Option: [" + awk.getOption() + "]");
|
||||
|
||||
awk.parse ();
|
||||
|
||||
System.out.println ("about to run");
|
||||
String[] aaa = new String[3];
|
||||
aaa[0] = "abcdefg";
|
||||
aaa[1] = "qwerty";
|
||||
aaa[2] = "awk is bad";
|
||||
awk.run ("main", aaa);
|
||||
}
|
||||
catch (ase.awk.Exception e)
|
||||
{
|
||||
if (e.getLine() == 0)
|
||||
{
|
||||
System.out.println ("ase.awk.Exception - " + e.getMessage());
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println (
|
||||
"ase.awk.Exception at line " +
|
||||
e.getLine() + " - " + e.getMessage());
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (awk != null)
|
||||
{
|
||||
awk.close ();
|
||||
awk = null;
|
||||
}
|
||||
}
|
||||
System.out.println ("==== end of awk ====");
|
||||
}
|
||||
|
||||
}
|
9
ase/test/awk/AseAwkApplet.html
Normal file
9
ase/test/awk/AseAwkApplet.html
Normal file
@ -0,0 +1,9 @@
|
||||
<html>
|
||||
<body>
|
||||
|
||||
<applet code="AseAwkApplet" archive="aseawk.jar" codebase="." width="640" height="480">
|
||||
</applet>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
23
ase/test/awk/AseAwkApplet.java
Normal file
23
ase/test/awk/AseAwkApplet.java
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* $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) {}
|
||||
}
|
404
ase/test/awk/AseAwkPanel.java
Normal file
404
ase/test/awk/AseAwkPanel.java
Normal file
@ -0,0 +1,404 @@
|
||||
/*
|
||||
* $Id: AseAwkPanel.java,v 1.1 2007/04/30 08:32:41 bacon Exp $
|
||||
*/
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
import java.net.URL;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
|
||||
import ase.awk.StdAwk;
|
||||
import ase.awk.Extio;
|
||||
|
||||
public class AseAwkPanel extends Panel
|
||||
{
|
||||
/* 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Awk extends StdAwk
|
||||
{
|
||||
private AseAwkPanel awkPanel;
|
||||
|
||||
private StringReader srcIn;
|
||||
private StringWriter srcOut;
|
||||
|
||||
private StringReader conIn;
|
||||
private StringWriter conOut;
|
||||
|
||||
public Awk (AseAwkPanel awkPanel) throws Exception
|
||||
{
|
||||
super ();
|
||||
this.awkPanel = awkPanel;
|
||||
}
|
||||
|
||||
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 (Extio extio)
|
||||
{
|
||||
int mode = extio.getMode ();
|
||||
|
||||
if (mode == Extio.MODE_CONSOLE_READ)
|
||||
{
|
||||
conIn = new StringReader (awkPanel.getConsoleInput());
|
||||
return 1;
|
||||
}
|
||||
else if (mode == Extio.MODE_CONSOLE_WRITE)
|
||||
{
|
||||
conOut = new StringWriter ();
|
||||
return 1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
protected int closeConsole (Extio extio)
|
||||
{
|
||||
int mode = extio.getMode ();
|
||||
|
||||
if (mode == Extio.MODE_CONSOLE_READ)
|
||||
{
|
||||
conIn.close ();
|
||||
return 0;
|
||||
}
|
||||
else if (mode == Extio.MODE_CONSOLE_WRITE)
|
||||
{
|
||||
awkPanel.setConsoleOutput (conOut.toString());
|
||||
|
||||
try { conOut.close (); }
|
||||
catch (IOException e) { return -1; }
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected int readConsole (Extio extio, char[] buf, int len)
|
||||
{
|
||||
int mode = extio.getMode ();
|
||||
|
||||
if (mode == Extio.MODE_CONSOLE_READ)
|
||||
{
|
||||
try
|
||||
{
|
||||
int n = conIn.read (buf, 0, len);
|
||||
if (n == -1) n = 0;
|
||||
return n;
|
||||
}
|
||||
catch (IOException e) { return -1; }
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected int writeConsole (Extio extio, char[] buf, int len)
|
||||
{
|
||||
int mode = extio.getMode ();
|
||||
|
||||
if (mode == Extio.MODE_CONSOLE_WRITE)
|
||||
{
|
||||
conOut.write (buf, 0, len);
|
||||
return len;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected int flushConsole (Extio extio)
|
||||
{
|
||||
int mode = extio.getMode ();
|
||||
|
||||
if (mode == Extio.MODE_CONSOLE_WRITE)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected int nextConsole (Extio extio)
|
||||
{
|
||||
int mode = extio.getMode ();
|
||||
|
||||
if (mode == Extio.MODE_CONSOLE_READ)
|
||||
{
|
||||
}
|
||||
else if (mode == Extio.MODE_CONSOLE_WRITE)
|
||||
{
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
private TextArea srcIn;
|
||||
private TextArea srcOut;
|
||||
private TextArea conIn;
|
||||
private TextArea conOut;
|
||||
private TextField jniLib;
|
||||
|
||||
private boolean jniLibLoaded = false;
|
||||
|
||||
public AseAwkPanel ()
|
||||
{
|
||||
jniLib = new TextField ();
|
||||
|
||||
srcIn = new TextArea ();
|
||||
srcOut = new TextArea ();
|
||||
conIn = new TextArea ();
|
||||
conOut = new TextArea ();
|
||||
|
||||
Button runBtn = new Button ("Run Awk");
|
||||
|
||||
runBtn.addActionListener (new ActionListener ()
|
||||
{
|
||||
public void actionPerformed (ActionEvent e)
|
||||
{
|
||||
runAwk ();
|
||||
}
|
||||
});
|
||||
|
||||
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 (srcIn);
|
||||
centerPanel.add (srcOut);
|
||||
centerPanel.add (conIn);
|
||||
centerPanel.add (conOut);
|
||||
|
||||
BorderLayout mainLayout = new BorderLayout ();
|
||||
mainLayout.setHgap (2);
|
||||
mainLayout.setVgap (2);
|
||||
|
||||
setLayout (mainLayout);
|
||||
|
||||
add (topPanel, BorderLayout.NORTH);
|
||||
add (centerPanel, BorderLayout.CENTER);
|
||||
add (runBtn, BorderLayout.SOUTH);
|
||||
|
||||
URL url = this.getClass().getResource (
|
||||
this.getClass().getName() + ".class");
|
||||
File file = new File (url.getFile());
|
||||
|
||||
String osname = System.getProperty ("os.name").toLowerCase();
|
||||
String aseBase = file.getParentFile().getParentFile().getParent();
|
||||
|
||||
if (osname.startsWith ("windows"))
|
||||
{
|
||||
String path = aseBase + "\\lib\\aseawk_jni.dll";
|
||||
jniLib.setText (path.substring(6));
|
||||
}
|
||||
else if (osname.startsWith ("mac"))
|
||||
{
|
||||
String path = aseBase + "/lib/.libs/libaseawk_jni.dylib";
|
||||
jniLib.setText (path.substring(5));
|
||||
}
|
||||
else
|
||||
{
|
||||
String path = aseBase + "/lib/.libs/libaseawk_jni.so";
|
||||
jniLib.setText (path.substring(5));
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
awk = new Awk (this);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
showMessage ("Cannot instantiate awk - " + e.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
awk.parse ();
|
||||
awk.run ();
|
||||
}
|
||||
catch (ase.awk.Exception e)
|
||||
{
|
||||
showMessage ("An exception occurred - " + e.getMessage());
|
||||
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 ();
|
||||
}
|
||||
}
|
34
ase/test/awk/arg.awk
Normal file
34
ase/test/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/test/awk/arr.awk
Normal file
18
ase/test/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];
|
||||
}
|
||||
}
|
102
ase/test/awk/asetestawk.dsp
Normal file
102
ase/test/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
|
247
ase/test/awk/asetestawk.vcproj
Normal file
247
ase/test/awk/asetestawk.vcproj
Normal file
@ -0,0 +1,247 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="asetestawk"
|
||||
ProjectGUID="{57F1E1D0-28B6-42BF-BAFB-045AEE2DCF4F}"
|
||||
RootNamespace="asetestawk"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\..\..\release\bin"
|
||||
IntermediateDirectory=".\release"
|
||||
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/asetestawk.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="..\..\.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
PrecompiledHeaderFile=".\release/asetestawk.pch"
|
||||
AssemblerListingLocation=".\release/"
|
||||
ObjectFile=".\release/"
|
||||
ProgramDataBaseFileName=".\release/"
|
||||
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"
|
||||
ProgramDatabaseFile=".\../../release/bin/aseawk.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
OutputFile=".\../../release/bin/asetestawk.bsc"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\..\..\debug\bin"
|
||||
IntermediateDirectory=".\debug"
|
||||
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/asetestawk.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
PrecompiledHeaderFile=".\debug/asetestawk.pch"
|
||||
AssemblerListingLocation=".\debug/"
|
||||
ObjectFile=".\debug/"
|
||||
ProgramDataBaseFileName=".\debug/"
|
||||
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"
|
||||
ProgramDatabaseFile=".\../../debug/bin/aseawk.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
OutputFile=".\../../debug/bin/asetestawk.bsc"
|
||||
/>
|
||||
<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.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<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>
|
1082
ase/test/awk/awk.c
Normal file
1082
ase/test/awk/awk.c
Normal file
File diff suppressed because it is too large
Load Diff
121
ase/test/awk/comp.awk
Normal file
121
ase/test/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/test/awk/cou-001.awk
Normal file
1
ase/test/awk/cou-001.awk
Normal file
@ -0,0 +1 @@
|
||||
{ print $1, $3; } # print country name and population
|
15
ase/test/awk/cou-001.out
Normal file
15
ase/test/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/test/awk/cou-002.awk
Normal file
15
ase/test/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/test/awk/cou-002.out
Normal file
29
ase/test/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/test/awk/cou-003.awk
Normal file
1
ase/test/awk/cou-003.awk
Normal file
@ -0,0 +1 @@
|
||||
$3/$2 >= 0.5
|
6
ase/test/awk/cou-003.out
Normal file
6
ase/test/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/test/awk/cou-004.awk
Normal file
1
ase/test/awk/cou-004.awk
Normal file
@ -0,0 +1 @@
|
||||
$0 >= "M"
|
5
ase/test/awk/cou-004.out
Normal file
5
ase/test/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/test/awk/cou-005.awk
Normal file
1
ase/test/awk/cou-005.awk
Normal file
@ -0,0 +1 @@
|
||||
$1 < $4
|
6
ase/test/awk/cou-005.out
Normal file
6
ase/test/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/test/awk/cou-006.awk
Normal file
1
ase/test/awk/cou-006.awk
Normal file
@ -0,0 +1 @@
|
||||
$2 < $3
|
5
ase/test/awk/cou-006.out
Normal file
5
ase/test/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/test/awk/cou-007.awk
Normal file
1
ase/test/awk/cou-007.awk
Normal file
@ -0,0 +1 @@
|
||||
/Asia/
|
6
ase/test/awk/cou-007.out
Normal file
6
ase/test/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/test/awk/cou-008.awk
Normal file
1
ase/test/awk/cou-008.awk
Normal file
@ -0,0 +1 @@
|
||||
$4 ~ /Asia/
|
6
ase/test/awk/cou-008.out
Normal file
6
ase/test/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/test/awk/cou-009.awk
Normal file
1
ase/test/awk/cou-009.awk
Normal file
@ -0,0 +1 @@
|
||||
$4 !~ /Asia/
|
9
ase/test/awk/cou-009.out
Normal file
9
ase/test/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/test/awk/cou-010.awk
Normal file
1
ase/test/awk/cou-010.awk
Normal file
@ -0,0 +1 @@
|
||||
$0 ~ /Asia/
|
6
ase/test/awk/cou-010.out
Normal file
6
ase/test/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/test/awk/cou-011.awk
Normal file
3
ase/test/awk/cou-011.awk
Normal file
@ -0,0 +1,3 @@
|
||||
$2 !~ /^[0-9]+$/
|
||||
|
||||
|
2
ase/test/awk/cou-011.out
Normal file
2
ase/test/awk/cou-011.out
Normal file
@ -0,0 +1,2 @@
|
||||
($2 !~ /^[0-9]+$/)
|
||||
|
1
ase/test/awk/cou-012.awk
Normal file
1
ase/test/awk/cou-012.awk
Normal file
@ -0,0 +1 @@
|
||||
$4 == "Asia" && $3 > 500
|
4
ase/test/awk/cou-012.out
Normal file
4
ase/test/awk/cou-012.out
Normal file
@ -0,0 +1,4 @@
|
||||
(($4 == "Asia") && ($3 > 500))
|
||||
|
||||
China 3705 1032 Asia
|
||||
India 1267 746 Asia
|
1
ase/test/awk/cou-013.awk
Normal file
1
ase/test/awk/cou-013.awk
Normal file
@ -0,0 +1 @@
|
||||
$4 == "Asia" || $4 == "Europe"
|
9
ase/test/awk/cou-013.out
Normal file
9
ase/test/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/test/awk/cou-014.awk
Normal file
1
ase/test/awk/cou-014.awk
Normal file
@ -0,0 +1 @@
|
||||
$4 ~ /^(Asia|Europe)$/
|
9
ase/test/awk/cou-014.out
Normal file
9
ase/test/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/test/awk/cou-015.awk
Normal file
1
ase/test/awk/cou-015.awk
Normal file
@ -0,0 +1 @@
|
||||
/Asia/ || /Europe/
|
9
ase/test/awk/cou-015.out
Normal file
9
ase/test/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/test/awk/cou-016.awk
Normal file
1
ase/test/awk/cou-016.awk
Normal file
@ -0,0 +1 @@
|
||||
/Asia|Europe/
|
9
ase/test/awk/cou-016.out
Normal file
9
ase/test/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/test/awk/cou-017.awk
Normal file
1
ase/test/awk/cou-017.awk
Normal file
@ -0,0 +1 @@
|
||||
/Canada/, /USA/
|
5
ase/test/awk/cou-017.out
Normal file
5
ase/test/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/test/awk/cou-018.awk
Normal file
1
ase/test/awk/cou-018.awk
Normal file
@ -0,0 +1 @@
|
||||
/Eurpoe/, /Africa/
|
2
ase/test/awk/cou-018.out
Normal file
2
ase/test/awk/cou-018.out
Normal file
@ -0,0 +1,2 @@
|
||||
/Eurpoe/,/Africa/
|
||||
|
1
ase/test/awk/cou-019.awk
Normal file
1
ase/test/awk/cou-019.awk
Normal file
@ -0,0 +1 @@
|
||||
FNR == 1, FNR == 5 { print FILENAME ": " $0; }
|
9
ase/test/awk/cou-019.out
Normal file
9
ase/test/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/test/awk/cou-020.awk
Normal file
1
ase/test/awk/cou-020.awk
Normal file
@ -0,0 +1 @@
|
||||
FNR <= 5 { print FILENAME ": " $0; }
|
9
ase/test/awk/cou-020.out
Normal file
9
ase/test/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/test/awk/cou-021.awk
Normal file
1
ase/test/awk/cou-021.awk
Normal file
@ -0,0 +1 @@
|
||||
$4 == "Asia" { print $1, 1000 * $2; }
|
8
ase/test/awk/cou-021.out
Normal file
8
ase/test/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/test/awk/cou-022.awk
Normal file
6
ase/test/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/test/awk/cou-022.out
Normal file
27
ase/test/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/test/awk/cou-023.awk
Normal file
2
ase/test/awk/cou-023.awk
Normal file
@ -0,0 +1,2 @@
|
||||
BEGIN { FS = OFS = "\t"; }
|
||||
{ $5 = 1000 * $3 / $2; print; }
|
20
ase/test/awk/cou-023.out
Normal file
20
ase/test/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/test/awk/cou-024.awk
Normal file
4
ase/test/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/test/awk/cou-024.out
Normal file
9
ase/test/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/test/awk/cou-025.awk
Normal file
6
ase/test/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/test/awk/cou-025.out
Normal file
14
ase/test/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/test/awk/cou-026.awk
Normal file
3
ase/test/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/test/awk/cou-026.out
Normal file
16
ase/test/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
|
5
ase/test/awk/cou-027.awk
Normal file
5
ase/test/awk/cou-027.awk
Normal file
@ -0,0 +1,5 @@
|
||||
BEGIN { FS = "\t"; }
|
||||
{ pop[$4] += $3; }
|
||||
END { for (c in pop)
|
||||
printf ("%15s\t%6d\n", c, pop[c]) | "sort -t'\t' +1rn";
|
||||
}
|
16
ase/test/awk/cou-027.out
Normal file
16
ase/test/awk/cou-027.out
Normal file
@ -0,0 +1,16 @@
|
||||
BEGIN {
|
||||
FS = " ";
|
||||
}
|
||||
|
||||
{
|
||||
pop[$4] += $3;
|
||||
}
|
||||
|
||||
END {
|
||||
for (c in pop)
|
||||
printf ("%15s %6d\n",c,pop[c]) | "sort -t' ' +1rn";
|
||||
}
|
||||
Asia 2173
|
||||
North America 340
|
||||
Europe 172
|
||||
South America 134
|
11
ase/test/awk/cou-en.data
Normal file
11
ase/test/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/test/awk/crash01.awk
Normal file
1
ase/test/awk/crash01.awk
Normal file
@ -0,0 +1 @@
|
||||
BEGIN { CONVFMT="%s"; printf ("%s\n", 10.34); }
|
9
ase/test/awk/crash02.awk
Normal file
9
ase/test/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/test/awk/crash04.awk
Normal file
17
ase/test/awk/crash04.awk
Normal file
@ -0,0 +1,17 @@
|
||||
BEGIN {
|
||||
|
||||
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{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}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
|
||||
|
||||
}
|
||||
|
5
ase/test/awk/crash05.awk
Normal file
5
ase/test/awk/crash05.awk
Normal file
@ -0,0 +1,5 @@
|
||||
BEGIN {
|
||||
a = (((((10+20)))));
|
||||
b = (((((((((((((((((((10+20)))))))))))))))))));
|
||||
c = ((((((((((((((((((((((((((((10 + 20))))))))))))))))))))))))))));
|
||||
}
|
23
ase/test/awk/crash08.awk
Normal file
23
ase/test/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/test/awk/descrip.mms
Normal file
13
ase/test/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/test/awk/emp-001.awk
Normal file
1
ase/test/awk/emp-001.awk
Normal file
@ -0,0 +1 @@
|
||||
$3 > 0 { print $1, $2 * $3; }
|
8
ase/test/awk/emp-001.out
Normal file
8
ase/test/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/test/awk/emp-002.awk
Normal file
1
ase/test/awk/emp-002.awk
Normal file
@ -0,0 +1 @@
|
||||
$3 == 0 { print $1; }
|
6
ase/test/awk/emp-002.out
Normal file
6
ase/test/awk/emp-002.out
Normal file
@ -0,0 +1,6 @@
|
||||
($3 == 0) {
|
||||
print $1;
|
||||
}
|
||||
|
||||
Beth
|
||||
Dan
|
1
ase/test/awk/emp-003.awk
Normal file
1
ase/test/awk/emp-003.awk
Normal file
@ -0,0 +1 @@
|
||||
{ print NF, $1, $NF; }
|
10
ase/test/awk/emp-003.out
Normal file
10
ase/test/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/test/awk/emp-004.awk
Normal file
1
ase/test/awk/emp-004.awk
Normal file
@ -0,0 +1 @@
|
||||
{ print NR, $0; }
|
10
ase/test/awk/emp-004.out
Normal file
10
ase/test/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/test/awk/emp-005.awk
Normal file
1
ase/test/awk/emp-005.awk
Normal file
@ -0,0 +1 @@
|
||||
{ print "total pay for", $1, "is", $2 * $3; }
|
10
ase/test/awk/emp-005.out
Normal file
10
ase/test/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/test/awk/emp-006.awk
Normal file
1
ase/test/awk/emp-006.awk
Normal file
@ -0,0 +1 @@
|
||||
{ printf ("total pay for %s is $%.2f\n", $1, $2 * $3); }
|
10
ase/test/awk/emp-006.out
Normal file
10
ase/test/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/test/awk/emp-007.awk
Normal file
1
ase/test/awk/emp-007.awk
Normal file
@ -0,0 +1 @@
|
||||
{ printf ("%-8s $%6.2f\n", $1, $2 * $3); }
|
10
ase/test/awk/emp-007.out
Normal file
10
ase/test/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/test/awk/emp-008.awk
Normal file
1
ase/test/awk/emp-008.awk
Normal file
@ -0,0 +1 @@
|
||||
$2 >= 5
|
4
ase/test/awk/emp-008.out
Normal file
4
ase/test/awk/emp-008.out
Normal file
@ -0,0 +1,4 @@
|
||||
($2 >= 5)
|
||||
|
||||
Mark 5.00 20
|
||||
Mary 5.50 22
|
1
ase/test/awk/emp-009.awk
Normal file
1
ase/test/awk/emp-009.awk
Normal file
@ -0,0 +1 @@
|
||||
$2 * $3 > 50 { printf ("$%.2f for %s\n", $2 * $3, $1); }
|
7
ase/test/awk/emp-009.out
Normal file
7
ase/test/awk/emp-009.out
Normal file
@ -0,0 +1,7 @@
|
||||
(($2 * $3) > 50) {
|
||||
printf ("$%.2f for %s\n",($2 * $3),$1);
|
||||
}
|
||||
|
||||
$100.00 for Mark
|
||||
$121.00 for Mary
|
||||
$76.50 for Susie
|
1
ase/test/awk/emp-010.awk
Normal file
1
ase/test/awk/emp-010.awk
Normal file
@ -0,0 +1 @@
|
||||
$1 == "Susie"
|
3
ase/test/awk/emp-010.out
Normal file
3
ase/test/awk/emp-010.out
Normal file
@ -0,0 +1,3 @@
|
||||
($1 == "Susie")
|
||||
|
||||
Susie 4.25 18
|
1
ase/test/awk/emp-011.awk
Normal file
1
ase/test/awk/emp-011.awk
Normal file
@ -0,0 +1 @@
|
||||
/Susie/
|
3
ase/test/awk/emp-011.out
Normal file
3
ase/test/awk/emp-011.out
Normal file
@ -0,0 +1,3 @@
|
||||
/Susie/
|
||||
|
||||
Susie 4.25 18
|
1
ase/test/awk/emp-012.awk
Normal file
1
ase/test/awk/emp-012.awk
Normal file
@ -0,0 +1 @@
|
||||
$2 >= 4 || $3 >= 20
|
7
ase/test/awk/emp-012.out
Normal file
7
ase/test/awk/emp-012.out
Normal file
@ -0,0 +1,7 @@
|
||||
(($2 >= 4) || ($3 >= 20))
|
||||
|
||||
Beth 4.00 0
|
||||
Kathy 4.00 10
|
||||
Mark 5.00 20
|
||||
Mary 5.50 22
|
||||
Susie 4.25 18
|
2
ase/test/awk/emp-013.awk
Normal file
2
ase/test/awk/emp-013.awk
Normal file
@ -0,0 +1,2 @@
|
||||
$2 >= 4
|
||||
$3 >= 20
|
11
ase/test/awk/emp-013.out
Normal file
11
ase/test/awk/emp-013.out
Normal file
@ -0,0 +1,11 @@
|
||||
($2 >= 4)
|
||||
|
||||
($3 >= 20)
|
||||
|
||||
Beth 4.00 0
|
||||
Kathy 4.00 10
|
||||
Mark 5.00 20
|
||||
Mark 5.00 20
|
||||
Mary 5.50 22
|
||||
Mary 5.50 22
|
||||
Susie 4.25 18
|
1
ase/test/awk/emp-014.awk
Normal file
1
ase/test/awk/emp-014.awk
Normal file
@ -0,0 +1 @@
|
||||
!($2 < 4 && $3 < 20)
|
7
ase/test/awk/emp-014.out
Normal file
7
ase/test/awk/emp-014.out
Normal file
@ -0,0 +1,7 @@
|
||||
(!((($2 < 4) && ($3 < 20))))
|
||||
|
||||
Beth 4.00 0
|
||||
Kathy 4.00 10
|
||||
Mark 5.00 20
|
||||
Mary 5.50 22
|
||||
Susie 4.25 18
|
5
ase/test/awk/emp-015.awk
Normal file
5
ase/test/awk/emp-015.awk
Normal file
@ -0,0 +1,5 @@
|
||||
NF != 3 { print $0, "number of fields is not equal to 3"; }
|
||||
$2 < 3.35 { print $0, "rate is below minimum wage"; }
|
||||
$2 > 10 { print $0, "rate exceeds $10 per hour"; }
|
||||
$3 < 0 { print $0, "negative hours worked"; }
|
||||
$3 > 60 { print $0, "too many hours worked"; }
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user